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
data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef do
|
|
2
2
|
|
|
3
|
-
context 'checking inventory' do
|
|
3
|
+
context 'when checking inventory' do
|
|
4
4
|
|
|
5
5
|
context 'with an empty platform' do
|
|
6
6
|
|
|
@@ -38,10 +38,10 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
38
38
|
description: 'Single test node',
|
|
39
39
|
image: 'debian_9',
|
|
40
40
|
private_ips: ['172.16.0.1'],
|
|
41
|
-
|
|
42
|
-
'
|
|
41
|
+
property_1: {
|
|
42
|
+
'property_11' => 'value11'
|
|
43
43
|
},
|
|
44
|
-
|
|
44
|
+
property_2: 'value2'
|
|
45
45
|
)
|
|
46
46
|
end
|
|
47
47
|
end
|
data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef do
|
|
2
2
|
|
|
3
|
-
context 'checking services packaging' do
|
|
3
|
+
context 'when checking services packaging' do
|
|
4
4
|
|
|
5
5
|
# Expect a repository to be packaged and mock it
|
|
6
6
|
#
|
|
@@ -12,7 +12,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
12
12
|
# * *export* (Boolean): Are we expecting the chef export stage? [default: true]
|
|
13
13
|
# * *data_bags* (Boolean): Do we expect data bags copy? [default: false]
|
|
14
14
|
# * *env* (String): Expected environment being packaged [default: 'prod']
|
|
15
|
-
# * Proc: Code called with mock in place
|
|
15
|
+
# * *block* (Proc): Code called with mock in place
|
|
16
16
|
def with_packaging_mocked(
|
|
17
17
|
repository,
|
|
18
18
|
policy: 'test_policy',
|
|
@@ -20,7 +20,8 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
20
20
|
install: true,
|
|
21
21
|
export: true,
|
|
22
22
|
data_bags: false,
|
|
23
|
-
env: 'prod'
|
|
23
|
+
env: 'prod',
|
|
24
|
+
&block
|
|
24
25
|
)
|
|
25
26
|
with_cmd_runner_mocked(
|
|
26
27
|
if install
|
|
@@ -29,11 +30,11 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
29
30
|
"cd #{repository} && /opt/chef-workstation/bin/chef install #{policy_file} --chef-license accept",
|
|
30
31
|
proc do
|
|
31
32
|
# Mock the run_list stored in the lock file
|
|
33
|
+
dsl_parser = HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef::DslParser.new
|
|
34
|
+
dsl_parser.parse("#{repository}/#{policy_file}")
|
|
32
35
|
File.write(
|
|
33
36
|
"#{repository}/#{policy_file.gsub(/.rb$/, '.lock.json')}",
|
|
34
|
-
{
|
|
35
|
-
run_list: eval("[#{File.read("#{repository}/#{policy_file}").split("\n").select { |line| line =~ /^run_list.+$/ }.last.match(/^run_list(.+)$/)[1]}]").flatten
|
|
36
|
-
}.to_json
|
|
37
|
+
{ run_list: dsl_parser.calls.select { |call| call[:method] == :run_list }.last[:args].flatten }.to_json
|
|
37
38
|
)
|
|
38
39
|
[0, 'Chef install done', '']
|
|
39
40
|
end
|
|
@@ -46,7 +47,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
46
47
|
[
|
|
47
48
|
['whoami', proc { [0, 'test_user', ''] }, { optional: true }],
|
|
48
49
|
[
|
|
49
|
-
|
|
50
|
+
%r{^cd #{Regexp.escape(repository)} &&\s+sudo rm -rf dist/#{Regexp.escape(env)}/#{Regexp.escape(policy)} &&\s+/opt/chef-workstation/bin/chef export #{Regexp.escape(policy_file)} dist/#{Regexp.escape(env)}/#{Regexp.escape(policy)} --chef-license accept#{data_bags ? " && cp -ar data_bags/ dist/#{Regexp.escape(env)}/#{Regexp.escape(policy)}/" : ''}$},
|
|
50
51
|
proc do
|
|
51
52
|
FileUtils.mkdir_p "#{repository}/dist/#{env}/#{policy}"
|
|
52
53
|
FileUtils.cp_r("#{repository}/data_bags", "#{repository}/dist/#{env}/#{policy}/") if data_bags
|
|
@@ -56,16 +57,15 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
56
57
|
]
|
|
57
58
|
else
|
|
58
59
|
[]
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
end
|
|
60
|
+
end,
|
|
61
|
+
&block
|
|
62
|
+
)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
context 'with an empty platform' do
|
|
66
66
|
|
|
67
67
|
it 'packages the repository doing nothing' do
|
|
68
|
-
with_serverless_chef_platforms('empty') do |platform
|
|
68
|
+
with_serverless_chef_platforms('empty') do |platform|
|
|
69
69
|
with_cmd_runner_mocked([]) do
|
|
70
70
|
platform.package(services: {}, secrets: {}, local_environment: false)
|
|
71
71
|
end
|
|
@@ -118,15 +118,6 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
-
it 'packages the repository without resolving dependencies when the lock file already exists' do
|
|
122
|
-
with_serverless_chef_platforms('1_node') do |platform, repository|
|
|
123
|
-
File.write("#{repository}/policyfiles/test_policy.lock.json", '{}')
|
|
124
|
-
with_packaging_mocked(repository, install: false) do
|
|
125
|
-
platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: false)
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
121
|
it 'does not package the repository twice for the same config' do
|
|
131
122
|
with_serverless_chef_platforms('1_node', as_git: true) do |platform, repository|
|
|
132
123
|
with_packaging_mocked(repository) do
|
|
@@ -184,7 +175,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
184
175
|
# Wait 2 seconds so that we are sure the modified file will return a different timestamp
|
|
185
176
|
sleep 2
|
|
186
177
|
with_packaging_mocked(repository, install: false) do
|
|
187
|
-
File.write("#{repository}/chef_versions.yml", File.read("#{repository}/chef_versions.yml")
|
|
178
|
+
File.write("#{repository}/chef_versions.yml", "#{File.read("#{repository}/chef_versions.yml")}\n\n")
|
|
188
179
|
platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: false)
|
|
189
180
|
end
|
|
190
181
|
end
|
|
@@ -247,11 +238,13 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
247
238
|
platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
|
|
248
239
|
local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
|
|
249
240
|
expect(File.exist?(local_policy_file)).to eq true
|
|
250
|
-
expect(JSON.parse(File.read(local_policy_file))).to eq(
|
|
251
|
-
'
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
241
|
+
expect(JSON.parse(File.read(local_policy_file))).to eq(
|
|
242
|
+
'run_list' => [
|
|
243
|
+
'hpc_test::before_run',
|
|
244
|
+
'recipe[test_cookbook]',
|
|
245
|
+
'hpc_test::after_run'
|
|
246
|
+
]
|
|
247
|
+
)
|
|
255
248
|
end
|
|
256
249
|
end
|
|
257
250
|
end
|
|
@@ -263,10 +256,12 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
263
256
|
platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
|
|
264
257
|
local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
|
|
265
258
|
expect(File.exist?(local_policy_file)).to eq true
|
|
266
|
-
expect(JSON.parse(File.read(local_policy_file))).to eq(
|
|
267
|
-
'
|
|
268
|
-
|
|
269
|
-
|
|
259
|
+
expect(JSON.parse(File.read(local_policy_file))).to eq(
|
|
260
|
+
'run_list' => [
|
|
261
|
+
'hpc_test::before_run',
|
|
262
|
+
'recipe[test_cookbook]'
|
|
263
|
+
]
|
|
264
|
+
)
|
|
270
265
|
end
|
|
271
266
|
end
|
|
272
267
|
end
|
|
@@ -278,10 +273,12 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
278
273
|
platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
|
|
279
274
|
local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
|
|
280
275
|
expect(File.exist?(local_policy_file)).to eq true
|
|
281
|
-
expect(JSON.parse(File.read(local_policy_file))).to eq(
|
|
282
|
-
'
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
expect(JSON.parse(File.read(local_policy_file))).to eq(
|
|
277
|
+
'run_list' => [
|
|
278
|
+
'recipe[test_cookbook]',
|
|
279
|
+
'hpc_test::after_run'
|
|
280
|
+
]
|
|
281
|
+
)
|
|
285
282
|
end
|
|
286
283
|
end
|
|
287
284
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef do
|
|
2
2
|
|
|
3
|
-
context 'checking services deployment' do
|
|
3
|
+
context 'when checking services deployment' do
|
|
4
4
|
|
|
5
5
|
# Simulate a packaging of a given repository
|
|
6
6
|
#
|
|
@@ -60,7 +60,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
60
60
|
context 'with an empty platform' do
|
|
61
61
|
|
|
62
62
|
it 'prepares for deploy' do
|
|
63
|
-
with_serverless_chef_platforms('empty') do |platform
|
|
63
|
+
with_serverless_chef_platforms('empty') do |platform|
|
|
64
64
|
platform.prepare_for_deploy(
|
|
65
65
|
services: {},
|
|
66
66
|
secrets: {},
|
|
@@ -71,7 +71,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
it 'prepares for deploy in why-run mode' do
|
|
74
|
-
with_serverless_chef_platforms('empty') do |platform
|
|
74
|
+
with_serverless_chef_platforms('empty') do |platform|
|
|
75
75
|
platform.prepare_for_deploy(
|
|
76
76
|
services: {},
|
|
77
77
|
secrets: {},
|
|
@@ -82,7 +82,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
it 'prepares for deploy in local mode' do
|
|
85
|
-
with_serverless_chef_platforms('empty') do |platform
|
|
85
|
+
with_serverless_chef_platforms('empty') do |platform|
|
|
86
86
|
platform.prepare_for_deploy(
|
|
87
87
|
services: {},
|
|
88
88
|
secrets: {},
|
|
@@ -127,8 +127,8 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
127
127
|
'image' => 'debian_9',
|
|
128
128
|
'new_metadata' => 'new_value',
|
|
129
129
|
'private_ips' => ['172.16.0.1'],
|
|
130
|
-
'
|
|
131
|
-
'
|
|
130
|
+
'property_1' => { 'property_11' => 'value11' },
|
|
131
|
+
'property_2' => 'value2'
|
|
132
132
|
)
|
|
133
133
|
end
|
|
134
134
|
end
|
|
@@ -253,15 +253,15 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
|
|
|
253
253
|
|
|
254
254
|
it 'deploys a service on a node belonging to another platform' do
|
|
255
255
|
with_serverless_chef_platforms({ 'p1' => '1_node', 'p2' => 'several_nodes' }) do |repositories|
|
|
256
|
-
|
|
257
|
-
mock_package(
|
|
258
|
-
|
|
256
|
+
platform_1, repository_1 = repositories.find { |platform, _repository| platform.name == 'p1' }
|
|
257
|
+
mock_package(repository_1)
|
|
258
|
+
platform_1.prepare_for_deploy(
|
|
259
259
|
services: { 'node2' => %w[test_policy_1] },
|
|
260
260
|
secrets: {},
|
|
261
261
|
local_environment: false,
|
|
262
262
|
why_run: false
|
|
263
263
|
)
|
|
264
|
-
expect(
|
|
264
|
+
expect(platform_1.actions_to_deploy_on('node2', 'test_policy_1', use_why_run: false)).to eq expected_actions_to_deploy_chef(repository_1, policy: 'test_policy_1', node: 'node2')
|
|
265
265
|
end
|
|
266
266
|
end
|
|
267
267
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
describe HybridPlatformsConductor::PlatformsHandler do
|
|
2
2
|
|
|
3
|
-
context 'checking config specific DSL' do
|
|
3
|
+
context 'when checking config specific DSL' do
|
|
4
4
|
|
|
5
5
|
it 'returns platform directories along with platform types' do
|
|
6
6
|
with_test_platforms(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
{
|
|
8
|
+
'platform1' => { platform_type: :test },
|
|
9
|
+
'platform2' => { platform_type: :test_2 },
|
|
10
|
+
'platform3' => { platform_type: :test }
|
|
11
|
+
}
|
|
10
12
|
) do |repositories|
|
|
11
|
-
expect(test_config.platform_dirs.keys.sort).to eq %i[test
|
|
13
|
+
expect(test_config.platform_dirs.keys.sort).to eq %i[test test_2].sort
|
|
12
14
|
expect(test_config.platform_dirs[:test].sort).to eq [
|
|
13
15
|
repositories['platform1'],
|
|
14
16
|
repositories['platform3']
|
|
15
17
|
].sort
|
|
16
|
-
expect(test_config.platform_dirs[:
|
|
18
|
+
expect(test_config.platform_dirs[:test_2].sort).to eq [
|
|
17
19
|
repositories['platform2']
|
|
18
20
|
].sort
|
|
19
21
|
end
|
|
@@ -22,35 +24,39 @@ describe HybridPlatformsConductor::PlatformsHandler do
|
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
it 'returns no platform types by default' do
|
|
25
|
-
with_test_platforms do
|
|
27
|
+
with_test_platforms({}) do
|
|
26
28
|
expect(test_platforms_handler.platform_types).to eq({})
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
it 'returns no platform by default' do
|
|
31
|
-
with_test_platforms do
|
|
33
|
+
with_test_platforms({}) do
|
|
32
34
|
expect(test_platforms_handler.known_platforms).to eq []
|
|
33
35
|
end
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
it 'returns defined platform types' do
|
|
37
39
|
with_test_platforms(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
{
|
|
41
|
+
'platform1' => { platform_type: :test },
|
|
42
|
+
'platform2' => { platform_type: :test_2 },
|
|
43
|
+
'platform3' => { platform_type: :test }
|
|
44
|
+
}
|
|
41
45
|
) do
|
|
42
46
|
expect(test_platforms_handler.platform_types).to eq(
|
|
43
47
|
test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test,
|
|
44
|
-
|
|
48
|
+
test_2: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test2
|
|
45
49
|
)
|
|
46
50
|
end
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
it 'returns defined platforms' do
|
|
50
54
|
with_test_platforms(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
{
|
|
56
|
+
'platform1' => { platform_type: :test },
|
|
57
|
+
'platform2' => { platform_type: :test_2 },
|
|
58
|
+
'platform3' => { platform_type: :test }
|
|
59
|
+
}
|
|
54
60
|
) do
|
|
55
61
|
expect(test_platforms_handler.known_platforms.map(&:name).sort).to eq %w[platform1 platform2 platform3].sort
|
|
56
62
|
end
|
|
@@ -61,10 +67,9 @@ describe HybridPlatformsConductor::PlatformsHandler do
|
|
|
61
67
|
with_test_platforms(
|
|
62
68
|
{
|
|
63
69
|
'platform1' => { platform_type: :test },
|
|
64
|
-
'platform2' => { platform_type: :
|
|
70
|
+
'platform2' => { platform_type: :test_2 }
|
|
65
71
|
},
|
|
66
|
-
|
|
67
|
-
"test2_platform path: \'#{repository}\'"
|
|
72
|
+
additional_config: "test_2_platform path: \'#{repository}\'"
|
|
68
73
|
) do
|
|
69
74
|
expect { test_platforms_handler.known_platforms }.to raise_error 'Platform name platform1 is declared several times.'
|
|
70
75
|
end
|
|
@@ -73,9 +78,11 @@ describe HybridPlatformsConductor::PlatformsHandler do
|
|
|
73
78
|
|
|
74
79
|
it 'returns defined platforms filtered by platform type' do
|
|
75
80
|
with_test_platforms(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
{
|
|
82
|
+
'platform1' => { platform_type: :test },
|
|
83
|
+
'platform2' => { platform_type: :test_2 },
|
|
84
|
+
'platform3' => { platform_type: :test }
|
|
85
|
+
}
|
|
79
86
|
) do
|
|
80
87
|
expect(test_platforms_handler.known_platforms(platform_type: :test).map(&:name).sort).to eq %w[platform1 platform3].sort
|
|
81
88
|
end
|
|
@@ -83,9 +90,11 @@ describe HybridPlatformsConductor::PlatformsHandler do
|
|
|
83
90
|
|
|
84
91
|
it 'selects a platform based on its name' do
|
|
85
92
|
with_test_platforms(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
{
|
|
94
|
+
'platform1' => { platform_type: :test },
|
|
95
|
+
'platform2' => { platform_type: :test_2 },
|
|
96
|
+
'platform3' => { platform_type: :test }
|
|
97
|
+
}
|
|
89
98
|
) do
|
|
90
99
|
expect(test_platforms_handler.platform('platform2').name).to eq 'platform2'
|
|
91
100
|
end
|
|
@@ -93,9 +102,11 @@ describe HybridPlatformsConductor::PlatformsHandler do
|
|
|
93
102
|
|
|
94
103
|
it 'selects nil for an unknown platform name' do
|
|
95
104
|
with_test_platforms(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
{
|
|
106
|
+
'platform1' => { platform_type: :test },
|
|
107
|
+
'platform2' => { platform_type: :test_2 },
|
|
108
|
+
'platform3' => { platform_type: :test }
|
|
109
|
+
}
|
|
99
110
|
) do
|
|
100
111
|
expect(test_platforms_handler.platform('platform4')).to eq nil
|
|
101
112
|
end
|
|
@@ -44,7 +44,7 @@ module HybridPlatformsConductorTest
|
|
|
44
44
|
#
|
|
45
45
|
# Parameters::
|
|
46
46
|
# * *value* (Integer): Value to be set
|
|
47
|
-
def
|
|
47
|
+
def config_my_property(value)
|
|
48
48
|
@my_property = value * 2
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -69,7 +69,7 @@ module HybridPlatformsConductorTest
|
|
|
69
69
|
#
|
|
70
70
|
# Parameters::
|
|
71
71
|
# * *value* (Integer): Value to be set
|
|
72
|
-
def
|
|
72
|
+
def config_my_other_property(value)
|
|
73
73
|
@my_other_property += value
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -84,14 +84,14 @@ end
|
|
|
84
84
|
describe HybridPlatformsConductor::Plugins do
|
|
85
85
|
|
|
86
86
|
it 'returns no plugins by default' do
|
|
87
|
-
with_test_platform do
|
|
88
|
-
expect(
|
|
87
|
+
with_test_platform({}) do
|
|
88
|
+
expect(described_class.new(:test_plugin_type, logger: logger, logger_stderr: logger).keys).to eq []
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
it 'can register a new plugin with a given class' do
|
|
93
|
-
with_test_platform do
|
|
94
|
-
plugins =
|
|
93
|
+
with_test_platform({}) do
|
|
94
|
+
plugins = described_class.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
|
95
95
|
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClass
|
|
96
96
|
expect(plugins.keys).to eq [:new_plugin]
|
|
97
97
|
expect(plugins[:new_plugin]).to eq HybridPlatformsConductorTest::RandomClass
|
|
@@ -99,8 +99,8 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
it 'can register a new plugin with an initializer' do
|
|
102
|
-
with_test_platform do
|
|
103
|
-
plugins =
|
|
102
|
+
with_test_platform({}) do
|
|
103
|
+
plugins = described_class.new(
|
|
104
104
|
:test_plugin_type,
|
|
105
105
|
init_plugin: proc do |plugin_class|
|
|
106
106
|
plugin_class.name
|
|
@@ -115,8 +115,8 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
it 'validates a plugin class before registering it' do
|
|
118
|
-
with_test_platform do
|
|
119
|
-
plugins =
|
|
118
|
+
with_test_platform({}) do
|
|
119
|
+
plugins = described_class.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
|
120
120
|
HybridPlatformsConductorTest::RandomClassWithValidation.validation_done = false
|
|
121
121
|
HybridPlatformsConductorTest::RandomClassWithValidation.validation_result = true
|
|
122
122
|
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClassWithValidation
|
|
@@ -127,8 +127,8 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
it 'does not register a plugin that fails validation' do
|
|
130
|
-
with_test_platform do
|
|
131
|
-
plugins =
|
|
130
|
+
with_test_platform({}) do
|
|
131
|
+
plugins = described_class.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
|
132
132
|
HybridPlatformsConductorTest::RandomClassWithValidation.validation_done = false
|
|
133
133
|
HybridPlatformsConductorTest::RandomClassWithValidation.validation_result = false
|
|
134
134
|
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClassWithValidation
|
|
@@ -138,16 +138,14 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
138
138
|
end
|
|
139
139
|
|
|
140
140
|
it 'discovers automatically plugins of a given type in the hpc_plugins directory of a gem' do
|
|
141
|
-
with_test_platform do
|
|
141
|
+
with_test_platform({}) do
|
|
142
142
|
# Mock the discovery of Ruby gems
|
|
143
143
|
expect(Gem).to receive(:loaded_specs) do
|
|
144
|
-
my_test_gem_spec =
|
|
145
|
-
expect(my_test_gem_spec).to receive(:full_gem_path)
|
|
146
|
-
expect(Dir).to receive(:glob).with('__gem_full_path__/lib/**/*.rb')
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
]
|
|
150
|
-
end
|
|
144
|
+
my_test_gem_spec = instance_double Gem::Specification
|
|
145
|
+
expect(my_test_gem_spec).to receive(:full_gem_path).and_return('__gem_full_path__')
|
|
146
|
+
expect(Dir).to receive(:glob).with('__gem_full_path__/lib/**/*.rb').and_return [
|
|
147
|
+
'__gem_full_path__/lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id_1.rb'
|
|
148
|
+
]
|
|
151
149
|
{
|
|
152
150
|
'my_test_gem' => my_test_gem_spec
|
|
153
151
|
}
|
|
@@ -155,9 +153,9 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
155
153
|
# Alter the load path to mock an extra Rubygem
|
|
156
154
|
$LOAD_PATH.unshift "#{__dir__}/../mocked_lib"
|
|
157
155
|
begin
|
|
158
|
-
plugins =
|
|
159
|
-
expect(plugins.keys).to eq [:
|
|
160
|
-
expect(plugins[:
|
|
156
|
+
plugins = described_class.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
|
157
|
+
expect(plugins.keys).to eq [:test_plugin_id_1]
|
|
158
|
+
expect(plugins[:test_plugin_id_1]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem::HpcPlugins::TestPluginType::TestPluginId1
|
|
161
159
|
ensure
|
|
162
160
|
$LOAD_PATH.shift
|
|
163
161
|
end
|
|
@@ -165,25 +163,21 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
165
163
|
end
|
|
166
164
|
|
|
167
165
|
it 'discovers automatically several plugins of different types in the hpc_plugins directories of several gems' do
|
|
168
|
-
with_test_platform do
|
|
166
|
+
with_test_platform({}) do
|
|
169
167
|
# Mock the discovery of Ruby gems
|
|
170
168
|
expect(Gem).to receive(:loaded_specs).twice do
|
|
171
|
-
my_test_gem_spec =
|
|
172
|
-
expect(my_test_gem_spec).to receive(:full_gem_path)
|
|
173
|
-
expect(Dir).to receive(:glob).with('__gem_full_path__/lib/**/*.rb')
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
'__gem2_full_path__/lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb',
|
|
184
|
-
'__gem2_full_path__/lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb'
|
|
185
|
-
]
|
|
186
|
-
end
|
|
169
|
+
my_test_gem_spec = instance_double Gem::Specification
|
|
170
|
+
expect(my_test_gem_spec).to receive(:full_gem_path).and_return('__gem_full_path__')
|
|
171
|
+
expect(Dir).to receive(:glob).with('__gem_full_path__/lib/**/*.rb').and_return [
|
|
172
|
+
'__gem_full_path__/lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id_1.rb',
|
|
173
|
+
'__gem_full_path__/lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id_2.rb'
|
|
174
|
+
]
|
|
175
|
+
my_test_gem2_spec = instance_double Gem::Specification
|
|
176
|
+
expect(my_test_gem2_spec).to receive(:full_gem_path).and_return('__gem2_full_path__')
|
|
177
|
+
expect(Dir).to receive(:glob).with('__gem2_full_path__/lib/**/*.rb').and_return [
|
|
178
|
+
'__gem2_full_path__/lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id_3.rb',
|
|
179
|
+
'__gem2_full_path__/lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type_2/test_plugin_id_4.rb'
|
|
180
|
+
]
|
|
187
181
|
{
|
|
188
182
|
'my_test_gem' => my_test_gem_spec,
|
|
189
183
|
'my_test_gem2' => my_test_gem2_spec
|
|
@@ -192,14 +186,14 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
192
186
|
# Alter the load path to mock an extra Rubygem
|
|
193
187
|
$LOAD_PATH.unshift "#{__dir__}/../mocked_lib"
|
|
194
188
|
begin
|
|
195
|
-
plugins =
|
|
196
|
-
expect(plugins.keys.sort).to eq %i[
|
|
197
|
-
expect(plugins[:
|
|
198
|
-
expect(plugins[:
|
|
199
|
-
expect(plugins[:
|
|
200
|
-
|
|
201
|
-
expect(
|
|
202
|
-
expect(
|
|
189
|
+
plugins = described_class.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
|
190
|
+
expect(plugins.keys.sort).to eq %i[test_plugin_id_1 test_plugin_id_2 test_plugin_id_3].sort
|
|
191
|
+
expect(plugins[:test_plugin_id_1]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem::HpcPlugins::TestPluginType::TestPluginId1
|
|
192
|
+
expect(plugins[:test_plugin_id_2]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem::HpcPlugins::TestPluginType::TestPluginId2
|
|
193
|
+
expect(plugins[:test_plugin_id_3]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem2::SubDir::HpcPlugins::TestPluginType::TestPluginId3
|
|
194
|
+
plugins_2 = described_class.new(:test_plugin_type_2, logger: logger, logger_stderr: logger)
|
|
195
|
+
expect(plugins_2.keys).to eq [:test_plugin_id_4]
|
|
196
|
+
expect(plugins_2[:test_plugin_id_4]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem2::SubDir::HpcPlugins::TestPluginType2::TestPluginId4
|
|
203
197
|
ensure
|
|
204
198
|
$LOAD_PATH.shift
|
|
205
199
|
end
|
|
@@ -207,10 +201,10 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
207
201
|
end
|
|
208
202
|
|
|
209
203
|
it 'does not discover automatically plugins from gems if asked' do
|
|
210
|
-
with_test_platform do
|
|
204
|
+
with_test_platform({}) do
|
|
211
205
|
# Mock the discovery of Ruby gems
|
|
212
206
|
expect(Gem).not_to receive(:loaded_specs)
|
|
213
|
-
expect(
|
|
207
|
+
expect(described_class.new(:test_plugin_type, parse_gems: false, logger: logger, logger_stderr: logger).keys).to eq []
|
|
214
208
|
end
|
|
215
209
|
end
|
|
216
210
|
|
|
@@ -218,7 +212,7 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
218
212
|
with_repository('platform') do |repository|
|
|
219
213
|
with_platforms("
|
|
220
214
|
test_platform path: '#{repository}'
|
|
221
|
-
|
|
215
|
+
config_my_property 42
|
|
222
216
|
") do
|
|
223
217
|
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
|
224
218
|
self.test_platforms_info = { 'platform' => {} }
|
|
@@ -231,7 +225,7 @@ describe HybridPlatformsConductor::Plugins do
|
|
|
231
225
|
with_repository('platform') do |repository|
|
|
232
226
|
with_platforms("
|
|
233
227
|
test_platform path: '#{repository}'
|
|
234
|
-
|
|
228
|
+
config_my_other_property 66
|
|
235
229
|
") do
|
|
236
230
|
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
|
237
231
|
self.test_platforms_info = { 'platform' => {} }
|