Method: Toaster::TestOrchestrator#distribute_test_cases

Defined in:
lib/toaster/test/test_orchestrator.rb

#distribute_test_cases(tests_to_run) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/toaster/test/test_orchestrator.rb', line 99

def distribute_test_cases(tests_to_run)
  tests = tests_to_run
  tests_orig = tests_to_run.dup
  puts "INFO: Distributing #{tests.size} generated tests to #{@hosts.size} hosts"
  tests_by_host = {}
  while !tests.empty?
    test = tests.shift
    host = select_host()
    tests_by_host[host] = [] if !tests_by_host[host]
    tests_by_host[host] << test.uuid
    test.executing_host = host.host
  end
  tests_orig.each do |t|
    # save test case to store "t.executing_host" to DB
    t.save
  end
  tests_by_host.each do |host,test_case_list|
    puts "INFO: Sending test case list #{test_case_list} to host #{host}"
    blocking = false
    output = host.runtest(test_case_list.join(","), blocking)
  end
end