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,101 @@
|
|
1
|
+
describe HybridPlatformsConductor::ActionsExecutor do
|
2
|
+
|
3
|
+
context 'checking timeouts' do
|
4
|
+
|
5
|
+
# Get a test platform to test timeouts
|
6
|
+
#
|
7
|
+
# Parameters::
|
8
|
+
# * Proc: Code called with platform setup
|
9
|
+
def with_test_platform_for_timeouts_tests
|
10
|
+
with_test_platform_for_executor(nodes: { 'node' => {} }) do
|
11
|
+
yield
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'executes an action without timeout' do
|
16
|
+
with_test_platform_for_timeouts_tests do
|
17
|
+
expect(test_actions_executor.execute_actions(
|
18
|
+
'node' => { test_action: { code: proc do |stdout, _stderr, action|
|
19
|
+
expect(action.timeout).to eq nil
|
20
|
+
stdout << 'Hello'
|
21
|
+
end } }
|
22
|
+
)['node']).to eq [0, 'Hello', '']
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'executes an action with timeout' do
|
27
|
+
with_test_platform_for_timeouts_tests do
|
28
|
+
expect(test_actions_executor.execute_actions(
|
29
|
+
{ 'node' => { test_action: { code: proc do |stdout, _stderr, action|
|
30
|
+
expect(action.timeout).to eq 1
|
31
|
+
stdout << 'Hello'
|
32
|
+
end } } },
|
33
|
+
timeout: 1
|
34
|
+
)['node']).to eq [0, 'Hello', '']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'executes an action that fails because of timeout' do
|
39
|
+
with_test_platform_for_timeouts_tests do
|
40
|
+
expect(test_actions_executor.execute_actions(
|
41
|
+
{ 'node' => { test_action: { code: proc do |_stdout, _stderr, action|
|
42
|
+
raise HybridPlatformsConductor::CmdRunner::TimeoutError
|
43
|
+
end } } },
|
44
|
+
timeout: 1
|
45
|
+
)['node']).to eq [:timeout, '', '']
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'executes an action that fails because of timeout and outputs data before' do
|
50
|
+
with_test_platform_for_timeouts_tests do
|
51
|
+
expect(test_actions_executor.execute_actions(
|
52
|
+
{ 'node' => { test_action: { code: proc do |stdout, _stderr, action|
|
53
|
+
stdout << 'Hello'
|
54
|
+
raise HybridPlatformsConductor::CmdRunner::TimeoutError
|
55
|
+
end } } },
|
56
|
+
timeout: 1
|
57
|
+
)['node']).to eq [:timeout, 'Hello', '']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'executes several actions with latter ones failing because of timeout' do
|
62
|
+
with_test_platform_for_timeouts_tests do
|
63
|
+
expect(test_actions_executor.execute_actions(
|
64
|
+
{ 'node' => [
|
65
|
+
{ test_action: { code: proc do |stdout|
|
66
|
+
sleep 1
|
67
|
+
stdout << 'Hello'
|
68
|
+
end } },
|
69
|
+
{ test_action: { code: proc do |stdout, _stderr, action|
|
70
|
+
raise HybridPlatformsConductor::CmdRunner::TimeoutError
|
71
|
+
end } }
|
72
|
+
] },
|
73
|
+
timeout: 5
|
74
|
+
)['node']).to eq [:timeout, 'Hello', '']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'executes several actions with a decreasing timeout' do
|
79
|
+
with_test_platform_for_timeouts_tests do
|
80
|
+
expect(test_actions_executor.execute_actions(
|
81
|
+
{ 'node' => [
|
82
|
+
{ test_action: { code: proc do |stdout, _stderr, action|
|
83
|
+
expect(action.timeout).to eq 5
|
84
|
+
sleep 1
|
85
|
+
end } },
|
86
|
+
{ test_action: { code: proc do |stdout, _stderr, action|
|
87
|
+
expect(action.timeout).to be_between(3.8, 4)
|
88
|
+
sleep 1
|
89
|
+
end } },
|
90
|
+
{ test_action: { code: proc do |stdout, _stderr, action|
|
91
|
+
expect(action.timeout).to be_between(2.8, 3)
|
92
|
+
end } }
|
93
|
+
] },
|
94
|
+
timeout: 5
|
95
|
+
)['node']).to eq [0, '', '']
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
describe HybridPlatformsConductor::CmdRunner do
|
2
|
+
|
3
|
+
it 'runs a simple bash command' do
|
4
|
+
with_repository do |repository|
|
5
|
+
test_cmd_runner.run_cmd "echo TestContent >#{repository}/test_file"
|
6
|
+
expect(File.read("#{repository}/test_file")).to eq "TestContent\n"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'runs a simple bash command and returns exit code, stdout and stderr correctly' do
|
11
|
+
with_repository do |repository|
|
12
|
+
expect(test_cmd_runner.run_cmd "echo TestStderr 1>&2 ; echo TestStdout").to eq [0, "TestStdout\n", "TestStderr\n"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'runs a simple bash command and logs stdout and stderr to a file' do
|
17
|
+
with_repository do |repository|
|
18
|
+
test_cmd_runner.run_cmd "echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout", log_to_file: "#{repository}/test_file"
|
19
|
+
expect(File.read("#{repository}/test_file")).to eq "TestStderr\nTestStdout\n"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'runs a simple bash command and logs stdout and stderr to an existing file' do
|
24
|
+
with_repository do |repository|
|
25
|
+
File.write("#{repository}/test_file", "Before\n")
|
26
|
+
test_cmd_runner.run_cmd "echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout", log_to_file: "#{repository}/test_file"
|
27
|
+
expect(File.read("#{repository}/test_file")).to eq "Before\nTestStderr\nTestStdout\n"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'runs a simple bash command and logs stdout and stderr to IO objects' do
|
32
|
+
with_repository do |repository|
|
33
|
+
stdout = ''
|
34
|
+
stderr = ''
|
35
|
+
test_cmd_runner.run_cmd "echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout", log_stdout_to_io: stdout, log_stderr_to_io: stderr
|
36
|
+
expect(stdout).to eq "TestStdout\n"
|
37
|
+
expect(stderr).to eq "TestStderr\n"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'fails when the command does not exit 0' do
|
42
|
+
with_repository do |repository|
|
43
|
+
expect { test_cmd_runner.run_cmd 'exit 1' }.to raise_error(HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command \'exit 1\' returned error code 1 (expected 0).')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'fails when the command does not exit with the expected code' do
|
48
|
+
with_repository do |repository|
|
49
|
+
expect { test_cmd_runner.run_cmd 'exit 1', expected_code: 2 }.to raise_error(HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command \'exit 1\' returned error code 1 (expected 2).')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'fails when the command does not exit with one of the expected codes' do
|
54
|
+
with_repository do |repository|
|
55
|
+
expect { test_cmd_runner.run_cmd 'exit 1', expected_code: [0, 2, 3] }.to raise_error(HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command \'exit 1\' returned error code 1 (expected 0, 2, 3).')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'does not fail when the command exits with the expected code' do
|
60
|
+
with_repository do |repository|
|
61
|
+
expect(test_cmd_runner.run_cmd 'exit 2', expected_code: 2).to eq [2, '', '']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'does not fail when the command exits with one of the expected codes' do
|
66
|
+
with_repository do |repository|
|
67
|
+
expect(test_cmd_runner.run_cmd 'exit 2', expected_code: [0, 2, 3]).to eq [2, '', '']
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'does not fail when the command does not exit 0 and we specify no exception' do
|
72
|
+
with_repository do |repository|
|
73
|
+
expect(test_cmd_runner.run_cmd 'exit 1', no_exception: true).to eq [1, '', '']
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'does not fail when the command can\'t be run and we specify no exception' do
|
78
|
+
with_repository do |repository|
|
79
|
+
exit_status, stdout, stderr = test_cmd_runner.run_cmd 'unknown_command', no_exception: true
|
80
|
+
expect(exit_status).to eq :command_error
|
81
|
+
expect(stdout).to eq ''
|
82
|
+
expect(stderr).to match /^No such file or directory - unknown_command.*/
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'does not fail when the command is expected to not be run' do
|
87
|
+
with_repository do |repository|
|
88
|
+
exit_status, stdout, stderr = test_cmd_runner.run_cmd 'unknown_command', expected_code: :command_error
|
89
|
+
expect(exit_status).to eq :command_error
|
90
|
+
expect(stdout).to eq ''
|
91
|
+
expect(stderr).to match /^No such file or directory - unknown_command.*/
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'fails when the command times out' do
|
96
|
+
with_repository do |repository|
|
97
|
+
expect { test_cmd_runner.run_cmd 'sleep 5', timeout: 1 }.to raise_error(HybridPlatformsConductor::CmdRunner::TimeoutError, 'Command \'sleep 5\' returned error code timeout (expected 0).')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'returns the timeout error when the command times out and we specify no exception' do
|
102
|
+
with_repository do |repository|
|
103
|
+
expect(test_cmd_runner.run_cmd 'sleep 5', timeout: 1, no_exception: true).to eq [:timeout, '', 'Timeout of 1 triggered']
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'returns the timeout error when the command is expected to time out' do
|
108
|
+
with_repository do |repository|
|
109
|
+
expect(test_cmd_runner.run_cmd 'sleep 5', timeout: 1, expected_code: :timeout).to eq [:timeout, '', 'Timeout of 1 triggered']
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'returns the timeout error with previously output stdout and stderr when the command times out and we specify no exception' do
|
114
|
+
with_repository do |repository|
|
115
|
+
expect(test_cmd_runner.run_cmd 'echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout ; sleep 5 ; echo NeverDisplayed', timeout: 2, no_exception: true).to eq [:timeout, "TestStdout\n", "TestStderr\n\nTimeout of 2 triggered"]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'returns the timeout error with previously output stdout and stderr when the command times out as expected' do
|
120
|
+
with_repository do |repository|
|
121
|
+
expect(test_cmd_runner.run_cmd 'echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout ; sleep 5 ; echo NeverDisplayed', timeout: 2, expected_code: :timeout).to eq [:timeout, "TestStdout\n", "TestStderr\n\nTimeout of 2 triggered"]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'displays commands instead of unning them with dry-run' do
|
126
|
+
with_repository do |repository|
|
127
|
+
cmd_runner = test_cmd_runner
|
128
|
+
cmd_runner.dry_run = true
|
129
|
+
expect(cmd_runner.run_cmd "echo TestContent >#{repository}/test_file").to eq [0, '', '']
|
130
|
+
expect(File.exist?("#{repository}/test_file")).to eq false
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'displays commands instead of unning them with dry-run and returns the expected code' do
|
135
|
+
with_repository do |repository|
|
136
|
+
cmd_runner = test_cmd_runner
|
137
|
+
cmd_runner.dry_run = true
|
138
|
+
expect(cmd_runner.run_cmd "echo TestContent >#{repository}/test_file", expected_code: 2).to eq [2, '', '']
|
139
|
+
expect(File.exist?("#{repository}/test_file")).to eq false
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'returns the currently logged user' do
|
144
|
+
cmd_runner = test_cmd_runner
|
145
|
+
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false) { [0, 'test_user', ''] }
|
146
|
+
expect(cmd_runner.whoami).to eq 'test_user'
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'returns non-root user when user is not root' do
|
150
|
+
cmd_runner = test_cmd_runner
|
151
|
+
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false) { [0, 'not_root', ''] }
|
152
|
+
expect(cmd_runner.root?).to eq false
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'returns root user when user is root' do
|
156
|
+
cmd_runner = test_cmd_runner
|
157
|
+
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false) { [0, 'root', ''] }
|
158
|
+
expect(cmd_runner.root?).to eq true
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'returns the correct executable prefix' do
|
162
|
+
expect(HybridPlatformsConductor::CmdRunner.executables_prefix).to eq "#{File.dirname($0)}/"
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
@@ -0,0 +1,238 @@
|
|
1
|
+
describe HybridPlatformsConductor::Config do
|
2
|
+
|
3
|
+
it 'returns the hybrid-platforms dir correctly' do
|
4
|
+
with_platforms '' do |hybrid_platforms_dir|
|
5
|
+
expect(test_config.hybrid_platforms_dir).to eq hybrid_platforms_dir
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'returns 1 defined OS image' do
|
10
|
+
with_platforms 'os_image :image1, \'/path/to/image1\'' do
|
11
|
+
expect(test_config.known_os_images).to eq [:image1]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns 1 defined OS image with its directory' do
|
16
|
+
with_platforms 'os_image :image1, \'/path/to/image1\'' do
|
17
|
+
expect(test_config.os_image_dir(:image1)).to eq '/path/to/image1'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns several defined OS images' do
|
22
|
+
with_platforms '
|
23
|
+
os_image :image1, \'/path/to/image1\'
|
24
|
+
os_image :image2, \'/path/to/image2\'
|
25
|
+
' do
|
26
|
+
expect(test_config.known_os_images.sort).to eq %i[image1 image2].sort
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns the tests provisioner correctly' do
|
31
|
+
with_platforms 'tests_provisioner :test_provisioner' do
|
32
|
+
expect(test_config.tests_provisioner_id).to eq :test_provisioner
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'accesses the platform handler repositories if needed from the config' do
|
37
|
+
with_repository do |repository|
|
38
|
+
with_platforms "
|
39
|
+
test_platform path: '#{repository}' do |repository_path|
|
40
|
+
os_image :image1, \"\#{repository_path}/image_path\"
|
41
|
+
end
|
42
|
+
" do
|
43
|
+
expect(test_config.known_os_images.sort).to eq %i[image1].sort
|
44
|
+
expect(test_config.os_image_dir(:image1)).to eq "#{repository}/image_path"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'includes several configuration files' do
|
50
|
+
with_platforms '
|
51
|
+
os_image :image1, \'/path/to/image1\'
|
52
|
+
include_config_from "#{__dir__}/my_conf_1.rb"
|
53
|
+
include_config_from "#{__dir__}/my_conf_2.rb"
|
54
|
+
' do |hybrid_platforms_dir|
|
55
|
+
File.write("#{hybrid_platforms_dir}/my_conf_1.rb", <<~EOS)
|
56
|
+
os_image :image4, '/path/to/image4'
|
57
|
+
include_config_from "\#{__dir__}/my_conf_3.rb"
|
58
|
+
EOS
|
59
|
+
File.write("#{hybrid_platforms_dir}/my_conf_2.rb", 'os_image :image2, \'/path/to/image2\'')
|
60
|
+
File.write("#{hybrid_platforms_dir}/my_conf_3.rb", 'os_image :image3, \'/path/to/image3\'')
|
61
|
+
expect(test_config.known_os_images.sort).to eq %i[image1 image2 image3 image4].sort
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'applies nodes specific configuration to all nodes by default' do
|
66
|
+
with_platforms '
|
67
|
+
expect_tests_to_fail :my_test, \'Failure reason\'
|
68
|
+
' do
|
69
|
+
expect(test_config.expected_failures).to eq [
|
70
|
+
{
|
71
|
+
nodes_selectors_stack: [],
|
72
|
+
reason: 'Failure reason',
|
73
|
+
tests: [:my_test]
|
74
|
+
}
|
75
|
+
]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'filters nodes specific configuration to nodes sets in a scope' do
|
80
|
+
with_platforms '
|
81
|
+
for_nodes(%w[node1 node2 node3]) do
|
82
|
+
expect_tests_to_fail :my_test_1, \'Failure reason 1\'
|
83
|
+
end
|
84
|
+
expect_tests_to_fail :my_test_2, \'Failure reason 2\'
|
85
|
+
' do
|
86
|
+
sort_proc = proc { |expected_failure_info| expected_failure_info[:reason] }
|
87
|
+
expect(test_config.expected_failures.sort_by(&sort_proc)).to eq [
|
88
|
+
{
|
89
|
+
nodes_selectors_stack: [%w[node1 node2 node3]],
|
90
|
+
reason: 'Failure reason 1',
|
91
|
+
tests: [:my_test_1]
|
92
|
+
},
|
93
|
+
{
|
94
|
+
nodes_selectors_stack: [],
|
95
|
+
reason: 'Failure reason 2',
|
96
|
+
tests: [:my_test_2]
|
97
|
+
}
|
98
|
+
].sort_by(&sort_proc)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'filters nodes specific configuration in a scoped stack' do
|
103
|
+
with_platforms '
|
104
|
+
for_nodes(%w[node1 node2 node3]) do
|
105
|
+
expect_tests_to_fail :my_test_1, \'Failure reason 1\'
|
106
|
+
for_nodes(%w[node2 node3 node4]) do
|
107
|
+
expect_tests_to_fail :my_test_2, \'Failure reason 2\'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
' do
|
111
|
+
sort_proc = proc { |expected_failure_info| expected_failure_info[:reason] }
|
112
|
+
expect(test_config.expected_failures.sort_by(&sort_proc)).to eq [
|
113
|
+
{
|
114
|
+
nodes_selectors_stack: [%w[node1 node2 node3]],
|
115
|
+
reason: 'Failure reason 1',
|
116
|
+
tests: [:my_test_1]
|
117
|
+
},
|
118
|
+
{
|
119
|
+
nodes_selectors_stack: [%w[node1 node2 node3], %w[node2 node3 node4]],
|
120
|
+
reason: 'Failure reason 2',
|
121
|
+
tests: [:my_test_2]
|
122
|
+
}
|
123
|
+
].sort_by(&sort_proc)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'returns the expected failures correctly' do
|
128
|
+
with_platforms '
|
129
|
+
expect_tests_to_fail :my_test_1, \'Failure reason 1\'
|
130
|
+
expect_tests_to_fail %i[my_test_2 my_test_3], \'Failure reason 23\'
|
131
|
+
for_nodes(%w[node1 node2 node3]) do
|
132
|
+
expect_tests_to_fail :my_test_4, \'Failure reason 4\'
|
133
|
+
end
|
134
|
+
' do
|
135
|
+
sort_proc = proc { |expected_failure_info| expected_failure_info[:reason] }
|
136
|
+
expect(test_config.expected_failures.sort_by(&sort_proc)).to eq [
|
137
|
+
{
|
138
|
+
nodes_selectors_stack: [],
|
139
|
+
reason: 'Failure reason 1',
|
140
|
+
tests: [:my_test_1]
|
141
|
+
},
|
142
|
+
{
|
143
|
+
nodes_selectors_stack: [],
|
144
|
+
reason: 'Failure reason 23',
|
145
|
+
tests: %i[my_test_2 my_test_3]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
nodes_selectors_stack: [%w[node1 node2 node3]],
|
149
|
+
reason: 'Failure reason 4',
|
150
|
+
tests: [:my_test_4]
|
151
|
+
}
|
152
|
+
].sort_by(&sort_proc)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'returns the retriable errors correctly' do
|
157
|
+
with_platforms '
|
158
|
+
retry_deploy_for_errors_on_stdout \'Retry stdout global\'
|
159
|
+
retry_deploy_for_errors_on_stderr [
|
160
|
+
\'Retry stderr global\',
|
161
|
+
/.+Retry stderr regexp global/
|
162
|
+
]
|
163
|
+
for_nodes(%w[node1 node2 node3]) do
|
164
|
+
retry_deploy_for_errors_on_stdout \'Retry stdout nodes\'
|
165
|
+
retry_deploy_for_errors_on_stderr \'Retry stderr nodes\'
|
166
|
+
end
|
167
|
+
' do
|
168
|
+
sort_proc = proc { |retriable_error_info| ((retriable_error_info[:errors_on_stdout] || []) + (retriable_error_info[:errors_on_stderr] || [])).first.to_s }
|
169
|
+
expect(test_config.retriable_errors.sort_by(&sort_proc)).to eq [
|
170
|
+
{
|
171
|
+
nodes_selectors_stack: [],
|
172
|
+
errors_on_stdout: ['Retry stdout global']
|
173
|
+
},
|
174
|
+
{
|
175
|
+
nodes_selectors_stack: [],
|
176
|
+
errors_on_stderr: ['Retry stderr global', /.+Retry stderr regexp global/]
|
177
|
+
},
|
178
|
+
{
|
179
|
+
nodes_selectors_stack: [%w[node1 node2 node3]],
|
180
|
+
errors_on_stdout: ['Retry stdout nodes']
|
181
|
+
},
|
182
|
+
{
|
183
|
+
nodes_selectors_stack: [%w[node1 node2 node3]],
|
184
|
+
errors_on_stderr: ['Retry stderr nodes']
|
185
|
+
}
|
186
|
+
].sort_by(&sort_proc)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'returns the deployment schedules correctly' do
|
191
|
+
with_platforms '
|
192
|
+
deployment_schedule(IceCube::Schedule.new(Time.parse(\'2020-05-01 11:22:33 UTC\')))
|
193
|
+
for_nodes(%w[node1 node2 node3]) do
|
194
|
+
deployment_schedule(IceCube::Schedule.new(Time.parse(\'2020-05-02 22:33:44 UTC\')))
|
195
|
+
end
|
196
|
+
' do
|
197
|
+
sort_proc = proc { |deployment_schedule_info| deployment_schedule_info[:schedule].to_ical }
|
198
|
+
expect(test_config.deployment_schedules.sort_by(&sort_proc)).to eq [
|
199
|
+
{
|
200
|
+
nodes_selectors_stack: [],
|
201
|
+
schedule: IceCube::Schedule.new(Time.parse('2020-05-01 11:22:33 UTC'))
|
202
|
+
},
|
203
|
+
{
|
204
|
+
nodes_selectors_stack: [%w[node1 node2 node3]],
|
205
|
+
schedule: IceCube::Schedule.new(Time.parse('2020-05-02 22:33:44 UTC'))
|
206
|
+
}
|
207
|
+
].sort_by(&sort_proc)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'returns the deployment schedules correctly using the daily helper' do
|
212
|
+
with_platforms 'deployment_schedule(daily_at(\'11:22:33\'))' do
|
213
|
+
schedule = test_config.deployment_schedules.first[:schedule]
|
214
|
+
expect(Time.parse("#{schedule.start_time.strftime('%F')} 00:00:00")).to be <= Time.now
|
215
|
+
expect(schedule.start_time.strftime('%T')).to eq '11:22:33'
|
216
|
+
expect(schedule.recurrence_rules.first.to_hash).to eq(
|
217
|
+
validations: {},
|
218
|
+
rule_type: 'IceCube::DailyRule',
|
219
|
+
interval: 1
|
220
|
+
)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'returns the deployment schedules correctly using the weekly helper' do
|
225
|
+
with_platforms 'deployment_schedule(weekly_at(:monday, \'11:22:33\'))' do
|
226
|
+
schedule = test_config.deployment_schedules.first[:schedule]
|
227
|
+
expect(Time.parse("#{schedule.start_time.strftime('%F')} 00:00:00")).to be <= Time.now
|
228
|
+
expect(schedule.start_time.strftime('%T')).to eq '11:22:33'
|
229
|
+
expect(schedule.recurrence_rules.first.to_hash).to eq(
|
230
|
+
validations: { day: [1] },
|
231
|
+
week_start: 0,
|
232
|
+
rule_type: 'IceCube::WeeklyRule',
|
233
|
+
interval: 1
|
234
|
+
)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|