Class: FtrRuby::TestInfra

Inherits:
Object
  • Object
show all
Defined in:
lib/test_infrastructure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_host:, basepath:, test_protocol:) ⇒ TestInfra

Returns a new instance of TestInfra.



7
8
9
10
11
# File 'lib/test_infrastructure.rb', line 7

def initialize(test_host:, basepath:, test_protocol:)
  @test_host = test_host
  @test_protocol = test_protocol
  @basepath = basepath
end

Instance Attribute Details

#basepathObject

Returns the value of attribute basepath.



5
6
7
# File 'lib/test_infrastructure.rb', line 5

def basepath
  @basepath
end

#test_hostObject

Returns the value of attribute test_host.



5
6
7
# File 'lib/test_infrastructure.rb', line 5

def test_host
  @test_host
end

#test_protocolObject

Returns the value of attribute test_protocol.



5
6
7
# File 'lib/test_infrastructure.rb', line 5

def test_protocol
  @test_protocol
end

Instance Method Details

#get_tests_metrics(tests:) ⇒ Object

there is a need to map between a test and its registered Metric in FS. This will return the label for the test in principle, we cojuld return a more complex object, but all I need now is the label



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/test_infrastructure.rb', line 17

def get_tests_metrics(tests:)
  threads = tests.map { |testid| Thread.new(testid) { |tid| fetch_metric(tid) } }

  labels = {}
  landingpages = {}
  threads.each do |t|
    tid, label, lpage = t.value
    labels[tid] = label
    landingpages[tid] = lpage
  end
  [labels, landingpages]
end