hybrid_platforms_conductor 32.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,35 @@
|
|
|
1
|
+
describe 'ssh_config executable' do
|
|
2
|
+
|
|
3
|
+
# Setup a platform for ssh_config tests
|
|
4
|
+
#
|
|
5
|
+
# Parameters::
|
|
6
|
+
# * Proc: Code called when the platform is setup
|
|
7
|
+
# * Parameters::
|
|
8
|
+
# * *repository* (String): Platform's repository
|
|
9
|
+
def with_test_platform_for_ssh_config
|
|
10
|
+
with_test_platform({ nodes: { 'node1' => {}, 'node2' => {} } }) do |repository|
|
|
11
|
+
yield repository
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'dumps the SSH config without arguments' do
|
|
16
|
+
with_test_platform_for_ssh_config do
|
|
17
|
+
expect(test_actions_executor.connector(:ssh)).to receive(:ssh_config).with(ssh_exec: 'ssh') { '# SSH config' }
|
|
18
|
+
exit_code, stdout, stderr = run 'ssh_config'
|
|
19
|
+
expect(exit_code).to eq 0
|
|
20
|
+
expect(stdout).to match /# SSH config/
|
|
21
|
+
expect(stderr).to eq ''
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'dumps the SSH config with an alternate SSH executable' do
|
|
26
|
+
with_test_platform_for_ssh_config do
|
|
27
|
+
expect(test_actions_executor.connector(:ssh)).to receive(:ssh_config).with(ssh_exec: 'my_ssh') { '# SSH config' }
|
|
28
|
+
exit_code, stdout, stderr = run 'ssh_config', '--ssh-exec', 'my_ssh'
|
|
29
|
+
expect(exit_code).to eq 0
|
|
30
|
+
expect(stdout).to match /# SSH config/
|
|
31
|
+
expect(stderr).to eq ''
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
describe 'test executable' do
|
|
2
|
+
|
|
3
|
+
# Setup a platform for test tests
|
|
4
|
+
#
|
|
5
|
+
# Parameters::
|
|
6
|
+
# * Proc: Code called when the platform is setup
|
|
7
|
+
# * Parameters::
|
|
8
|
+
# * *repository* (String): Platform's repository
|
|
9
|
+
def with_test_platform_for_test
|
|
10
|
+
with_test_platform({ nodes: { 'node' => {} } }) do |repository|
|
|
11
|
+
yield repository
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'executes a given test on a given node' do
|
|
16
|
+
with_test_platform_for_test do
|
|
17
|
+
expect(test_tests_runner).to receive(:run_tests).with(['node']) do
|
|
18
|
+
expect(test_tests_runner.tests).to eq [:my_test]
|
|
19
|
+
0
|
|
20
|
+
end
|
|
21
|
+
exit_code, stdout, stderr = run 'test', '--node', 'node', '--test', 'my_test'
|
|
22
|
+
expect(exit_code).to eq 0
|
|
23
|
+
expect(stdout).to eq ''
|
|
24
|
+
expect(stderr).to eq ''
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'fails when tests are failing' do
|
|
29
|
+
with_test_platform_for_test do
|
|
30
|
+
expect(test_tests_runner).to receive(:run_tests).with(['node']) do
|
|
31
|
+
expect(test_tests_runner.tests).to eq [:my_test]
|
|
32
|
+
1
|
|
33
|
+
end
|
|
34
|
+
exit_code, stdout, stderr = run 'test', '--node', 'node', '--test', 'my_test'
|
|
35
|
+
expect(exit_code).to eq 1
|
|
36
|
+
expect(stdout).to eq ''
|
|
37
|
+
expect(stderr).to eq ''
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
module HybridPlatformsConductorTest
|
|
2
|
+
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
module ActionsExecutorHelpers
|
|
6
|
+
|
|
7
|
+
# Return a test platform setup with test actions and test connectors
|
|
8
|
+
#
|
|
9
|
+
# Parameters::
|
|
10
|
+
# * *platform_info* (Hash<Symbol,Object>): Platform info for the test platform [default = {}]
|
|
11
|
+
# * Proc: Code called with the environment ready
|
|
12
|
+
# * Parameters::
|
|
13
|
+
# * *repository* (String): Path to the repository
|
|
14
|
+
def with_test_platform_for_executor(platform_info = {})
|
|
15
|
+
with_test_platform(platform_info) do |repository|
|
|
16
|
+
# Register the test_action action
|
|
17
|
+
register_plugins(:action, { test_action: HybridPlatformsConductorTest::TestAction }, replace: false)
|
|
18
|
+
# Register the test_connectors, and only these ones
|
|
19
|
+
register_plugins(
|
|
20
|
+
:connector,
|
|
21
|
+
{
|
|
22
|
+
test_connector: HybridPlatformsConductorTest::TestConnector,
|
|
23
|
+
test_connector_2: HybridPlatformsConductorTest::TestConnector
|
|
24
|
+
},
|
|
25
|
+
replace: false
|
|
26
|
+
)
|
|
27
|
+
yield repository
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Define a simple environment with 1 node to perform tests on actions' plugins
|
|
32
|
+
#
|
|
33
|
+
# Parameters::
|
|
34
|
+
# * Proc: Code called with environment setup
|
|
35
|
+
# * Parameters::
|
|
36
|
+
# * *repository* (String): Path to the repository
|
|
37
|
+
def with_test_platform_for_action_plugins
|
|
38
|
+
with_test_platform_for_executor(nodes: { 'node' => {} }) do |repository|
|
|
39
|
+
test_actions_executor.connector(:test_connector).accept_nodes = ['node']
|
|
40
|
+
yield repository
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Get the test action executions
|
|
45
|
+
#
|
|
46
|
+
# Result::
|
|
47
|
+
# * Array<Array>: Test action executions
|
|
48
|
+
def action_executions
|
|
49
|
+
HybridPlatformsConductorTest::TestAction.executions
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Expect the Actions Executor to prepare connections to a given list of nodes.
|
|
53
|
+
# Perform a check at the end that it was called correctly.
|
|
54
|
+
#
|
|
55
|
+
# Parameters::
|
|
56
|
+
# * *expected_nodes* (Array<String>): List of nodes that should have masters created
|
|
57
|
+
# * Proc: Code called with the Actions Executor mocked
|
|
58
|
+
def with_connections_mocked_on(expected_nodes)
|
|
59
|
+
expect(test_actions_executor).to receive(:with_connections_prepared_to) do |nodes, no_exception: false, &client_code|
|
|
60
|
+
expect(nodes.sort).to eq expected_nodes.sort
|
|
61
|
+
client_code.call Hash[nodes.map { |node| [node, test_actions_executor.connector(:test_connector)] }]
|
|
62
|
+
end
|
|
63
|
+
yield
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Expect Actions Executor execute_actions to be called for a given sequence of actions, and provide mocking code to execute
|
|
67
|
+
#
|
|
68
|
+
# Parameters::
|
|
69
|
+
# * *expected_runs* (Array<Proc>): List of mocking codes that should be run. Each Proc has the same signature as ActionsExecutor#execute_actions
|
|
70
|
+
def expect_actions_executor_runs(expected_runs)
|
|
71
|
+
idx_actions_executor_run = 0
|
|
72
|
+
expect(test_actions_executor).to receive(:execute_actions).exactly(expected_runs.size).times do |actions_per_nodes, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true, progress_name: 'Executing actions'|
|
|
73
|
+
logger.debug "[ Mocked ActionsExecutor ] - Run actions: #{actions_per_nodes}"
|
|
74
|
+
result =
|
|
75
|
+
if idx_actions_executor_run >= expected_runs.size
|
|
76
|
+
raise "ActionsExecutor#execute_actions has been used #{idx_actions_executor_run + 1} times, but was expected only #{expected_runs.size} times"
|
|
77
|
+
else
|
|
78
|
+
expected_runs[idx_actions_executor_run].call actions_per_nodes, timeout: timeout, concurrent: concurrent, log_to_dir: log_to_dir, log_to_stdout: log_to_stdout
|
|
79
|
+
end
|
|
80
|
+
idx_actions_executor_run += 1
|
|
81
|
+
result
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Get a test ActionsExecutor
|
|
86
|
+
#
|
|
87
|
+
# Result::
|
|
88
|
+
# * ActionsExecutor: ActionsExecutor on which we can do testing
|
|
89
|
+
def test_actions_executor
|
|
90
|
+
@actions_executor = HybridPlatformsConductor::ActionsExecutor.new logger: logger, logger_stderr: logger, config: test_config, cmd_runner: test_cmd_runner, nodes_handler: test_nodes_handler unless @actions_executor
|
|
91
|
+
@actions_executor
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
module HybridPlatformsConductorTest
|
|
2
|
+
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
module CmdRunnerHelpers
|
|
6
|
+
|
|
7
|
+
# Run some code with some expected commands to be run by CmdRunner.
|
|
8
|
+
# Run expectations on the expected commands to be called.
|
|
9
|
+
#
|
|
10
|
+
# Parameters::
|
|
11
|
+
# * *commands* (Array< [String or Regexp, Proc] >): Expected commands that should be called on CmdRunner: the command name or regexp and the corresponding mocked code
|
|
12
|
+
# * Parameters::
|
|
13
|
+
# * Same parameters as CmdRunner@run_cmd
|
|
14
|
+
# * *cmd_runner* (CmdRunner): The CmdRunner to mock [default: test_cmd_runner]
|
|
15
|
+
# * Proc: Code called with the command runner mocked
|
|
16
|
+
def with_cmd_runner_mocked(commands, cmd_runner: test_cmd_runner)
|
|
17
|
+
unexpected_commands = []
|
|
18
|
+
remaining_expected_commands = commands.clone
|
|
19
|
+
# We need to protect the access to this array as the mocked commands can be called by competing threads
|
|
20
|
+
remaining_expected_commands_mutex = Mutex.new
|
|
21
|
+
allow(cmd_runner).to receive(:run_cmd) do |cmd, log_to_file: nil, log_to_stdout: true, log_stdout_to_io: nil, log_stderr_to_io: nil, expected_code: 0, timeout: nil, no_exception: false|
|
|
22
|
+
# Check the remaining expected commands
|
|
23
|
+
found_command = nil
|
|
24
|
+
found_command_code = nil
|
|
25
|
+
remaining_expected_commands_mutex.synchronize do
|
|
26
|
+
remaining_expected_commands.delete_if do |(expected_command, command_code)|
|
|
27
|
+
break unless found_command.nil?
|
|
28
|
+
if (expected_command.is_a?(String) && expected_command == cmd) || (expected_command.is_a?(Regexp) && cmd =~ expected_command)
|
|
29
|
+
found_command = expected_command
|
|
30
|
+
found_command_code = command_code
|
|
31
|
+
true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
if found_command
|
|
36
|
+
logger.debug "[ Mocked CmdRunner ] - Calling mocked command #{cmd}"
|
|
37
|
+
mocked_exit_status, mocked_stdout, mocked_stderr = found_command_code.call(
|
|
38
|
+
cmd,
|
|
39
|
+
log_to_file: log_to_file,
|
|
40
|
+
log_to_stdout: log_to_stdout,
|
|
41
|
+
log_stdout_to_io: log_stdout_to_io,
|
|
42
|
+
log_stderr_to_io: log_stderr_to_io,
|
|
43
|
+
expected_code: expected_code,
|
|
44
|
+
timeout: timeout,
|
|
45
|
+
no_exception: no_exception
|
|
46
|
+
)
|
|
47
|
+
log_stdout =
|
|
48
|
+
if mocked_stdout.empty?
|
|
49
|
+
''
|
|
50
|
+
else
|
|
51
|
+
stripped_stdout = mocked_stdout.strip
|
|
52
|
+
stripped_stdout.include?("\n") ? "\n----- Mocked STDOUT:\n#{mocked_stdout}" : " (Mocked STDOUT: #{stripped_stdout})"
|
|
53
|
+
end
|
|
54
|
+
log_stderr =
|
|
55
|
+
if mocked_stderr.empty?
|
|
56
|
+
''
|
|
57
|
+
else
|
|
58
|
+
stripped_stderr = mocked_stderr.strip
|
|
59
|
+
stripped_stderr.include?("\n") ? "\n----- Mocked STDERR:\n#{mocked_stderr}" : " (Mocked STDERR: #{stripped_stderr})"
|
|
60
|
+
end
|
|
61
|
+
logger.debug "[ Mocked CmdRunner ] - Calling mocked command #{cmd} => #{mocked_exit_status}#{log_stdout}#{log_stderr}"
|
|
62
|
+
# If IOs were used, don't forget to mock them as well
|
|
63
|
+
log_stdout_to_io << mocked_stdout if !mocked_stdout.empty? && !log_stdout_to_io.nil?
|
|
64
|
+
log_stderr_to_io << mocked_stderr if !mocked_stderr.empty? && !log_stderr_to_io.nil?
|
|
65
|
+
[mocked_exit_status, mocked_stdout, mocked_stderr]
|
|
66
|
+
else
|
|
67
|
+
logger.error "[ Mocked CmdRunner ] - !!! Unexpected command run: #{cmd}"
|
|
68
|
+
unexpected_commands << cmd
|
|
69
|
+
[:unexpected_command_to_mock, '', "Could not mock unexpected command #{cmd}"]
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
yield
|
|
73
|
+
expect(unexpected_commands).to eq []
|
|
74
|
+
expect(remaining_expected_commands).to eq([]), "Expected CmdRunner commands were not run:\n#{remaining_expected_commands.map(&:first).join("\n")}"
|
|
75
|
+
# Un-mock the command runner
|
|
76
|
+
allow(cmd_runner).to receive(:run_cmd).and_call_original
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Get a test CmdRunner
|
|
80
|
+
#
|
|
81
|
+
# Result::
|
|
82
|
+
# * CmdRunner: CmdRunner on which we can do testing
|
|
83
|
+
def test_cmd_runner
|
|
84
|
+
@cmd_runner = HybridPlatformsConductor::CmdRunner.new logger: logger, logger_stderr: logger unless @cmd_runner
|
|
85
|
+
@cmd_runner
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module HybridPlatformsConductorTest
|
|
2
|
+
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
module CmdbHelpers
|
|
6
|
+
|
|
7
|
+
# Get a given CMDB instance to be tested
|
|
8
|
+
#
|
|
9
|
+
# Parameters::
|
|
10
|
+
# * *name* (Symbol): The CMDB name
|
|
11
|
+
# Result::
|
|
12
|
+
# * Cmdb: The CMDB instance
|
|
13
|
+
def cmdb(name)
|
|
14
|
+
test_nodes_handler.instance_variable_get(:@cmdbs)[name]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Register test CMDBs in the test nodes handler as the only CMDB available
|
|
18
|
+
#
|
|
19
|
+
# Parameters::
|
|
20
|
+
# * *cmdb_names* (Array<Symbol>): The test CMDBs to register [default = [:test_cmdb]]
|
|
21
|
+
def register_test_cmdb(cmdb_names = [:test_cmdb])
|
|
22
|
+
register_plugins(
|
|
23
|
+
:cmdb,
|
|
24
|
+
Hash[cmdb_names.map do |plugin_id|
|
|
25
|
+
[
|
|
26
|
+
plugin_id,
|
|
27
|
+
HybridPlatformsConductorTest::CmdbPlugins.const_get(plugin_id.to_s.split('_').collect(&:capitalize).join.to_sym)
|
|
28
|
+
]
|
|
29
|
+
end]
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module HybridPlatformsConductorTest
|
|
2
|
+
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
module ConfigHelpers
|
|
6
|
+
|
|
7
|
+
# Get a test Config
|
|
8
|
+
#
|
|
9
|
+
# Result::
|
|
10
|
+
# * Config: Config on which we can do testing
|
|
11
|
+
def test_config
|
|
12
|
+
@config = HybridPlatformsConductor::Config.new logger: logger, logger_stderr: logger unless @config
|
|
13
|
+
@config
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
module HybridPlatformsConductorTest
|
|
2
|
+
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
module ConnectorSshHelpers
|
|
6
|
+
|
|
7
|
+
# Get expected commands for SSH connections established for a given set of nodes.
|
|
8
|
+
# Those expected commands are meant to be directed and mocked by CmdRunner.
|
|
9
|
+
#
|
|
10
|
+
# Parameters::
|
|
11
|
+
# * *nodes_connections* (Hash<String, Hash<Symbol,Object> >): Nodes' connections info, per node name:
|
|
12
|
+
# * *connection* (String): Connection string (fqdn, IP...) used by SSH
|
|
13
|
+
# * *user* (String): User used by SSH
|
|
14
|
+
# * *times* (Integer): Number of times this connection should be used [default: 1]
|
|
15
|
+
# * *control_master_create_error* (String or nil): Error to simulate during the SSH ControlMaster creation, or nil for none [default: nil]
|
|
16
|
+
# * *with_control_master_create* (Boolean): Do we create the control master? [default: true]
|
|
17
|
+
# * *with_control_master_check* (Boolean): Do we check the control master? [default: false]
|
|
18
|
+
# * *with_control_master_destroy* (Boolean): Do we destroy the control master? [default: true]
|
|
19
|
+
# * *with_strict_host_key_checking* (Boolean): Do we use strict host key checking? [default: true]
|
|
20
|
+
# * *with_batch_mode* (Boolean): Do we use BatchMode when creating the control master? [default: true]
|
|
21
|
+
# Result::
|
|
22
|
+
# * Array< [String or Regexp, Proc] >: The expected commands that should be used, and their corresponding mocked code
|
|
23
|
+
def ssh_expected_commands_for(
|
|
24
|
+
nodes_connections,
|
|
25
|
+
with_control_master_create: true,
|
|
26
|
+
with_control_master_check: false,
|
|
27
|
+
with_control_master_destroy: true,
|
|
28
|
+
with_strict_host_key_checking: true,
|
|
29
|
+
with_batch_mode: true
|
|
30
|
+
)
|
|
31
|
+
nodes_connections.map do |node, node_connection_info|
|
|
32
|
+
node_connection_info[:times] = 1 unless node_connection_info.key?(:times)
|
|
33
|
+
ssh_commands_once = []
|
|
34
|
+
ssh_commands_per_connection = []
|
|
35
|
+
if with_strict_host_key_checking
|
|
36
|
+
ssh_commands_once.concat([
|
|
37
|
+
[
|
|
38
|
+
"ssh-keyscan #{node_connection_info[:connection]}",
|
|
39
|
+
proc { [0, "#{node_connection_info[:connection]} ssh-rsa fake_host_key_for_#{node_connection_info[:connection]}", ''] }
|
|
40
|
+
]
|
|
41
|
+
])
|
|
42
|
+
end
|
|
43
|
+
if with_control_master_create
|
|
44
|
+
ssh_commands_per_connection << [
|
|
45
|
+
/^.+\/ssh #{with_batch_mode ? '-o BatchMode=yes ' : ''}-o ControlMaster=yes -o ControlPersist=yes #{Regexp.escape(node_connection_info[:user])}@hpc\.#{Regexp.escape(node)} true$/,
|
|
46
|
+
proc do
|
|
47
|
+
control_file = test_actions_executor.connector(:ssh).send(:control_master_file, node_connection_info[:connection], '22', node_connection_info[:user])
|
|
48
|
+
# Fail if the ControlMaster file already exists, as would SSH do if the file is stalled
|
|
49
|
+
if File.exist?(control_file)
|
|
50
|
+
[255, '', "Control file #{control_file} already exists"]
|
|
51
|
+
elsif node_connection_info[:control_master_create_error].nil?
|
|
52
|
+
# Really touch a fake control file, as ssh connector checks for its existence
|
|
53
|
+
File.write(control_file, '')
|
|
54
|
+
[0, '', '']
|
|
55
|
+
else
|
|
56
|
+
[255, '', node_connection_info[:control_master_create_error]]
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
]
|
|
60
|
+
end
|
|
61
|
+
if with_control_master_check
|
|
62
|
+
ssh_commands_per_connection << [
|
|
63
|
+
/^.+\/ssh -O check #{Regexp.escape(node_connection_info[:user])}@hpc\.#{Regexp.escape(node)}$/,
|
|
64
|
+
proc { [0, '', ''] }
|
|
65
|
+
]
|
|
66
|
+
end
|
|
67
|
+
if with_control_master_destroy
|
|
68
|
+
ssh_commands_per_connection << [
|
|
69
|
+
/^.+\/ssh -O exit #{Regexp.escape(node_connection_info[:user])}@hpc\.#{Regexp.escape(node)} 2>&1 \| grep -v 'Exit request sent\.'$/,
|
|
70
|
+
proc do
|
|
71
|
+
# Really mock the control file deletion
|
|
72
|
+
File.unlink(test_actions_executor.connector(:ssh).send(:control_master_file, node_connection_info[:connection], '22', node_connection_info[:user]))
|
|
73
|
+
[1, '', '']
|
|
74
|
+
end
|
|
75
|
+
]
|
|
76
|
+
end
|
|
77
|
+
ssh_commands_once + ssh_commands_per_connection * node_connection_info[:times]
|
|
78
|
+
end.flatten(1)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Return the connector to be tested
|
|
82
|
+
#
|
|
83
|
+
# Result::
|
|
84
|
+
# * Connector: Connector to be tested
|
|
85
|
+
def test_connector
|
|
86
|
+
test_actions_executor.connector(:ssh)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Get a test platform and the connector prepared the same way Actions Executor does before calling remote_* methods
|
|
90
|
+
#
|
|
91
|
+
# Parameters::
|
|
92
|
+
# * *expected_cmds* (Array< [String or Regexp, Proc] >): The expected commands that should be used, and their corresponding mocked code [default: []]
|
|
93
|
+
# * *expected_stdout* (String): Expected stdout after client code execution [default: '']
|
|
94
|
+
# * *expected_stderr* (String): Expected stderr after client code execution [default: '']
|
|
95
|
+
# * *timeout* (Integer or nil): Timeout to prepare the connector for [default: nil]
|
|
96
|
+
# * *password* (String or nil): Password to set for the node, or nil for none [default: nil]
|
|
97
|
+
# * Proc: Client code to execute testing
|
|
98
|
+
def with_test_platform_for_remote_testing(expected_cmds: [], expected_stdout: '', expected_stderr: '', timeout: nil, password: nil)
|
|
99
|
+
with_test_platform(nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }) do
|
|
100
|
+
with_cmd_runner_mocked(
|
|
101
|
+
[
|
|
102
|
+
['which env', proc { [0, "/usr/bin/env\n", ''] }],
|
|
103
|
+
['ssh -V 2>&1', proc { [0, "OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u 20 Dec 2019\n", ''] }]
|
|
104
|
+
] +
|
|
105
|
+
(password ? [['sshpass -V', proc { [0, "sshpass 1.06\n", ''] }]] : []) +
|
|
106
|
+
ssh_expected_commands_for(
|
|
107
|
+
{ 'node' => { connection: '192.168.42.42', user: 'test_user' } },
|
|
108
|
+
with_batch_mode: password.nil?
|
|
109
|
+
) +
|
|
110
|
+
expected_cmds
|
|
111
|
+
) do
|
|
112
|
+
test_connector.ssh_user = 'test_user'
|
|
113
|
+
test_connector.passwords['node'] = password if password
|
|
114
|
+
test_connector.with_connection_to(['node']) do
|
|
115
|
+
stdout = ''
|
|
116
|
+
stderr = ''
|
|
117
|
+
test_connector.prepare_for('node', timeout, stdout, stderr)
|
|
118
|
+
yield
|
|
119
|
+
expect(stdout).to eq expected_stdout
|
|
120
|
+
expect(stderr).to eq expected_stderr
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
end
|