hybrid_platforms_conductor 32.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/check-node +24 -0
- data/bin/deploy +12 -0
- data/bin/dump_nodes_json +12 -0
- data/bin/free_ips +23 -0
- data/bin/free_veids +17 -0
- data/bin/get_impacted_nodes +43 -0
- data/bin/last_deploys +56 -0
- data/bin/nodes_to_deploy +104 -0
- data/bin/report +10 -0
- data/bin/run +39 -0
- data/bin/setup +11 -0
- data/bin/ssh_config +14 -0
- data/bin/test +13 -0
- data/bin/topograph +54 -0
- data/lib/hybrid_platforms_conductor/action.rb +82 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
- data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
- data/lib/hybrid_platforms_conductor/config.rb +263 -0
- data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
- data/lib/hybrid_platforms_conductor/connector.rb +84 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
- data/lib/hybrid_platforms_conductor/executable.rb +145 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
- data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
- data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
- data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
- data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
- data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
- data/lib/hybrid_platforms_conductor/report.rb +31 -0
- data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
- data/lib/hybrid_platforms_conductor/test.rb +141 -0
- data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
- data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
- data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
- data/lib/hybrid_platforms_conductor/version.rb +5 -0
- data/spec/hybrid_platforms_conductor_test.rb +159 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
- data/spec/spec_helper.rb +111 -0
- metadata +566 -0
@@ -0,0 +1,194 @@
|
|
1
|
+
describe HybridPlatformsConductor::TestsRunner do
|
2
|
+
|
3
|
+
it 'executes all tests when no test is selected' do
|
4
|
+
with_test_platform do
|
5
|
+
register_test_plugins(test_tests_runner,
|
6
|
+
global_test: HybridPlatformsConductorTest::TestPlugins::Global,
|
7
|
+
global_test_2: HybridPlatformsConductorTest::TestPlugins::Global
|
8
|
+
)
|
9
|
+
expect(test_tests_runner.run_tests([])).to eq 0
|
10
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Global.nbr_runs).to eq 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'executes all tests when all tests are selected' do
|
15
|
+
with_test_platform do
|
16
|
+
register_test_plugins(test_tests_runner,
|
17
|
+
global_test: HybridPlatformsConductorTest::TestPlugins::Global,
|
18
|
+
global_test_2: HybridPlatformsConductorTest::TestPlugins::Global
|
19
|
+
)
|
20
|
+
test_tests_runner.tests = [:all]
|
21
|
+
expect(test_tests_runner.run_tests([])).to eq 0
|
22
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Global.nbr_runs).to eq 2
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns 1 when tests are failing' do
|
27
|
+
with_test_platform do
|
28
|
+
register_test_plugins(test_tests_runner, global_test: HybridPlatformsConductorTest::TestPlugins::Global)
|
29
|
+
HybridPlatformsConductorTest::TestPlugins::Global.fail = true
|
30
|
+
expect(test_tests_runner.run_tests([])).to eq 1
|
31
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Global.nbr_runs).to eq 0
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns 0 when tests are failing as expected' do
|
36
|
+
with_test_platform({}, false, '
|
37
|
+
expect_tests_to_fail(:platform_test, \'Expected failure\')
|
38
|
+
') do
|
39
|
+
register_test_plugins(test_tests_runner, platform_test: HybridPlatformsConductorTest::TestPlugins::Platform)
|
40
|
+
HybridPlatformsConductorTest::TestPlugins::Platform.fail_for = ['platform']
|
41
|
+
expect(test_tests_runner.run_tests([])).to eq 0
|
42
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs).to eq []
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns 0 when tests are failing as expected on a given node' do
|
47
|
+
with_test_platform({ nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} } }, false, '
|
48
|
+
for_nodes(\'node2\') do
|
49
|
+
expect_tests_to_fail(:node_test, \'Expected failure\')
|
50
|
+
end
|
51
|
+
') do
|
52
|
+
register_test_plugins(test_tests_runner, node_test: HybridPlatformsConductorTest::TestPlugins::Node)
|
53
|
+
HybridPlatformsConductorTest::TestPlugins::Node.fail_for = { node_test: ['node2'] }
|
54
|
+
expect(test_tests_runner.run_tests(%w[node1 node2 node3])).to eq 0
|
55
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs.sort).to eq [[:node_test, 'node1'], [:node_test, 'node3']].sort
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'returns 1 when tests are succeeding but were expected to fail' do
|
60
|
+
with_test_platform({}, false, '
|
61
|
+
expect_tests_to_fail(:platform_test, \'Expected failure\')
|
62
|
+
') do
|
63
|
+
register_test_plugins(test_tests_runner, platform_test: HybridPlatformsConductorTest::TestPlugins::Platform)
|
64
|
+
expect(test_tests_runner.run_tests([])).to eq 1
|
65
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs).to eq [[:platform_test, 'platform']]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'returns 1 when extra expected failures have not been tested when running all tests' do
|
70
|
+
with_test_platform({ nodes: { 'another_node' => {} } }, false, '
|
71
|
+
for_nodes(\'another_node\') do
|
72
|
+
expect_tests_to_fail(:platform_test, \'Expected failure\')
|
73
|
+
end
|
74
|
+
') do
|
75
|
+
register_test_plugins(test_tests_runner, platform_test: HybridPlatformsConductorTest::TestPlugins::Platform)
|
76
|
+
expect(test_tests_runner.run_tests([])).to eq 1
|
77
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs).to eq [[:platform_test, 'platform']]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'fails when expected failures reference missing nodes' do
|
82
|
+
with_test_platform({ nodes: { 'node' => {} } }, false, '
|
83
|
+
for_nodes(\'missing_node\') do
|
84
|
+
expect_tests_to_fail(:node_test, \'Expected failure\')
|
85
|
+
end
|
86
|
+
'
|
87
|
+
) do
|
88
|
+
register_test_plugins(test_tests_runner, node_test: HybridPlatformsConductorTest::TestPlugins::Node)
|
89
|
+
expect { test_tests_runner.run_tests([{ all: true }]) }.to raise_error 'Unknown nodes: missing_node'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'fails when we ask for an unknown test' do
|
94
|
+
with_test_platform do
|
95
|
+
register_test_plugins(test_tests_runner, global_test: HybridPlatformsConductorTest::TestPlugins::Global)
|
96
|
+
test_tests_runner.tests = [:global_test_2]
|
97
|
+
expect { test_tests_runner.run_tests([]) }.to raise_error(RuntimeError, 'Unknown test names: global_test_2')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'executes different tests levels if 1 plugin defines them' do
|
102
|
+
with_test_platforms(
|
103
|
+
'platform1' => { nodes: { 'node11' => {}, 'node12' => {} } },
|
104
|
+
'platform2' => { nodes: { 'node21' => {}, 'node22' => {} } }
|
105
|
+
) do
|
106
|
+
register_test_plugins(test_tests_runner, several_tests: HybridPlatformsConductorTest::TestPlugins::SeveralChecks)
|
107
|
+
# Mock the Actions Executor and Deployer expected calls
|
108
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
|
109
|
+
expect(test_deployer.use_why_run).to eq true
|
110
|
+
{
|
111
|
+
'node11' => [0, 'node11 check ok', 'node11 stderr'],
|
112
|
+
'node12' => [0, 'node12 check ok', 'node12 stderr'],
|
113
|
+
'node21' => [0, 'node21 check ok', 'node21 stderr'],
|
114
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
115
|
+
}
|
116
|
+
end
|
117
|
+
expect_actions_executor_runs([proc do |actions|
|
118
|
+
node_suffixes = %w[11 12 21 22]
|
119
|
+
expect(actions.size).to eq node_suffixes.size
|
120
|
+
node_suffixes.each do |node_suffix|
|
121
|
+
node = "node#{node_suffix}"
|
122
|
+
expect(actions.key?(node)).to eq true
|
123
|
+
expect(actions[node].size).to eq 1
|
124
|
+
expect(actions[node][:remote_bash]).to eq [
|
125
|
+
'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
|
126
|
+
'>&2 echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
|
127
|
+
"test_node#{node_suffix}.sh",
|
128
|
+
'echo "$?"'
|
129
|
+
]
|
130
|
+
end
|
131
|
+
Hash[node_suffixes.map do |node_suffix|
|
132
|
+
[
|
133
|
+
"node#{node_suffix}",
|
134
|
+
[
|
135
|
+
0,
|
136
|
+
<<~EOS,
|
137
|
+
===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
|
138
|
+
stdout#{node_suffix}
|
139
|
+
0
|
140
|
+
EOS
|
141
|
+
<<~EOS
|
142
|
+
===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
|
143
|
+
stderr#{node_suffix}
|
144
|
+
EOS
|
145
|
+
]
|
146
|
+
]
|
147
|
+
end]
|
148
|
+
end])
|
149
|
+
# Run everything
|
150
|
+
test_tests_runner.tests = [:several_tests]
|
151
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
152
|
+
expect(HybridPlatformsConductorTest::TestPlugins::SeveralChecks.runs.sort).to eq [
|
153
|
+
[:several_tests, '', '', 'Global test'],
|
154
|
+
[:several_tests, 'platform1', '', 'Platform test'],
|
155
|
+
[:several_tests, 'platform2', '', 'Platform test'],
|
156
|
+
[:several_tests, 'node11', 'Node test'],
|
157
|
+
[:several_tests, 'node12', 'Node test'],
|
158
|
+
[:several_tests, 'node21', 'Node test'],
|
159
|
+
[:several_tests, 'node22', 'Node test'],
|
160
|
+
[:several_tests, 'node11', 'Node SSH test: stdout11 - stderr11'],
|
161
|
+
[:several_tests, 'node12', 'Node SSH test: stdout12 - stderr12'],
|
162
|
+
[:several_tests, 'node21', 'Node SSH test: stdout21 - stderr21'],
|
163
|
+
[:several_tests, 'node22', 'Node SSH test: stdout22 - stderr22'],
|
164
|
+
[:several_tests, 'node11', 'Node check-node test: node11 check ok'],
|
165
|
+
[:several_tests, 'node12', 'Node check-node test: node12 check ok'],
|
166
|
+
[:several_tests, 'node21', 'Node check-node test: node21 check ok'],
|
167
|
+
[:several_tests, 'node22', 'Node check-node test: node22 check ok']
|
168
|
+
].sort
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Specific test registered by the test platform handler
|
173
|
+
class SpecificPlatformHandlerTest < HybridPlatformsConductor::Test
|
174
|
+
|
175
|
+
class << self
|
176
|
+
attr_accessor :run
|
177
|
+
end
|
178
|
+
@run = false
|
179
|
+
|
180
|
+
def test
|
181
|
+
SpecificPlatformHandlerTest.run = true
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'executes tests defined by a platform handler' do
|
187
|
+
with_test_platform(tests: { specific_platform_handler_test: SpecificPlatformHandlerTest }) do
|
188
|
+
test_tests_runner.tests = [:specific_platform_handler_test]
|
189
|
+
expect(test_tests_runner.run_tests([])).to eq 0
|
190
|
+
expect(SpecificPlatformHandlerTest.run).to eq true
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
describe HybridPlatformsConductor::TestsRunner do
|
2
|
+
|
3
|
+
context 'checking global tests execution' do
|
4
|
+
|
5
|
+
# Prepare the test platform with test plugins
|
6
|
+
#
|
7
|
+
# Parameters::
|
8
|
+
# * *platforms_info* (Hash): The platofrms info [default: {}]
|
9
|
+
def with_test_platform_for_global_tests(platforms_info: {})
|
10
|
+
with_test_platform(platforms_info) do
|
11
|
+
register_test_plugins(test_tests_runner,
|
12
|
+
global_test: HybridPlatformsConductorTest::TestPlugins::Global,
|
13
|
+
global_test_2: HybridPlatformsConductorTest::TestPlugins::Global
|
14
|
+
)
|
15
|
+
yield
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'executes 1 global test only once even if there are several nodes' do
|
20
|
+
with_test_platform_for_global_tests(platforms_info: { nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} } }) do
|
21
|
+
test_tests_runner.tests = [:global_test]
|
22
|
+
expect(test_tests_runner.run_tests(%w[node1 node2 node3])).to eq 0
|
23
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Global.nbr_runs).to eq 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'executes several global tests' do
|
28
|
+
with_test_platform_for_global_tests do
|
29
|
+
test_tests_runner.tests = [:global_test, :global_test_2]
|
30
|
+
expect(test_tests_runner.run_tests([])).to eq 0
|
31
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Global.nbr_runs).to eq 2
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
describe HybridPlatformsConductor::TestsRunner do
|
2
|
+
|
3
|
+
context 'checking node tests on check-node results' do
|
4
|
+
|
5
|
+
# Prepare the test platform with test plugins
|
6
|
+
#
|
7
|
+
# Parameters::
|
8
|
+
# * Proc: Code called with the platform setup
|
9
|
+
def with_test_platform_for_node_check_tests
|
10
|
+
with_test_platforms(
|
11
|
+
'platform1' => { nodes: { 'node11' => {}, 'node12' => {} } },
|
12
|
+
'platform2' => { nodes: { 'node21' => {}, 'node22' => {} }, platform_type: :test2 }
|
13
|
+
) do
|
14
|
+
register_test_plugins(test_tests_runner,
|
15
|
+
node_check_test: HybridPlatformsConductorTest::TestPlugins::NodeCheck,
|
16
|
+
node_check_test_2: HybridPlatformsConductorTest::TestPlugins::NodeCheck
|
17
|
+
)
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'executes check node tests once per node' do
|
23
|
+
with_test_platform_for_node_check_tests do
|
24
|
+
test_tests_runner.tests = [:node_check_test]
|
25
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
|
26
|
+
expect(test_deployer.use_why_run).to eq true
|
27
|
+
{
|
28
|
+
'node11' => [0, 'node11 check ok', 'node11 stderr'],
|
29
|
+
'node12' => [0, 'node12 check ok', 'node12 stderr'],
|
30
|
+
'node21' => [0, 'node21 check ok', 'node21 stderr'],
|
31
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
32
|
+
}
|
33
|
+
end
|
34
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
35
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
36
|
+
[:node_check_test, 'node11', 'node11 check ok', 'node11 stderr', 0],
|
37
|
+
[:node_check_test, 'node12', 'node12 check ok', 'node12 stderr', 0],
|
38
|
+
[:node_check_test, 'node21', 'node21 check ok', 'node21 stderr', 0],
|
39
|
+
[:node_check_test, 'node22', 'node22 check ok', 'node22 stderr', 0]
|
40
|
+
].sort
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'executes check node tests only on specified nodes' do
|
45
|
+
with_test_platform_for_node_check_tests do
|
46
|
+
test_tests_runner.tests = [:node_check_test]
|
47
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node12 node22]).once do
|
48
|
+
expect(test_deployer.use_why_run).to eq true
|
49
|
+
{
|
50
|
+
'node12' => [0, 'node12 check ok', 'node12 stderr'],
|
51
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
52
|
+
}
|
53
|
+
end
|
54
|
+
expect(test_tests_runner.run_tests(%w[node12 node22])).to eq 0
|
55
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
56
|
+
[:node_check_test, 'node12', 'node12 check ok', 'node12 stderr', 0],
|
57
|
+
[:node_check_test, 'node22', 'node22 check ok', 'node22 stderr', 0]
|
58
|
+
].sort
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'executes check node tests once per node even if there are several tests using check reports' do
|
63
|
+
with_test_platform_for_node_check_tests do
|
64
|
+
test_tests_runner.tests = [:node_check_test, :node_check_test_2]
|
65
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
|
66
|
+
expect(test_deployer.use_why_run).to eq true
|
67
|
+
{
|
68
|
+
'node11' => [0, 'node11 check ok', 'node11 stderr'],
|
69
|
+
'node12' => [0, 'node12 check ok', 'node12 stderr'],
|
70
|
+
'node21' => [0, 'node21 check ok', 'node21 stderr'],
|
71
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
72
|
+
}
|
73
|
+
end
|
74
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
75
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
76
|
+
[:node_check_test, 'node11', 'node11 check ok', 'node11 stderr', 0],
|
77
|
+
[:node_check_test, 'node12', 'node12 check ok', 'node12 stderr', 0],
|
78
|
+
[:node_check_test, 'node21', 'node21 check ok', 'node21 stderr', 0],
|
79
|
+
[:node_check_test, 'node22', 'node22 check ok', 'node22 stderr', 0],
|
80
|
+
[:node_check_test_2, 'node11', 'node11 check ok', 'node11 stderr', 0],
|
81
|
+
[:node_check_test_2, 'node12', 'node12 check ok', 'node12 stderr', 0],
|
82
|
+
[:node_check_test_2, 'node21', 'node21 check ok', 'node21 stderr', 0],
|
83
|
+
[:node_check_test_2, 'node22', 'node22 check ok', 'node22 stderr', 0]
|
84
|
+
].sort
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'fails when a check node tests returns an error for a node' do
|
89
|
+
with_test_platform_for_node_check_tests do
|
90
|
+
test_tests_runner.tests = [:node_check_test]
|
91
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
|
92
|
+
expect(test_deployer.use_why_run).to eq true
|
93
|
+
{
|
94
|
+
'node11' => [0, 'node11 check ok', 'node11 stderr'],
|
95
|
+
'node12' => [1, 'node12 check ok', 'node12 stderr'],
|
96
|
+
'node21' => [0, 'node21 check ok', 'node21 stderr'],
|
97
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
98
|
+
}
|
99
|
+
end
|
100
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 1
|
101
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
102
|
+
[:node_check_test, 'node11', 'node11 check ok', 'node11 stderr', 0],
|
103
|
+
[:node_check_test, 'node12', 'node12 check ok', 'node12 stderr', 1],
|
104
|
+
[:node_check_test, 'node21', 'node21 check ok', 'node21 stderr', 0],
|
105
|
+
[:node_check_test, 'node22', 'node22 check ok', 'node22 stderr', 0]
|
106
|
+
].sort
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'fails when a check node tests raises an error' do
|
111
|
+
with_test_platform_for_node_check_tests do
|
112
|
+
test_tests_runner.tests = [:node_check_test]
|
113
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
|
114
|
+
expect(test_deployer.use_why_run).to eq true
|
115
|
+
{
|
116
|
+
'node11' => [0, 'node11 check ok', 'node11 stderr'],
|
117
|
+
'node12' => [1, 'node12 check ok', 'node12 stderr'],
|
118
|
+
'node21' => [0, 'node21 check ok', 'node21 stderr'],
|
119
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
120
|
+
}
|
121
|
+
end
|
122
|
+
HybridPlatformsConductorTest::TestPlugins::NodeCheck.fail_for = ['node12']
|
123
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 1
|
124
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
125
|
+
[:node_check_test, 'node11', 'node11 check ok', 'node11 stderr', 0],
|
126
|
+
[:node_check_test, 'node21', 'node21 check ok', 'node21 stderr', 0],
|
127
|
+
[:node_check_test, 'node22', 'node22 check ok', 'node22 stderr', 0]
|
128
|
+
].sort
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'reuses run_logs logs instead of running check-node when we ask for it' do
|
133
|
+
with_test_platform_for_node_check_tests do
|
134
|
+
run_logs_dir = "#{ENV['hpc_platforms']}/run_logs"
|
135
|
+
FileUtils.mkdir_p run_logs_dir
|
136
|
+
File.write("#{run_logs_dir}/node11.stdout", 'node11 check ok from logs')
|
137
|
+
File.write("#{run_logs_dir}/node12.stdout", 'node12 check ok from logs')
|
138
|
+
File.write("#{run_logs_dir}/node21.stdout", 'node21 check ok from logs')
|
139
|
+
File.write("#{run_logs_dir}/node22.stdout", 'node22 check ok from logs')
|
140
|
+
test_tests_runner.tests = [:node_check_test]
|
141
|
+
expect(test_deployer).not_to receive(:deploy_on)
|
142
|
+
test_tests_runner.skip_run = true
|
143
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
144
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
145
|
+
[:node_check_test, 'node11', 'node11 check ok from logs', '', 0],
|
146
|
+
[:node_check_test, 'node12', 'node12 check ok from logs', '', 0],
|
147
|
+
[:node_check_test, 'node21', 'node21 check ok from logs', '', 0],
|
148
|
+
[:node_check_test, 'node22', 'node22 check ok from logs', '', 0]
|
149
|
+
].sort
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'fails when some run_logs are missing' do
|
154
|
+
with_test_platform_for_node_check_tests do
|
155
|
+
run_logs_dir = "#{ENV['hpc_platforms']}/run_logs"
|
156
|
+
FileUtils.mkdir_p run_logs_dir
|
157
|
+
File.write("#{run_logs_dir}/node11.stdout", 'node11 check ok from logs')
|
158
|
+
File.write("#{run_logs_dir}/node12.stdout", 'node12 check ok from logs')
|
159
|
+
FileUtils.rm_f "#{run_logs_dir}/node21.stdout"
|
160
|
+
File.write("#{run_logs_dir}/node22.stdout", 'node22 check ok from logs')
|
161
|
+
test_tests_runner.tests = [:node_check_test]
|
162
|
+
expect(test_deployer).not_to receive(:deploy_on)
|
163
|
+
test_tests_runner.skip_run = true
|
164
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 1
|
165
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
166
|
+
[:node_check_test, 'node11', 'node11 check ok from logs', '', 0],
|
167
|
+
[:node_check_test, 'node12', 'node12 check ok from logs', '', 0],
|
168
|
+
[:node_check_test, 'node22', 'node22 check ok from logs', '', 0]
|
169
|
+
].sort
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'executes check node tests only on valid nodes' do
|
174
|
+
with_test_platform_for_node_check_tests do
|
175
|
+
HybridPlatformsConductorTest::TestPlugins::NodeCheck.only_on_nodes = %w[node12 node22]
|
176
|
+
test_tests_runner.tests = [:node_check_test]
|
177
|
+
expect(test_deployer).to receive(:deploy_on).with(%w[node12 node22]).once do
|
178
|
+
expect(test_deployer.use_why_run).to eq true
|
179
|
+
{
|
180
|
+
'node12' => [0, 'node12 check ok', 'node12 stderr'],
|
181
|
+
'node22' => [0, 'node22 check ok', 'node22 stderr']
|
182
|
+
}
|
183
|
+
end
|
184
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
185
|
+
expect(HybridPlatformsConductorTest::TestPlugins::NodeCheck.runs.sort).to eq [
|
186
|
+
[:node_check_test, 'node12', 'node12 check ok', 'node12 stderr', 0],
|
187
|
+
[:node_check_test, 'node22', 'node22 check ok', 'node22 stderr', 0]
|
188
|
+
].sort
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
describe HybridPlatformsConductor::TestsRunner do
|
2
|
+
|
3
|
+
context 'checking node tests execution' do
|
4
|
+
|
5
|
+
# Prepare the test platform with test plugins
|
6
|
+
#
|
7
|
+
# Parameters::
|
8
|
+
# * Proc: Code called with the platform setup
|
9
|
+
def with_test_platform_for_node_tests
|
10
|
+
with_test_platforms(
|
11
|
+
'platform1' => { nodes: { 'node11' => {}, 'node12' => {}, 'node13' => {} } },
|
12
|
+
'platform2' => { nodes: { 'node21' => {}, 'node22' => {}, 'node23' => {} }, platform_type: :test2 }
|
13
|
+
) do
|
14
|
+
register_test_plugins(test_tests_runner,
|
15
|
+
node_test: HybridPlatformsConductorTest::TestPlugins::Node,
|
16
|
+
node_test_2: HybridPlatformsConductorTest::TestPlugins::Node
|
17
|
+
)
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'executes node tests once per node' do
|
23
|
+
with_test_platform_for_node_tests do
|
24
|
+
test_tests_runner.tests = [:node_test]
|
25
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
26
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs.sort).to eq [
|
27
|
+
[:node_test, 'node11'],
|
28
|
+
[:node_test, 'node12'],
|
29
|
+
[:node_test, 'node13'],
|
30
|
+
[:node_test, 'node21'],
|
31
|
+
[:node_test, 'node22'],
|
32
|
+
[:node_test, 'node23']
|
33
|
+
].sort
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'executes node tests only on selected nodes' do
|
38
|
+
with_test_platform_for_node_tests do
|
39
|
+
test_tests_runner.tests = [:node_test]
|
40
|
+
expect(test_tests_runner.run_tests(%w[node12 node22])).to eq 0
|
41
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs.sort).to eq [
|
42
|
+
[:node_test, 'node12'],
|
43
|
+
[:node_test, 'node22']
|
44
|
+
].sort
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'executes several node tests' do
|
49
|
+
with_test_platform_for_node_tests do
|
50
|
+
test_tests_runner.tests = [:node_test, :node_test_2]
|
51
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
52
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs.sort).to eq [
|
53
|
+
[:node_test, 'node11'],
|
54
|
+
[:node_test, 'node12'],
|
55
|
+
[:node_test, 'node13'],
|
56
|
+
[:node_test, 'node21'],
|
57
|
+
[:node_test, 'node22'],
|
58
|
+
[:node_test, 'node23'],
|
59
|
+
[:node_test_2, 'node11'],
|
60
|
+
[:node_test_2, 'node12'],
|
61
|
+
[:node_test_2, 'node13'],
|
62
|
+
[:node_test_2, 'node21'],
|
63
|
+
[:node_test_2, 'node22'],
|
64
|
+
[:node_test_2, 'node23']
|
65
|
+
].sort
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'executes node tests only on valid nodes' do
|
70
|
+
with_test_platform_for_node_tests do
|
71
|
+
test_tests_runner.tests = [:node_test]
|
72
|
+
HybridPlatformsConductorTest::TestPlugins::Node.only_on_nodes = %w[node12 node22]
|
73
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
74
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs.sort).to eq [
|
75
|
+
[:node_test, 'node12'],
|
76
|
+
[:node_test, 'node22']
|
77
|
+
].sort
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'executes node tests in parallel' do
|
82
|
+
with_test_platform_for_node_tests do
|
83
|
+
test_tests_runner.tests = [:node_test]
|
84
|
+
test_tests_runner.max_threads_nodes = 6
|
85
|
+
HybridPlatformsConductorTest::TestPlugins::Node.sleeps = { node_test: {
|
86
|
+
'node11' => 3.0,
|
87
|
+
'node12' => 0.5,
|
88
|
+
'node13' => 1.5,
|
89
|
+
'node21' => 2.0,
|
90
|
+
'node22' => 1.0,
|
91
|
+
'node23' => 2.5
|
92
|
+
} }
|
93
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
94
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs).to eq [
|
95
|
+
[:node_test, 'node12'],
|
96
|
+
[:node_test, 'node22'],
|
97
|
+
[:node_test, 'node13'],
|
98
|
+
[:node_test, 'node21'],
|
99
|
+
[:node_test, 'node23'],
|
100
|
+
[:node_test, 'node11']
|
101
|
+
]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'executes node tests not in parallel with a limiting number of threads' do
|
106
|
+
with_test_platform_for_node_tests do
|
107
|
+
test_tests_runner.tests = [:node_test]
|
108
|
+
test_tests_runner.max_threads_nodes = 3
|
109
|
+
HybridPlatformsConductorTest::TestPlugins::Node.sleeps = { node_test: {
|
110
|
+
'node11' => 1.4,
|
111
|
+
'node12' => 0.2,
|
112
|
+
'node13' => 0.6,
|
113
|
+
'node21' => 0.8,
|
114
|
+
'node22' => 0.6,
|
115
|
+
'node23' => 1
|
116
|
+
} }
|
117
|
+
# Here is the sequence:
|
118
|
+
# Thread 1: +-node11 1.4--------------------------------------------+
|
119
|
+
# Thread 2: +-node12 0.2-+-node21 0.8--------------+-node23 1.0-----|---+
|
120
|
+
# Thread 3: +-node13 0.6-|------------+-node22 0.6-|------------+ | |
|
121
|
+
# | | | | | | |
|
122
|
+
# Time : 0 0.2 0.6 1.0 1.2 1.4 2.0
|
123
|
+
expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
|
124
|
+
expect(HybridPlatformsConductorTest::TestPlugins::Node.runs).to eq [
|
125
|
+
[:node_test, 'node12'],
|
126
|
+
[:node_test, 'node13'],
|
127
|
+
[:node_test, 'node21'],
|
128
|
+
[:node_test, 'node22'],
|
129
|
+
[:node_test, 'node11'],
|
130
|
+
[:node_test, 'node23']
|
131
|
+
]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|