Module: SpreeCmCommissioner::LoadTest::FlowRegistry

Defined in:
app/services/spree_cm_commissioner/load_test/flow_registry.rb

Overview

Reads config/load_test_flows/platform,tenant.yml — the registry of k6 flows (../../../../load_testing) and where to find real data for each one. Purely descriptive: nothing here queries the DB or generates JSON, it just surfaces the YAML for the "Test Data Sources" card on the admin/organizer Load Testing pages. See those files' header comments for the field shapes.

Constant Summary collapse

YAML_DIR =
File.join(SpreeCmCommissioner::Engine.root, 'config', 'load_test_flows')
YAML_PATHS =
{
  'platform' => File.join(YAML_DIR, 'platform.yml'),
  'tenant' => File.join(YAML_DIR, 'tenant.yml')
}.freeze

Class Method Summary collapse

Class Method Details

.allObject



20
21
22
23
# File 'app/services/spree_cm_commissioner/load_test/flow_registry.rb', line 20

def self.all
  @all ||= YAML_PATHS.transform_values { |path| YAML.load_file(path) }
                     .deep_symbolize_keys.transform_keys(&:to_s)
end

.for_workflow(workflow) ⇒ Object

workflow: 'platform' or 'tenant'. Returns { flow_name => attributes } in file order.



16
17
18
# File 'app/services/spree_cm_commissioner/load_test/flow_registry.rb', line 16

def self.for_workflow(workflow)
  all.fetch(workflow.to_s, {})
end