hybrid_platforms_conductor 32.16.4 → 33.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +6 -3
- data/bin/check-node +0 -1
- data/bin/deploy +0 -1
- data/bin/get_impacted_nodes +0 -1
- data/bin/last_deploys +12 -8
- data/bin/nodes_to_deploy +6 -6
- data/bin/setup +6 -6
- data/bin/topograph +1 -1
- data/docs/config_dsl.md +45 -1
- data/docs/executables.md +6 -7
- data/docs/executables/check-node.md +3 -3
- data/docs/executables/deploy.md +3 -3
- data/docs/executables/dump_nodes_json.md +3 -3
- data/docs/executables/test.md +3 -3
- data/docs/executables/topograph.md +3 -3
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/docs/plugins.md +47 -0
- data/docs/plugins/connector/ssh.md +1 -1
- data/docs/plugins/log/remote_fs.md +26 -0
- data/docs/plugins/secrets_reader/cli.md +31 -0
- data/docs/plugins/secrets_reader/thycotic.md +46 -0
- data/docs/plugins/test/bitbucket_conf.md +1 -1
- data/docs/plugins/test/check_deploy_and_idempotence.md +1 -1
- data/docs/plugins/test/connection.md +1 -0
- data/docs/plugins/test/deploy_removes_root_access.md +1 -1
- data/docs/plugins/test/file_system.md +1 -0
- data/docs/plugins/test/github_ci.md +48 -0
- data/docs/plugins/test/hostname.md +1 -0
- data/docs/plugins/test/ip.md +1 -0
- data/docs/plugins/test/jenkins_ci_conf.md +1 -1
- data/docs/plugins/test/jenkins_ci_masters_ok.md +1 -1
- data/docs/plugins/test/local_users.md +1 -0
- data/docs/plugins/test/mounts.md +1 -0
- data/docs/plugins/test/orphan_files.md +1 -0
- data/docs/plugins/test/ports.md +1 -0
- data/docs/plugins/test/spectre.md +1 -0
- data/docs/plugins/test/vulnerabilities.md +1 -0
- data/lib/hybrid_platforms_conductor/action.rb +4 -4
- data/lib/hybrid_platforms_conductor/actions_executor.rb +45 -43
- data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
- data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
- data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +63 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
- data/lib/hybrid_platforms_conductor/config.rb +7 -4
- data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
- data/lib/hybrid_platforms_conductor/connector.rb +5 -2
- data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
- data/lib/hybrid_platforms_conductor/deployer.rb +275 -224
- data/lib/hybrid_platforms_conductor/executable.rb +20 -15
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/my_log_plugin.rb.sample +100 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +180 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +118 -117
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/my_secrets_reader_plugin.rb.sample +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +90 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +7 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +21 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +13 -10
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +5 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +7 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +27 -25
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
- data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
- data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
- data/lib/hybrid_platforms_conductor/log.rb +31 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
- data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
- data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
- data/lib/hybrid_platforms_conductor/plugins.rb +14 -8
- data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
- data/lib/hybrid_platforms_conductor/report.rb +2 -2
- data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
- data/lib/hybrid_platforms_conductor/secrets_reader.rb +31 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
- data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +18 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
- data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
- data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
- data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +33 -12
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +16 -11
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +23 -18
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +67 -49
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +63 -50
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +35 -35
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +73 -54
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +106 -91
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +10 -12
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
- data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +43 -5
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +199 -216
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +223 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +268 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +5 -4
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +72 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +159 -113
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +299 -160
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -196
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +245 -56
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id1.rb → test_plugin_id_1.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id2.rb → test_plugin_id_2.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/{test_plugin_id3.rb → test_plugin_id_3.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/{test_plugin_type2/test_plugin_id4.rb → test_plugin_type_2/test_plugin_id_4.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
- data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +84 -0
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +105 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +45 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
- data/spec/spec_helper.rb +17 -18
- data/tools/check_md +16 -20
- data/tools/generate_mermaid +1 -1
- metadata +82 -13
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -916
@@ -1,15 +1,13 @@
|
|
1
1
|
describe HybridPlatformsConductor::ActionsExecutor do
|
2
2
|
|
3
|
-
context 'checking timeouts' do
|
3
|
+
context 'when checking timeouts' do
|
4
4
|
|
5
5
|
# Get a test platform to test timeouts
|
6
6
|
#
|
7
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' => {} })
|
11
|
-
yield
|
12
|
-
end
|
8
|
+
# * *block* (Proc): Code called with platform setup
|
9
|
+
def with_test_platform_for_timeouts_tests(&block)
|
10
|
+
with_test_platform_for_executor(nodes: { 'node' => {} }, &block)
|
13
11
|
end
|
14
12
|
|
15
13
|
it 'executes an action without timeout' do
|
@@ -38,7 +36,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
38
36
|
it 'executes an action that fails because of timeout' do
|
39
37
|
with_test_platform_for_timeouts_tests do
|
40
38
|
expect(test_actions_executor.execute_actions(
|
41
|
-
{ 'node' => { test_action: { code: proc do
|
39
|
+
{ 'node' => { test_action: { code: proc do
|
42
40
|
raise HybridPlatformsConductor::CmdRunner::TimeoutError
|
43
41
|
end } } },
|
44
42
|
timeout: 1
|
@@ -49,7 +47,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
49
47
|
it 'executes an action that fails because of timeout and outputs data before' do
|
50
48
|
with_test_platform_for_timeouts_tests do
|
51
49
|
expect(test_actions_executor.execute_actions(
|
52
|
-
{ 'node' => { test_action: { code: proc do |stdout
|
50
|
+
{ 'node' => { test_action: { code: proc do |stdout|
|
53
51
|
stdout << 'Hello'
|
54
52
|
raise HybridPlatformsConductor::CmdRunner::TimeoutError
|
55
53
|
end } } },
|
@@ -66,7 +64,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
66
64
|
sleep 1
|
67
65
|
stdout << 'Hello'
|
68
66
|
end } },
|
69
|
-
{ test_action: { code: proc do
|
67
|
+
{ test_action: { code: proc do
|
70
68
|
raise HybridPlatformsConductor::CmdRunner::TimeoutError
|
71
69
|
end } }
|
72
70
|
] },
|
@@ -79,15 +77,15 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
79
77
|
with_test_platform_for_timeouts_tests do
|
80
78
|
expect(test_actions_executor.execute_actions(
|
81
79
|
{ 'node' => [
|
82
|
-
{ test_action: { code: proc do |
|
80
|
+
{ test_action: { code: proc do |_stdout, _stderr, action|
|
83
81
|
expect(action.timeout).to eq 5
|
84
82
|
sleep 1
|
85
83
|
end } },
|
86
|
-
{ test_action: { code: proc do |
|
84
|
+
{ test_action: { code: proc do |_stdout, _stderr, action|
|
87
85
|
expect(action.timeout).to be_between(3.8, 4)
|
88
86
|
sleep 1
|
89
87
|
end } },
|
90
|
-
{ test_action: { code: proc do |
|
88
|
+
{ test_action: { code: proc do |_stdout, _stderr, action|
|
91
89
|
expect(action.timeout).to be_between(2.8, 3)
|
92
90
|
end } }
|
93
91
|
] },
|
@@ -8,21 +8,21 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'runs a simple bash command and returns exit code, stdout and stderr correctly' do
|
11
|
-
with_repository do
|
12
|
-
expect(test_cmd_runner.run_cmd
|
11
|
+
with_repository do
|
12
|
+
expect(test_cmd_runner.run_cmd('echo TestStderr 1>&2 ; echo TestStdout')).to eq [0, "TestStdout\n", "TestStderr\n"]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'runs a simple bash command and forces usage of bash' do
|
17
|
-
with_repository do
|
17
|
+
with_repository do
|
18
18
|
# Use set -o pipefail that does not work in /bin/sh
|
19
|
-
expect(test_cmd_runner.run_cmd
|
19
|
+
expect(test_cmd_runner.run_cmd('set -o pipefail ; echo TestStderr 1>&2 ; echo TestStdout', force_bash: true)).to eq [0, "TestStdout\n", "TestStderr\n"]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'runs a simple bash command and logs stdout and stderr to a file' do
|
24
24
|
with_repository do |repository|
|
25
|
-
test_cmd_runner.run_cmd
|
25
|
+
test_cmd_runner.run_cmd 'echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout', log_to_file: "#{repository}/test_file"
|
26
26
|
expect(File.read("#{repository}/test_file")).to eq "TestStderr\nTestStdout\n"
|
27
27
|
end
|
28
28
|
end
|
@@ -30,102 +30,102 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
30
30
|
it 'runs a simple bash command and logs stdout and stderr to an existing file' do
|
31
31
|
with_repository do |repository|
|
32
32
|
File.write("#{repository}/test_file", "Before\n")
|
33
|
-
test_cmd_runner.run_cmd
|
33
|
+
test_cmd_runner.run_cmd 'echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout', log_to_file: "#{repository}/test_file"
|
34
34
|
expect(File.read("#{repository}/test_file")).to eq "Before\nTestStderr\nTestStdout\n"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'runs a simple bash command and logs stdout and stderr to IO objects' do
|
39
|
-
with_repository do
|
39
|
+
with_repository do
|
40
40
|
stdout = ''
|
41
41
|
stderr = ''
|
42
|
-
test_cmd_runner.run_cmd
|
42
|
+
test_cmd_runner.run_cmd 'echo TestStderr 1>&2 ; sleep 1 ; echo TestStdout', log_stdout_to_io: stdout, log_stderr_to_io: stderr
|
43
43
|
expect(stdout).to eq "TestStdout\n"
|
44
44
|
expect(stderr).to eq "TestStderr\n"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'fails when the command does not exit 0' do
|
49
|
-
with_repository do
|
49
|
+
with_repository do
|
50
50
|
expect { test_cmd_runner.run_cmd 'exit 1' }.to raise_error(HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command \'exit 1\' returned error code 1 (expected 0).')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'fails when the command does not exit with the expected code' do
|
55
|
-
with_repository do
|
55
|
+
with_repository do
|
56
56
|
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).')
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'fails when the command does not exit with one of the expected codes' do
|
61
|
-
with_repository do
|
61
|
+
with_repository do
|
62
62
|
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).')
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'does not fail when the command exits with the expected code' do
|
67
|
-
with_repository do
|
68
|
-
expect(test_cmd_runner.run_cmd
|
67
|
+
with_repository do
|
68
|
+
expect(test_cmd_runner.run_cmd('exit 2', expected_code: 2)).to eq [2, '', '']
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'does not fail when the command exits with one of the expected codes' do
|
73
|
-
with_repository do
|
74
|
-
expect(test_cmd_runner.run_cmd
|
73
|
+
with_repository do
|
74
|
+
expect(test_cmd_runner.run_cmd('exit 2', expected_code: [0, 2, 3])).to eq [2, '', '']
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'does not fail when the command does not exit 0 and we specify no exception' do
|
79
|
-
with_repository do
|
80
|
-
expect(test_cmd_runner.run_cmd
|
79
|
+
with_repository do
|
80
|
+
expect(test_cmd_runner.run_cmd('exit 1', no_exception: true)).to eq [1, '', '']
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'does not fail when the command can\'t be run and we specify no exception' do
|
85
|
-
with_repository do
|
85
|
+
with_repository do
|
86
86
|
exit_status, stdout, stderr = test_cmd_runner.run_cmd 'unknown_command', no_exception: true
|
87
87
|
expect(exit_status).to eq :command_error
|
88
88
|
expect(stdout).to eq ''
|
89
|
-
expect(stderr).to match
|
89
|
+
expect(stderr).to match(/^No such file or directory - unknown_command.*/)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'does not fail when the command is expected to not be run' do
|
94
|
-
with_repository do
|
94
|
+
with_repository do
|
95
95
|
exit_status, stdout, stderr = test_cmd_runner.run_cmd 'unknown_command', expected_code: :command_error
|
96
96
|
expect(exit_status).to eq :command_error
|
97
97
|
expect(stdout).to eq ''
|
98
|
-
expect(stderr).to match
|
98
|
+
expect(stderr).to match(/^No such file or directory - unknown_command.*/)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'fails when the command times out' do
|
103
|
-
with_repository do
|
103
|
+
with_repository do
|
104
104
|
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).')
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'returns the timeout error when the command times out and we specify no exception' do
|
109
|
-
with_repository do
|
110
|
-
expect(test_cmd_runner.run_cmd
|
109
|
+
with_repository do
|
110
|
+
expect(test_cmd_runner.run_cmd('sleep 5', timeout: 1, no_exception: true)).to eq [:timeout, '', 'Timeout of 1 triggered']
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
114
|
it 'returns the timeout error when the command is expected to time out' do
|
115
|
-
with_repository do
|
116
|
-
expect(test_cmd_runner.run_cmd
|
115
|
+
with_repository do
|
116
|
+
expect(test_cmd_runner.run_cmd('sleep 5', timeout: 1, expected_code: :timeout)).to eq [:timeout, '', 'Timeout of 1 triggered']
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
it 'returns the timeout error with previously output stdout and stderr when the command times out and we specify no exception' do
|
121
|
-
with_repository do
|
122
|
-
expect(test_cmd_runner.run_cmd
|
121
|
+
with_repository do
|
122
|
+
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"]
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'returns the timeout error with previously output stdout and stderr when the command times out as expected' do
|
127
|
-
with_repository do
|
128
|
-
expect(test_cmd_runner.run_cmd
|
127
|
+
with_repository do
|
128
|
+
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"]
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -133,7 +133,7 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
133
133
|
with_repository do |repository|
|
134
134
|
cmd_runner = test_cmd_runner
|
135
135
|
cmd_runner.dry_run = true
|
136
|
-
expect(cmd_runner.run_cmd
|
136
|
+
expect(cmd_runner.run_cmd("echo TestContent >#{repository}/test_file")).to eq [0, '', '']
|
137
137
|
expect(File.exist?("#{repository}/test_file")).to eq false
|
138
138
|
end
|
139
139
|
end
|
@@ -142,31 +142,31 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
142
142
|
with_repository do |repository|
|
143
143
|
cmd_runner = test_cmd_runner
|
144
144
|
cmd_runner.dry_run = true
|
145
|
-
expect(cmd_runner.run_cmd
|
145
|
+
expect(cmd_runner.run_cmd("echo TestContent >#{repository}/test_file", expected_code: 2)).to eq [2, '', '']
|
146
146
|
expect(File.exist?("#{repository}/test_file")).to eq false
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
150
|
it 'returns the currently logged user' do
|
151
151
|
cmd_runner = test_cmd_runner
|
152
|
-
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false)
|
152
|
+
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false).and_return [0, 'test_user', '']
|
153
153
|
expect(cmd_runner.whoami).to eq 'test_user'
|
154
154
|
end
|
155
155
|
|
156
156
|
it 'returns non-root user when user is not root' do
|
157
157
|
cmd_runner = test_cmd_runner
|
158
|
-
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false)
|
158
|
+
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false).and_return [0, 'not_root', '']
|
159
159
|
expect(cmd_runner.root?).to eq false
|
160
160
|
end
|
161
161
|
|
162
162
|
it 'returns root user when user is root' do
|
163
163
|
cmd_runner = test_cmd_runner
|
164
|
-
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false)
|
164
|
+
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false).and_return [0, 'root', '']
|
165
165
|
expect(cmd_runner.root?).to eq true
|
166
166
|
end
|
167
167
|
|
168
168
|
it 'returns the correct executable prefix' do
|
169
|
-
expect(
|
169
|
+
expect(described_class.executables_prefix).to eq "#{File.dirname($PROGRAM_NAME)}/"
|
170
170
|
end
|
171
171
|
|
172
172
|
end
|
@@ -7,23 +7,23 @@ describe HybridPlatformsConductor::Config do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'returns 1 defined OS image' do
|
10
|
-
with_platforms 'os_image :
|
11
|
-
expect(test_config.known_os_images).to eq [:
|
10
|
+
with_platforms 'os_image :image_1, \'/path/to/image_1\'' do
|
11
|
+
expect(test_config.known_os_images).to eq [:image_1]
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'returns 1 defined OS image with its directory' do
|
16
|
-
with_platforms 'os_image :
|
17
|
-
expect(test_config.os_image_dir(:
|
16
|
+
with_platforms 'os_image :image_1, \'/path/to/image_1\'' do
|
17
|
+
expect(test_config.os_image_dir(:image_1)).to eq '/path/to/image_1'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'returns several defined OS images' do
|
22
22
|
with_platforms '
|
23
|
-
os_image :
|
24
|
-
os_image :
|
23
|
+
os_image :image_1, \'/path/to/image_1\'
|
24
|
+
os_image :image_2, \'/path/to/image_2\'
|
25
25
|
' do
|
26
|
-
expect(test_config.known_os_images.sort).to eq %i[
|
26
|
+
expect(test_config.known_os_images.sort).to eq %i[image_1 image_2].sort
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -35,30 +35,32 @@ describe HybridPlatformsConductor::Config do
|
|
35
35
|
|
36
36
|
it 'accesses the platform handler repositories if needed from the config' do
|
37
37
|
with_repository do |repository|
|
38
|
-
with_platforms
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
with_platforms(
|
39
|
+
<<~EO_CONFIG
|
40
|
+
test_platform path: '#{repository}' do |repository_path|
|
41
|
+
os_image :image_1, "\#{repository_path}/image_path"
|
42
|
+
end
|
43
|
+
EO_CONFIG
|
44
|
+
) do
|
45
|
+
expect(test_config.known_os_images.sort).to eq %i[image_1].sort
|
46
|
+
expect(test_config.os_image_dir(:image_1)).to eq "#{repository}/image_path"
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
it 'includes several configuration files' do
|
50
52
|
with_platforms '
|
51
|
-
os_image :
|
53
|
+
os_image :image_1, \'/path/to/image_1\'
|
52
54
|
include_config_from "#{__dir__}/my_conf_1.rb"
|
53
55
|
include_config_from "#{__dir__}/my_conf_2.rb"
|
54
56
|
' do |hybrid_platforms_dir|
|
55
|
-
File.write("#{hybrid_platforms_dir}/my_conf_1.rb", <<~
|
56
|
-
os_image :
|
57
|
-
include_config_from "
|
58
|
-
|
59
|
-
File.write("#{hybrid_platforms_dir}/my_conf_2.rb", 'os_image :
|
60
|
-
File.write("#{hybrid_platforms_dir}/my_conf_3.rb", 'os_image :
|
61
|
-
expect(test_config.known_os_images.sort).to eq %i[
|
57
|
+
File.write("#{hybrid_platforms_dir}/my_conf_1.rb", <<~'EO_CONFIG')
|
58
|
+
os_image :image_4, '/path/to/image_4'
|
59
|
+
include_config_from "#{__dir__}/my_conf_3.rb"
|
60
|
+
EO_CONFIG
|
61
|
+
File.write("#{hybrid_platforms_dir}/my_conf_2.rb", 'os_image :image_2, \'/path/to/image_2\'')
|
62
|
+
File.write("#{hybrid_platforms_dir}/my_conf_3.rb", 'os_image :image_3, \'/path/to/image_3\'')
|
63
|
+
expect(test_config.known_os_images.sort).to eq %i[image_1 image_2 image_3 image_4].sort
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -1,12 +1,50 @@
|
|
1
1
|
describe HybridPlatformsConductor::Deployer do
|
2
2
|
|
3
|
-
context 'checking deployer specific config DSL' do
|
3
|
+
context 'when checking deployer specific config DSL' do
|
4
4
|
|
5
5
|
it 'declares a packaging timeout' do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
with_platforms('packaging_timeout 666') do
|
7
|
+
expect(test_config.packaging_timeout_secs).to eq 666
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'declares log plugins to be used' do
|
12
|
+
with_platforms(
|
13
|
+
<<~EO_CONFIG
|
14
|
+
send_logs_to %i[log_plugin_1 log_plugin_2]
|
15
|
+
for_nodes('node2') { send_logs_to :log_plugin_3 }
|
16
|
+
EO_CONFIG
|
17
|
+
) do
|
18
|
+
expect(test_config.deployment_logs).to eq [
|
19
|
+
{
|
20
|
+
nodes_selectors_stack: [],
|
21
|
+
log_plugins: %i[log_plugin_1 log_plugin_2]
|
22
|
+
},
|
23
|
+
{
|
24
|
+
nodes_selectors_stack: %w[node2],
|
25
|
+
log_plugins: %i[log_plugin_3]
|
26
|
+
}
|
27
|
+
]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'declares secrets readers plugins to be used' do
|
32
|
+
with_platforms(
|
33
|
+
<<~EO_CONFIG
|
34
|
+
read_secrets_from %i[secrets_reader_plugin_1 secrets_reader_plugin_2]
|
35
|
+
for_nodes('node2') { read_secrets_from :secrets_reader_plugin_3 }
|
36
|
+
EO_CONFIG
|
37
|
+
) do
|
38
|
+
expect(test_config.secrets_readers).to eq [
|
39
|
+
{
|
40
|
+
nodes_selectors_stack: [],
|
41
|
+
secrets_readers: %i[secrets_reader_plugin_1 secrets_reader_plugin_2]
|
42
|
+
},
|
43
|
+
{
|
44
|
+
nodes_selectors_stack: %w[node2],
|
45
|
+
secrets_readers: %i[secrets_reader_plugin_3]
|
46
|
+
}
|
47
|
+
]
|
10
48
|
end
|
11
49
|
end
|
12
50
|
|
@@ -1,241 +1,224 @@
|
|
1
1
|
describe HybridPlatformsConductor::Deployer do
|
2
2
|
|
3
|
-
context 'checking real deploy mode' do
|
3
|
+
context 'when checking real deploy mode' do
|
4
4
|
|
5
|
-
|
5
|
+
it_behaves_like 'a deployer' do
|
6
|
+
let(:check_mode) { false }
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'when checking log plugins usage' do
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
)
|
17
|
-
|
11
|
+
# Prepare the test platform with test log plugins
|
12
|
+
#
|
13
|
+
# Parameters::
|
14
|
+
# * *platforms_info* (Hash): The platforms info
|
15
|
+
# * *as_git* (Boolean): As a git repository? [default: false]
|
16
|
+
# * *additional_config* (String): Additional config [default: 'send_logs_to :test_log']
|
17
|
+
# * *block* (Proc): Code called with the platform setup
|
18
|
+
# * Parameters::
|
19
|
+
# * *repository* (String): Platform's repository
|
20
|
+
def with_test_platform_for_deploy_tests(platforms_info, as_git: false, additional_config: 'send_logs_to :test_log', &block)
|
21
|
+
with_test_platform(platforms_info, as_git: as_git, additional_config: additional_config, &block)
|
18
22
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
23
|
+
|
24
|
+
it 'deploys correct logs information on 1 node' do
|
25
|
+
with_test_platform_for_deploy_tests({ nodes: { 'node' => { services: %w[service1 service2] } } }, as_git: true) do
|
26
|
+
with_connections_mocked_on ['node'] do
|
27
|
+
test_actions_executor.connector(:ssh).ssh_user = 'test_user'
|
28
|
+
expect_services_handler_to_deploy('node' => %w[service1 service2])
|
29
|
+
expect_actions_executor_runs [
|
30
|
+
# First run, we expect the mutex to be setup, and the deployment actions to be run
|
31
|
+
proc { |actions_per_nodes| expect_actions_to_deploy_on(actions_per_nodes, 'node') },
|
32
|
+
# Second run, we expect the mutex to be released
|
33
|
+
proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, 'node') },
|
34
|
+
# Third run, we expect logs to be uploaded on the node
|
35
|
+
proc { |actions_per_nodes| expect(actions_per_nodes).to eq('node' => [{ bash: 'echo Save test logs to node' }]) }
|
36
|
+
]
|
37
|
+
expect(test_deployer.deploy_on('node')).to eq('node' => [0, 'Deploy successful', ''])
|
38
|
+
expect(HybridPlatformsConductorTest::TestLogPlugin.calls).to eq [
|
39
|
+
{
|
40
|
+
method: :actions_to_save_logs,
|
41
|
+
node: 'node',
|
42
|
+
services: %w[service1 service2],
|
43
|
+
deployment_info: {
|
44
|
+
repo_name_0: 'platform',
|
45
|
+
commit_id_0: '123456',
|
46
|
+
commit_message_0: 'Test commit for node: service1, service2',
|
47
|
+
user: 'test_user'
|
48
|
+
},
|
49
|
+
exit_status: 0,
|
50
|
+
stdout: 'Deploy successful',
|
51
|
+
stderr: ''
|
52
|
+
}
|
53
|
+
]
|
54
|
+
end
|
40
55
|
end
|
41
56
|
end
|
42
|
-
end
|
43
57
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
58
|
+
it 'deploys correct logs information on several nodes' do
|
59
|
+
with_test_platform_for_deploy_tests(
|
60
|
+
{
|
61
|
+
nodes: {
|
62
|
+
'node1' => { services: %w[service1] },
|
63
|
+
'node2' => { services: %w[service2] }
|
64
|
+
}
|
65
|
+
},
|
66
|
+
as_git: true
|
67
|
+
) do
|
68
|
+
with_connections_mocked_on %w[node1 node2] do
|
69
|
+
test_actions_executor.connector(:ssh).ssh_user = 'test_user'
|
70
|
+
expect_services_handler_to_deploy(
|
71
|
+
'node1' => %w[service1],
|
72
|
+
'node2' => %w[service2]
|
73
|
+
)
|
74
|
+
expect_actions_executor_runs [
|
75
|
+
# First run, we expect the mutex to be setup, and the deployment actions to be run
|
76
|
+
proc { |actions_per_nodes| expect_actions_to_deploy_on(actions_per_nodes, %w[node1 node2]) },
|
77
|
+
# Second run, we expect the mutex to be released
|
78
|
+
proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, %w[node1 node2]) },
|
79
|
+
# Third run, we expect logs to be uploaded on the node
|
80
|
+
proc do |actions_per_nodes|
|
81
|
+
expect(actions_per_nodes).to eq(
|
82
|
+
'node1' => [{ bash: 'echo Save test logs to node1' }],
|
83
|
+
'node2' => [{ bash: 'echo Save test logs to node2' }]
|
84
|
+
)
|
85
|
+
end
|
86
|
+
]
|
87
|
+
expect(test_deployer.deploy_on(%w[node1 node2])).to eq(
|
88
|
+
'node1' => [0, 'Deploy successful', ''],
|
89
|
+
'node2' => [0, 'Deploy successful', '']
|
90
|
+
)
|
91
|
+
expect(HybridPlatformsConductorTest::TestLogPlugin.calls).to eq [
|
92
|
+
{
|
93
|
+
method: :actions_to_save_logs,
|
94
|
+
node: 'node1',
|
95
|
+
services: %w[service1],
|
96
|
+
deployment_info: {
|
97
|
+
repo_name_0: 'platform',
|
98
|
+
commit_id_0: '123456',
|
99
|
+
commit_message_0: 'Test commit for node1: service1',
|
100
|
+
user: 'test_user'
|
101
|
+
},
|
102
|
+
exit_status: 0,
|
103
|
+
stdout: 'Deploy successful',
|
104
|
+
stderr: ''
|
105
|
+
},
|
106
|
+
{
|
107
|
+
method: :actions_to_save_logs,
|
108
|
+
node: 'node2',
|
109
|
+
services: %w[service2],
|
110
|
+
deployment_info: {
|
111
|
+
repo_name_0: 'platform',
|
112
|
+
commit_id_0: '123456',
|
113
|
+
commit_message_0: 'Test commit for node2: service2',
|
114
|
+
user: 'test_user'
|
115
|
+
},
|
116
|
+
exit_status: 0,
|
117
|
+
stdout: 'Deploy successful',
|
118
|
+
stderr: ''
|
119
|
+
}
|
120
|
+
]
|
121
|
+
end
|
73
122
|
end
|
74
123
|
end
|
75
|
-
end
|
76
124
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
repo_name_0: 'platform',
|
115
|
-
commit_id_0: '123456',
|
116
|
-
commit_message_0: 'Test commit for node2: service2',
|
117
|
-
services: 'service2',
|
118
|
-
exit_status: '0'
|
119
|
-
)
|
120
|
-
expect_actions_to_upload_logs(actions_per_nodes, %w[node1 node2])
|
121
|
-
end
|
122
|
-
])
|
123
|
-
expect(test_deployer.deploy_on(%w[node1 node2])).to eq(
|
124
|
-
'node1' => [0, 'Deploy successful', ''],
|
125
|
-
'node2' => [0, 'Deploy successful', '']
|
126
|
-
)
|
125
|
+
it 'deploys correct logs information on 1 node even when there is a failing deploy' do
|
126
|
+
with_test_platform_for_deploy_tests({ nodes: { 'node' => { services: %w[service1 service2] } } }, as_git: true) do
|
127
|
+
with_connections_mocked_on ['node'] do
|
128
|
+
test_actions_executor.connector(:ssh).ssh_user = 'test_user'
|
129
|
+
expect_services_handler_to_deploy('node' => %w[service1 service2])
|
130
|
+
expect_actions_executor_runs [
|
131
|
+
# First run, we expect the mutex to be setup, and the deployment actions to be run
|
132
|
+
proc do |actions_per_nodes|
|
133
|
+
expect_actions_to_deploy_on(
|
134
|
+
actions_per_nodes,
|
135
|
+
'node',
|
136
|
+
mocked_result: { 'node' => [:failed_action, 'Failed deploy stdout', 'Failed deploy stderr'] }
|
137
|
+
)
|
138
|
+
end,
|
139
|
+
# Second run, we expect the mutex to be released
|
140
|
+
proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, 'node') },
|
141
|
+
# Third run, we expect logs to be uploaded on the node
|
142
|
+
proc { |actions_per_nodes| expect(actions_per_nodes).to eq('node' => [{ bash: 'echo Save test logs to node' }]) }
|
143
|
+
]
|
144
|
+
expect(test_deployer.deploy_on('node')).to eq('node' => [:failed_action, 'Failed deploy stdout', 'Failed deploy stderr'])
|
145
|
+
expect(HybridPlatformsConductorTest::TestLogPlugin.calls).to eq [
|
146
|
+
{
|
147
|
+
method: :actions_to_save_logs,
|
148
|
+
node: 'node',
|
149
|
+
services: %w[service1 service2],
|
150
|
+
deployment_info: {
|
151
|
+
repo_name_0: 'platform',
|
152
|
+
commit_id_0: '123456',
|
153
|
+
commit_message_0: 'Test commit for node: service1, service2',
|
154
|
+
user: 'test_user'
|
155
|
+
},
|
156
|
+
exit_status: :failed_action,
|
157
|
+
stdout: 'Failed deploy stdout',
|
158
|
+
stderr: 'Failed deploy stderr'
|
159
|
+
}
|
160
|
+
]
|
161
|
+
end
|
127
162
|
end
|
128
163
|
end
|
129
|
-
end
|
130
164
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
expect_services_handler_to_deploy('node' => %w[service1 service2])
|
136
|
-
expect_actions_executor_runs([
|
137
|
-
# First run, we expect the mutex to be setup, and the deployment actions to be run
|
165
|
+
it 'gets deployment info from log plugins' do
|
166
|
+
with_test_platform_for_deploy_tests({ nodes: { 'node' => {} } }) do
|
167
|
+
expect_actions_executor_runs [
|
168
|
+
# Expect the actions to get log files
|
138
169
|
proc do |actions_per_nodes|
|
139
|
-
|
140
|
-
|
141
|
-
'node',
|
142
|
-
mocked_result: { 'node' => [:failed_action, "Failed deploy stdout\n", "Failed deploy stderr\n"] }
|
143
|
-
)
|
144
|
-
end,
|
145
|
-
# Second run, we expect the mutex to be released
|
146
|
-
proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, 'node') },
|
147
|
-
# Third run, we expect logs to be uploaded on the node
|
148
|
-
proc do |actions_per_nodes|
|
149
|
-
# Check logs content
|
150
|
-
local_log_file = actions_per_nodes['node'][:scp].first[0]
|
151
|
-
expect(File.exist?(local_log_file)).to eq true
|
152
|
-
expect_logs_to_be(File.read(local_log_file), "Failed deploy stdout\n", 'Failed deploy stderr',
|
153
|
-
date: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
|
154
|
-
user: 'test_user',
|
155
|
-
debug: 'No',
|
156
|
-
repo_name_0: 'platform',
|
157
|
-
commit_id_0: '123456',
|
158
|
-
commit_message_0: 'Test commit for node: service1, service2',
|
159
|
-
services: 'service1, service2',
|
160
|
-
exit_status: 'failed_action'
|
161
|
-
)
|
162
|
-
expect_actions_to_upload_logs(actions_per_nodes, 'node')
|
170
|
+
expect(actions_per_nodes).to eq('node' => [{ bash: 'echo Read logs for node' }])
|
171
|
+
{ 'node' => [42, 'Log files read stdout', 'Log files read stderr'] }
|
163
172
|
end
|
164
|
-
]
|
165
|
-
expect(test_deployer.
|
173
|
+
]
|
174
|
+
expect(test_deployer.deployment_info_from('node')).to eq(
|
175
|
+
'node' => {
|
176
|
+
deployment_info: { user: 'test_user' },
|
177
|
+
exit_status: 666,
|
178
|
+
services: %w[unknown],
|
179
|
+
stderr: 'Deployment test stderr',
|
180
|
+
stdout: 'Deployment test stdout'
|
181
|
+
}
|
182
|
+
)
|
183
|
+
expect(HybridPlatformsConductorTest::TestLogPlugin.calls).to eq [
|
184
|
+
{
|
185
|
+
method: :actions_to_read_logs,
|
186
|
+
node: 'node'
|
187
|
+
},
|
188
|
+
{
|
189
|
+
method: :logs_for,
|
190
|
+
node: 'node',
|
191
|
+
exit_status: 42,
|
192
|
+
stdout: 'Log files read stdout',
|
193
|
+
stderr: 'Log files read stderr'
|
194
|
+
}
|
195
|
+
]
|
166
196
|
end
|
167
197
|
end
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'gets deployment info from log files' do
|
171
|
-
with_test_platform({ nodes: { 'node' => {} } }) do |repository|
|
172
|
-
expect_actions_executor_runs([
|
173
|
-
# Expect the actions to get log files
|
174
|
-
proc do |actions_per_nodes|
|
175
|
-
expect(actions_per_nodes).to eq('node' => { remote_bash: 'cd /var/log/deployments && ls -t | head -1 | xargs sed \'/===== STDOUT =====/q\'' })
|
176
|
-
{ 'node' => [0, "Property1: Value1\nProperty2: Value2", ''] }
|
177
|
-
end
|
178
|
-
])
|
179
|
-
expect(test_deployer.deployment_info_from('node')).to eq(
|
180
|
-
'node' => {
|
181
|
-
Property1: 'Value1',
|
182
|
-
Property2: 'Value2'
|
183
|
-
}
|
184
|
-
)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'gets deployment info with some properties converted from log files' do
|
189
|
-
with_test_platform({ nodes: { 'node' => {} } }) do |repository|
|
190
|
-
expect_actions_executor_runs([
|
191
|
-
# Expect the actions to get log files
|
192
|
-
proc do |actions_per_nodes|
|
193
|
-
expect(actions_per_nodes).to eq('node' => { remote_bash: 'cd /var/log/deployments && ls -t | head -1 | xargs sed \'/===== STDOUT =====/q\'' })
|
194
|
-
{ 'node' => [0, <<~EOS, ''] }
|
195
|
-
date: Thu Nov 23 18:43:01 UTC 2017
|
196
|
-
debug: Yes
|
197
|
-
diff_files_0: file1, file2, file3
|
198
|
-
services: service1, service2, service3
|
199
|
-
EOS
|
200
|
-
end
|
201
|
-
])
|
202
|
-
expect(test_deployer.deployment_info_from('node')).to eq(
|
203
|
-
'node' => {
|
204
|
-
date: Time.parse('2017-11-23 18:43:01 UTC'),
|
205
|
-
debug: true,
|
206
|
-
diff_files_0: %w[file1 file2 file3],
|
207
|
-
services: %w[service1 service2 service3]
|
208
|
-
}
|
209
|
-
)
|
210
|
-
end
|
211
|
-
end
|
212
198
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
199
|
+
it 'gets deployment info from log plugins not having actions_to_read_logs' do
|
200
|
+
with_test_platform_for_deploy_tests({ nodes: { 'node' => {} } }, additional_config: 'send_logs_to :test_log_no_read') do
|
201
|
+
expect(test_deployer.deployment_info_from('node')).to eq(
|
202
|
+
'node' => {
|
203
|
+
deployment_info: { user: 'test_user' },
|
204
|
+
exit_status: 666,
|
205
|
+
services: %w[unknown],
|
206
|
+
stderr: 'Deployment test stderr',
|
207
|
+
stdout: 'Deployment test stdout'
|
208
|
+
}
|
209
|
+
)
|
210
|
+
expect(HybridPlatformsConductorTest::TestLogNoReadPlugin.calls).to eq [
|
222
211
|
{
|
223
|
-
|
224
|
-
|
212
|
+
method: :logs_for,
|
213
|
+
node: 'node',
|
214
|
+
exit_status: nil,
|
215
|
+
stdout: nil,
|
216
|
+
stderr: nil
|
225
217
|
}
|
226
|
-
|
227
|
-
|
228
|
-
expect(test_deployer.deployment_info_from(%w[node1 node2])).to eq(
|
229
|
-
'node1' => {
|
230
|
-
Property1: 'Value1',
|
231
|
-
Property2: 'Value2'
|
232
|
-
},
|
233
|
-
'node2' => {
|
234
|
-
Property3: 'Value3',
|
235
|
-
Property4: 'Value4'
|
236
|
-
}
|
237
|
-
)
|
218
|
+
]
|
219
|
+
end
|
238
220
|
end
|
221
|
+
|
239
222
|
end
|
240
223
|
|
241
224
|
end
|