hybrid_platforms_conductor 32.17.0 → 33.0.2
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 +4 -4
- data/CHANGELOG.md +36 -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 +46 -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/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/hostname.md +1 -0
- data/docs/plugins/test/ip.md +1 -0
- 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 +4 -3
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
- data/lib/hybrid_platforms_conductor/config.rb +8 -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/cleanroom/fix_kwargs.rb +116 -0
- 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 +2 -3
- 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 +18 -11
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +32 -21
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +75 -49
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +27 -15
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +90 -59
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +46 -44
- 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 +106 -75
- 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 +167 -142
- 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 +16 -16
- 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 +5 -5
- 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 +195 -144
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -916
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::NodesHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking config DSL' do
|
|
3
|
+
context 'when checking config DSL' do
|
|
4
4
|
|
|
5
5
|
it 'adds helpers for master cmdbs' do
|
|
6
6
|
with_test_platform(
|
|
@@ -11,30 +11,29 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
11
11
|
'node3' => {}
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
'
|
|
14
|
+
additional_config: <<~'EO_CONFIG'
|
|
16
15
|
master_cmdbs(
|
|
17
|
-
test_cmdb: :
|
|
18
|
-
|
|
16
|
+
test_cmdb: :property_1,
|
|
17
|
+
test_cmdb_2: :property_2
|
|
19
18
|
)
|
|
20
|
-
for_nodes(
|
|
21
|
-
master_cmdbs(test_cmdb: :
|
|
19
|
+
for_nodes('node2') do
|
|
20
|
+
master_cmdbs(test_cmdb: :property_3)
|
|
22
21
|
end
|
|
23
|
-
|
|
22
|
+
EO_CONFIG
|
|
24
23
|
) do
|
|
25
|
-
register_test_cmdb(%i[test_cmdb
|
|
24
|
+
register_test_cmdb(%i[test_cmdb test_cmdb_2])
|
|
26
25
|
expect(test_config.cmdb_masters).to eq [
|
|
27
26
|
{
|
|
28
27
|
nodes_selectors_stack: [],
|
|
29
28
|
cmdb_masters: {
|
|
30
|
-
test_cmdb: [:
|
|
31
|
-
|
|
29
|
+
test_cmdb: [:property_1],
|
|
30
|
+
test_cmdb_2: [:property_2]
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
33
|
{
|
|
35
34
|
nodes_selectors_stack: ['node2'],
|
|
36
35
|
cmdb_masters: {
|
|
37
|
-
test_cmdb: [:
|
|
36
|
+
test_cmdb: [:property_3]
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
]
|
|
@@ -50,13 +49,12 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
50
49
|
'node3' => {}
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
|
-
|
|
54
|
-
'
|
|
52
|
+
additional_config: <<~'EO_CONFIG'
|
|
55
53
|
sudo_for { |user| "alt_sudo1 -p #{user}" }
|
|
56
|
-
for_nodes(
|
|
54
|
+
for_nodes('node2') do
|
|
57
55
|
sudo_for { |user| "alt_sudo2 -q #{user}" }
|
|
58
56
|
end
|
|
59
|
-
|
|
57
|
+
EO_CONFIG
|
|
60
58
|
) do
|
|
61
59
|
expect(test_config.sudo_procs.size).to eq 2
|
|
62
60
|
expect(test_config.sudo_procs[0][:nodes_selectors_stack]).to eq []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::NodesHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking computation of impacted nodes by a git diff' do
|
|
3
|
+
context 'when checking computation of impacted nodes by a git diff' do
|
|
4
4
|
|
|
5
5
|
it 'returns all the impacted platform nodes by default' do
|
|
6
6
|
with_test_platforms(
|
|
@@ -8,11 +8,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
8
8
|
'platform_1' => { nodes: { 'node11' => {}, 'node12' => {} } },
|
|
9
9
|
'platform_2' => { nodes: { 'node21' => {}, 'node22' => {} } }
|
|
10
10
|
},
|
|
11
|
-
true
|
|
11
|
+
as_git: true
|
|
12
12
|
) do
|
|
13
|
-
with_cmd_runner_mocked
|
|
14
|
-
[
|
|
15
|
-
]
|
|
13
|
+
with_cmd_runner_mocked [
|
|
14
|
+
[%r{cd .+/platform_2 && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
15
|
+
] do
|
|
16
16
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('platform_2')).to eq [
|
|
17
17
|
%w[node21 node22].sort,
|
|
18
18
|
[],
|
|
@@ -24,42 +24,42 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it 'diffs from another commit if asked' do
|
|
27
|
-
with_test_platform({}, true) do
|
|
28
|
-
with_cmd_runner_mocked
|
|
29
|
-
[
|
|
30
|
-
]
|
|
27
|
+
with_test_platform({}, as_git: true) do
|
|
28
|
+
with_cmd_runner_mocked [
|
|
29
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color from_branch}, proc { [0, '', ''] }]
|
|
30
|
+
] do
|
|
31
31
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', from_commit: 'from_branch')).to eq [[], [], [], true]
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it 'fails when the commit id is invalid' do
|
|
37
|
-
with_test_platform({}, true) do
|
|
38
|
-
with_cmd_runner_mocked
|
|
39
|
-
[
|
|
40
|
-
]
|
|
37
|
+
with_test_platform({}, as_git: true) do
|
|
38
|
+
with_cmd_runner_mocked [
|
|
39
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color invalid_id}, proc { raise HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Mocked git error due to an invalid commit id' }]
|
|
40
|
+
] do
|
|
41
41
|
expect { test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', from_commit: 'invalid_id') }.to raise_error HybridPlatformsConductor::NodesHandler::GitError, 'Mocked git error due to an invalid commit id'
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it 'diffs to another commit if asked' do
|
|
47
|
-
with_test_platform({}, true) do
|
|
48
|
-
with_cmd_runner_mocked
|
|
49
|
-
[
|
|
50
|
-
]
|
|
47
|
+
with_test_platform({}, as_git: true) do
|
|
48
|
+
with_cmd_runner_mocked [
|
|
49
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master to_branch}, proc { [0, '', ''] }]
|
|
50
|
+
] do
|
|
51
51
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', to_commit: 'to_branch')).to eq [[], [], [], true]
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
it 'gives the platform handler the correct git diff result' do
|
|
57
|
-
with_test_platform({}, true) do
|
|
58
|
-
with_cmd_runner_mocked
|
|
59
|
-
[
|
|
57
|
+
with_test_platform({}, as_git: true) do
|
|
58
|
+
with_cmd_runner_mocked [
|
|
59
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc do
|
|
60
60
|
[
|
|
61
61
|
0,
|
|
62
|
-
<<~
|
|
62
|
+
<<~EO_STDOUT,
|
|
63
63
|
diff --git a/Gemfile b/Gemfile
|
|
64
64
|
index d65e2a6..cb9a38e 100644
|
|
65
65
|
--- a/Gemfile
|
|
@@ -83,15 +83,15 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
83
83
|
+ '--nodes-git-impact GIT_IMPACT',
|
|
84
84
|
nodes_selectors << node
|
|
85
85
|
end
|
|
86
|
-
|
|
86
|
+
EO_STDOUT
|
|
87
87
|
''
|
|
88
88
|
]
|
|
89
89
|
end]
|
|
90
|
-
]
|
|
90
|
+
] do
|
|
91
91
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [[], [], [], true]
|
|
92
92
|
expect(test_platforms_handler.platform('my_remote_platform').files_diffs).to eq(
|
|
93
93
|
'Gemfile' => {
|
|
94
|
-
diff: <<~
|
|
94
|
+
diff: <<~EO_STDOUT.strip
|
|
95
95
|
index d65e2a6..cb9a38e 100644
|
|
96
96
|
--- a/Gemfile
|
|
97
97
|
+++ b/Gemfile
|
|
@@ -102,11 +102,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
102
102
|
+
|
|
103
103
|
+gem 'byebug'
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
EO_STDOUT
|
|
106
106
|
},
|
|
107
107
|
'lib/hybrid_platforms_conductor/nodes_handler.rb' => {
|
|
108
108
|
moved_to: 'lib/stale/hybrid_platforms_conductor/nodes_handler.rb',
|
|
109
|
-
diff: <<~
|
|
109
|
+
diff: <<~EO_STDOUT.strip
|
|
110
110
|
index e8e1778..69a84bd 100644
|
|
111
111
|
--- a/lib/hybrid_platforms_conductor/nodes_handler.rb
|
|
112
112
|
+++ b/lib/hybrid_platforms_conductor/nodes_handler.rb
|
|
@@ -118,7 +118,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
118
118
|
+ '--nodes-git-impact GIT_IMPACT',
|
|
119
119
|
nodes_selectors << node
|
|
120
120
|
end
|
|
121
|
-
|
|
121
|
+
EO_STDOUT
|
|
122
122
|
}
|
|
123
123
|
)
|
|
124
124
|
end
|
|
@@ -134,11 +134,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
134
134
|
impacted_nodes: %w[node1 node3]
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
true
|
|
137
|
+
as_git: true
|
|
138
138
|
) do
|
|
139
|
-
with_cmd_runner_mocked
|
|
140
|
-
[
|
|
141
|
-
]
|
|
139
|
+
with_cmd_runner_mocked [
|
|
140
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
141
|
+
] do
|
|
142
142
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
|
143
143
|
%w[node1 node3],
|
|
144
144
|
%w[node1 node3],
|
|
@@ -162,11 +162,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
162
162
|
impacted_services: %w[service1 service3]
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
|
-
true
|
|
165
|
+
as_git: true
|
|
166
166
|
) do
|
|
167
|
-
with_cmd_runner_mocked
|
|
168
|
-
[
|
|
169
|
-
]
|
|
167
|
+
with_cmd_runner_mocked [
|
|
168
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
169
|
+
] do
|
|
170
170
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
|
171
171
|
%w[node1 node2],
|
|
172
172
|
[],
|
|
@@ -190,11 +190,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
190
190
|
impacted_global: true
|
|
191
191
|
}
|
|
192
192
|
},
|
|
193
|
-
true
|
|
193
|
+
as_git: true
|
|
194
194
|
) do
|
|
195
|
-
with_cmd_runner_mocked
|
|
196
|
-
[
|
|
197
|
-
]
|
|
195
|
+
with_cmd_runner_mocked [
|
|
196
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
197
|
+
] do
|
|
198
198
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
|
199
199
|
%w[node1 node2 node3],
|
|
200
200
|
[],
|
|
@@ -205,30 +205,6 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
205
205
|
end
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
-
it 'returns the impacted nodes given by the platform handler' do
|
|
209
|
-
with_test_platforms(
|
|
210
|
-
{
|
|
211
|
-
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
|
212
|
-
'my_remote_platform' => {
|
|
213
|
-
nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} },
|
|
214
|
-
impacted_nodes: %w[node1 node3]
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
true
|
|
218
|
-
) do
|
|
219
|
-
with_cmd_runner_mocked([
|
|
220
|
-
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
|
221
|
-
]) do
|
|
222
|
-
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
|
223
|
-
%w[node1 node3],
|
|
224
|
-
%w[node1 node3],
|
|
225
|
-
[],
|
|
226
|
-
false
|
|
227
|
-
]
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
end
|
|
231
|
-
|
|
232
208
|
it 'returns both impacted services and nodes given by the platform handler' do
|
|
233
209
|
with_test_platforms(
|
|
234
210
|
{
|
|
@@ -244,11 +220,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
244
220
|
impacted_services: %w[service1 service3]
|
|
245
221
|
}
|
|
246
222
|
},
|
|
247
|
-
true
|
|
223
|
+
as_git: true
|
|
248
224
|
) do
|
|
249
|
-
with_cmd_runner_mocked
|
|
250
|
-
[
|
|
251
|
-
]
|
|
225
|
+
with_cmd_runner_mocked [
|
|
226
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
227
|
+
] do
|
|
252
228
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
|
253
229
|
%w[node1 node2 node4],
|
|
254
230
|
%w[node4],
|
|
@@ -276,11 +252,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
276
252
|
impacted_services: %w[service2 service3]
|
|
277
253
|
}
|
|
278
254
|
},
|
|
279
|
-
true
|
|
255
|
+
as_git: true
|
|
280
256
|
) do
|
|
281
|
-
with_cmd_runner_mocked
|
|
282
|
-
[
|
|
283
|
-
]
|
|
257
|
+
with_cmd_runner_mocked [
|
|
258
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
259
|
+
] do
|
|
284
260
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
|
285
261
|
%w[node1 node2 node3 node4 node5 node6],
|
|
286
262
|
[],
|
|
@@ -308,11 +284,11 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
308
284
|
impacted_services: %w[service2 service3]
|
|
309
285
|
}
|
|
310
286
|
},
|
|
311
|
-
true
|
|
287
|
+
as_git: true
|
|
312
288
|
) do
|
|
313
|
-
with_cmd_runner_mocked
|
|
314
|
-
[
|
|
315
|
-
]
|
|
289
|
+
with_cmd_runner_mocked [
|
|
290
|
+
[%r{cd .+/my_remote_platform && git --no-pager diff --no-color master}, proc { [0, '', ''] }]
|
|
291
|
+
] do
|
|
316
292
|
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', smallest_set: true)).to eq [
|
|
317
293
|
%w[node1 node2],
|
|
318
294
|
[],
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::NodesHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking nodes selection capabilities' do
|
|
3
|
+
context 'when checking nodes selection capabilities' do
|
|
4
4
|
|
|
5
5
|
# Set the test environment with a given list of nodes for our tests
|
|
6
6
|
#
|
|
7
7
|
# Parameters::
|
|
8
|
-
# * Proc: Code called when environment is ready
|
|
9
|
-
def with_test_platform_for_nodes
|
|
8
|
+
# * *block* (Proc): Code called when environment is ready
|
|
9
|
+
def with_test_platform_for_nodes(&block)
|
|
10
10
|
with_test_platforms(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
{
|
|
12
|
+
'platform1' => {
|
|
13
|
+
nodes: { 'node1' => {}, 'node2' => { services: ['service1'] }, 'node3' => { services: ['service2'] } },
|
|
14
|
+
nodes_lists: { 'nodeslist1' => %w[node1 node3], 'nodeslist2' => ['/node[12]/'] }
|
|
15
|
+
},
|
|
16
|
+
'platform2' => {
|
|
17
|
+
nodes: { 'node4' => {}, 'node5' => { services: %w[service3 service1] }, 'node6' => {} }
|
|
18
|
+
}
|
|
14
19
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
) do
|
|
19
|
-
yield
|
|
20
|
-
end
|
|
20
|
+
&block
|
|
21
|
+
)
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
# List all tests of nodes selectors, and the corresponding nodes list they should be resolved into
|
|
@@ -50,7 +51,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
50
51
|
|
|
51
52
|
it 'ignore unknown nodes when asked' do
|
|
52
53
|
with_test_platform_for_nodes do
|
|
53
|
-
expect(test_nodes_handler.select_nodes([
|
|
54
|
+
expect(test_nodes_handler.select_nodes(%w[node1 node7], ignore_unknowns: true).sort).to eq %w[node1 node7].sort
|
|
54
55
|
end
|
|
55
56
|
end
|
|
56
57
|
|
|
@@ -61,7 +62,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
61
62
|
from_commit: 'master',
|
|
62
63
|
to_commit: nil,
|
|
63
64
|
smallest_set: false
|
|
64
|
-
)
|
|
65
|
+
).and_return [%w[node4 node6], [], [], false]
|
|
65
66
|
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2' } }]).sort).to eq %w[node4 node6].sort
|
|
66
67
|
end
|
|
67
68
|
end
|
|
@@ -73,7 +74,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
73
74
|
from_commit: 'from_commit',
|
|
74
75
|
to_commit: nil,
|
|
75
76
|
smallest_set: false
|
|
76
|
-
)
|
|
77
|
+
).and_return [%w[node4 node6], [], [], false]
|
|
77
78
|
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2', from_commit: 'from_commit' } }]).sort).to eq %w[node4 node6].sort
|
|
78
79
|
end
|
|
79
80
|
end
|
|
@@ -85,7 +86,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
85
86
|
from_commit: 'master',
|
|
86
87
|
to_commit: 'to_commit',
|
|
87
88
|
smallest_set: false
|
|
88
|
-
)
|
|
89
|
+
).and_return [%w[node4 node6], [], [], false]
|
|
89
90
|
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2', to_commit: 'to_commit' } }]).sort).to eq %w[node4 node6].sort
|
|
90
91
|
end
|
|
91
92
|
end
|
|
@@ -97,7 +98,7 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
97
98
|
from_commit: 'master',
|
|
98
99
|
to_commit: nil,
|
|
99
100
|
smallest_set: true
|
|
100
|
-
)
|
|
101
|
+
).and_return [%w[node4 node6], [], [], false]
|
|
101
102
|
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2', smallest_set: true } }]).sort).to eq %w[node4 node6].sort
|
|
102
103
|
end
|
|
103
104
|
end
|
|
@@ -110,20 +111,28 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
110
111
|
|
|
111
112
|
it 'considers nodes selector intersection in a nodes selector stack' do
|
|
112
113
|
with_test_platform_for_nodes do
|
|
113
|
-
expect(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
expect(
|
|
115
|
+
test_nodes_handler.select_from_nodes_selector_stack(
|
|
116
|
+
[
|
|
117
|
+
%w[node1 node2 node3],
|
|
118
|
+
%w[node2 node3 node4]
|
|
119
|
+
]
|
|
120
|
+
).sort
|
|
121
|
+
).to eq %w[node2 node3].sort
|
|
117
122
|
end
|
|
118
123
|
end
|
|
119
124
|
|
|
120
125
|
it 'considers nodes selector intersection between different kind of selectors in a nodes selector stack' do
|
|
121
126
|
with_test_platform_for_nodes do
|
|
122
|
-
expect(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
expect(
|
|
128
|
+
test_nodes_handler.select_from_nodes_selector_stack(
|
|
129
|
+
[
|
|
130
|
+
'/node[1256]/',
|
|
131
|
+
[{ platform: 'platform2' }],
|
|
132
|
+
[{ service: 'service1' }]
|
|
133
|
+
]
|
|
134
|
+
).sort
|
|
135
|
+
).to eq %w[node5].sort
|
|
127
136
|
end
|
|
128
137
|
end
|
|
129
138
|
|
data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::NodesHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking Platform Handlers plugins\' API called by NodesHandler' do
|
|
3
|
+
context 'when checking Platform Handlers plugins\' API called by NodesHandler' do
|
|
4
4
|
|
|
5
5
|
it 'returns nodes' do
|
|
6
|
-
with_test_platform(nodes: { 'node1' => {}, 'node2' => {} }) do
|
|
6
|
+
with_test_platform({ nodes: { 'node1' => {}, 'node2' => {} } }) do
|
|
7
7
|
expect(test_nodes_handler.known_nodes.sort).to eq %w[node1 node2].sort
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
it 'returns nodes lists' do
|
|
12
|
-
with_test_platform(nodes_lists: { 'test_nodes_list' => [] }) do
|
|
12
|
+
with_test_platform({ nodes_lists: { 'test_nodes_list' => [] } }) do
|
|
13
13
|
expect(test_nodes_handler.known_nodes_lists).to eq ['test_nodes_list']
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it 'returns nodes defined in a nodes lists' do
|
|
18
18
|
with_test_platform(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
{
|
|
20
|
+
nodes: { 'node1' => {}, 'node2' => {} },
|
|
21
|
+
nodes_lists: { 'test_nodes_list' => %w[node1 node2] }
|
|
22
|
+
}
|
|
21
23
|
) do
|
|
22
24
|
expect(test_nodes_handler.nodes_from_list('test_nodes_list').sort).to eq %w[node1 node2].sort
|
|
23
25
|
end
|
|
@@ -25,13 +27,15 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
25
27
|
|
|
26
28
|
it 'returns nodes selectors defined in a nodes lists' do
|
|
27
29
|
with_test_platform(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
{
|
|
31
|
+
nodes: {
|
|
32
|
+
'node10' => { services: ['test_service'] },
|
|
33
|
+
'node11' => { services: ['test_service_2'] },
|
|
34
|
+
'node20' => { services: %w[test_service_3 test_service] },
|
|
35
|
+
'node21' => { services: ['test_service_2'] }
|
|
36
|
+
},
|
|
37
|
+
nodes_lists: { 'test_nodes_list' => ['/node1.+/', { service: 'test_service' }] }
|
|
38
|
+
}
|
|
35
39
|
) do
|
|
36
40
|
expect(test_nodes_handler.nodes_from_list('test_nodes_list').sort).to eq %w[node10 node11 node20].sort
|
|
37
41
|
end
|
|
@@ -39,8 +43,10 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
39
43
|
|
|
40
44
|
it 'returns nodes defined in a nodes lists while ignoring unknown ones' do
|
|
41
45
|
with_test_platform(
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
{
|
|
47
|
+
nodes: { 'node1' => {} },
|
|
48
|
+
nodes_lists: { 'test_nodes_list' => %w[node1 node2] }
|
|
49
|
+
}
|
|
44
50
|
) do
|
|
45
51
|
expect(test_nodes_handler.nodes_from_list('test_nodes_list', ignore_unknowns: true).sort).to eq %w[node1 node2].sort
|
|
46
52
|
end
|
|
@@ -48,8 +54,10 @@ describe HybridPlatformsConductor::NodesHandler do
|
|
|
48
54
|
|
|
49
55
|
it 'fails when returning unknown nodes defined in a nodes lists' do
|
|
50
56
|
with_test_platform(
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
{
|
|
58
|
+
nodes: { 'node1' => {} },
|
|
59
|
+
nodes_lists: { 'test_nodes_list' => %w[node1 node2] }
|
|
60
|
+
}
|
|
53
61
|
) do
|
|
54
62
|
expect { test_nodes_handler.nodes_from_list('test_nodes_list') }.to raise_error(RuntimeError, 'Unknown nodes: node2')
|
|
55
63
|
end
|