hybrid_platforms_conductor 32.8.1 → 32.8.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f190c223603682dd67a933cb989ef89858d71459ebb1d962bfffda9def7666f2
|
4
|
+
data.tar.gz: 4fd85a4b961dc8ba8cc2c83b3f9749b49a021203c37afbe91db5123e54068007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77c67013ea488956dd55927a06b22733efc7f283aa234bd3527b02a8044517447177a686c4964e27c7ff62afd9513de34efe33321ee6fdb16f7e3d6cd0dd06c
|
7
|
+
data.tar.gz: 0e041f3b998df727e83ec6580b09a02e4ee22c246e23a2f7ef5e3b64a3d60fd39745c1ed2241846467c14ba9d11b6dc8e8955929b6940f7ef87132369ecc9c80
|
@@ -428,9 +428,11 @@ module HybridPlatformsConductor
|
|
428
428
|
end
|
429
429
|
end
|
430
430
|
# Compute the timeout that will be applied, from the max timeout sum for every node that has tests to run
|
431
|
-
timeout = CONNECTION_TIMEOUT +
|
432
|
-
|
433
|
-
|
431
|
+
timeout = CONNECTION_TIMEOUT + (
|
432
|
+
@cmds_to_run.map do |_node, cmds_list|
|
433
|
+
cmds_list.inject(0) { |total_timeout, (_cmd, test_info)| test_info[:timeout] + total_timeout }
|
434
|
+
end.max || 0
|
435
|
+
)
|
434
436
|
# Run commands on nodes, in grouped way to avoid too many connections, per node
|
435
437
|
# Hash< String, Array<String> >
|
436
438
|
@test_cmds = Hash[@cmds_to_run.map do |node, cmds_list|
|
@@ -464,33 +466,35 @@ module HybridPlatformsConductor
|
|
464
466
|
end,
|
465
467
|
test_execution: proc do |test|
|
466
468
|
exit_status, stdout, stderr = @actions_result[test.node]
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
469
|
+
unless exit_status.nil?
|
470
|
+
if exit_status.is_a?(Symbol)
|
471
|
+
test.error "Error while executing tests: #{exit_status}: #{stderr}"
|
472
|
+
else
|
473
|
+
log_debug <<~EOS
|
474
|
+
----- Commands for #{test.node}:
|
475
|
+
#{@test_cmds[test.node][:remote_bash].join("\n")}
|
476
|
+
----- STDOUT:
|
477
|
+
#{stdout}
|
478
|
+
----- STDERR:
|
479
|
+
#{stderr}
|
480
|
+
-----
|
481
|
+
EOS
|
482
|
+
# Skip the first section, as it can contain SSH banners
|
483
|
+
cmd_stdouts = stdout.split("#{CMD_SEPARATOR}\n")[1..-1]
|
484
|
+
cmd_stdouts = [] if cmd_stdouts.nil?
|
485
|
+
cmd_stderrs = stderr.split("#{CMD_SEPARATOR}\n")[1..-1]
|
486
|
+
cmd_stderrs = [] if cmd_stderrs.nil?
|
487
|
+
@cmds_to_run[test.node].zip(cmd_stdouts, cmd_stderrs).each do |(cmd, test_info), cmd_stdout, cmd_stderr|
|
488
|
+
# Find the section that corresponds to this test
|
489
|
+
if test_info[:test] == test
|
490
|
+
cmd_stdout = '' if cmd_stdout.nil?
|
491
|
+
cmd_stderr = '' if cmd_stderr.nil?
|
492
|
+
stdout_lines = cmd_stdout.split("\n")
|
493
|
+
# Last line of stdout is the return code
|
494
|
+
return_code = stdout_lines.empty? ? :command_cant_run : Integer(stdout_lines.last)
|
495
|
+
test.error "Command '#{cmd}' returned error code #{return_code}", "----- STDOUT:\n#{stdout_lines[0..-2].join("\n")}\n----- STDERR:\n#{cmd_stderr}" unless return_code == 0
|
496
|
+
test_info[:validator].call(stdout_lines[0..-2], cmd_stderr.split("\n"), return_code)
|
497
|
+
end
|
494
498
|
end
|
495
499
|
end
|
496
500
|
end
|
@@ -69,7 +69,7 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
69
69
|
'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
|
70
70
|
'node21' => { 'test_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
|
71
71
|
'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
|
72
|
-
}}
|
72
|
+
} }
|
73
73
|
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
74
74
|
expect(ssh_executions.sort).to eq [
|
75
75
|
['node11', ['stdout11'], ['stderr11'], 0],
|
@@ -88,7 +88,7 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
88
88
|
HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
|
89
89
|
'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
|
90
90
|
'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
|
91
|
-
}}
|
91
|
+
} }
|
92
92
|
expect(test_tests_runner.run_tests(%w[node12 node22])).to eq 0
|
93
93
|
expect(ssh_executions.sort).to eq [
|
94
94
|
['node12', ['stdout12'], ['stderr12'], 0],
|
@@ -97,6 +97,19 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
it 'does not execute anything when the tests report no command' do
|
101
|
+
with_test_platform_for_node_connection_tests do
|
102
|
+
test_tests_runner.tests = [:node_ssh_test]
|
103
|
+
ssh_executions = []
|
104
|
+
HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
|
105
|
+
'node12' => {},
|
106
|
+
'node22' => {}
|
107
|
+
} }
|
108
|
+
expect(test_tests_runner.run_tests(%w[node12 node22])).to eq 0
|
109
|
+
expect(ssh_executions).to eq []
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
100
113
|
it 'executes several SSH node tests once per node with the correct command, grouping commands' do
|
101
114
|
with_test_platform_for_node_connection_tests do
|
102
115
|
expect_actions_executor_runs([proc do |actions|
|