hybrid_platforms_conductor 32.18.0 → 33.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/README.md +3 -3
- data/bin/check-node +0 -1
- data/bin/deploy +0 -1
- data/bin/get_impacted_nodes +0 -1
- data/bin/last_deploys +8 -7
- data/bin/nodes_to_deploy +2 -2
- data/bin/setup +6 -6
- data/bin/topograph +1 -1
- data/docs/config_dsl.md +23 -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/plugins.md +21 -0
- data/docs/plugins/secrets_reader/cli.md +31 -0
- data/docs/plugins/secrets_reader/thycotic.md +46 -0
- data/lib/hybrid_platforms_conductor/action.rb +4 -4
- data/lib/hybrid_platforms_conductor/actions_executor.rb +37 -42
- data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +26 -23
- 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 +185 -127
- 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 +5 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
- data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +6 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +77 -79
- 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 +119 -118
- 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/deploy_freshness.rb +0 -1
- 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 +19 -21
- 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/idempotence.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
- 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 +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +10 -9
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +2 -2
- 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 +4 -6
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +25 -24
- 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 +2 -2
- 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 +1 -1
- 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 +29 -6
- 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 +42 -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 +24 -6
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +34 -26
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +21 -21
- 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 +4 -3
- 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 +13 -15
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +289 -307
- 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 -9
- 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 +216 -14
- 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 +4 -3
- data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +3 -1
- data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +3 -1
- 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 +186 -144
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -916
@@ -16,7 +16,7 @@ module HybridPlatformsConductor
|
|
16
16
|
def self.inherited(subclass)
|
17
17
|
# Make sure we define automatically a helper for such a platform
|
18
18
|
mixin = Module.new
|
19
|
-
platform_type = subclass.name.split('::').last.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase.to_sym
|
19
|
+
platform_type = subclass.name.split('::').last.gsub(/([a-z\d])([A-Z\d])/, '\1_\2').downcase.to_sym
|
20
20
|
mixin.define_method("#{platform_type}_platform".to_sym) do |path: nil, git: nil, branch: 'master', &platform_config_code|
|
21
21
|
repository_path =
|
22
22
|
if !path.nil?
|
@@ -28,7 +28,7 @@ module HybridPlatformsConductor
|
|
28
28
|
branch = "refs/heads/#{branch}" unless branch.include?('/')
|
29
29
|
local_ref = "refs/remotes/origin/#{branch.split('/').last}"
|
30
30
|
section "Cloning #{git} (#{branch} => #{local_ref}) into #{local_repository_path}" do
|
31
|
-
git_repo = Git.init(local_repository_path
|
31
|
+
git_repo = Git.init(local_repository_path)
|
32
32
|
git_repo.add_remote('origin', git).fetch(ref: "#{branch}:#{local_ref}")
|
33
33
|
git_repo.checkout local_ref
|
34
34
|
end
|
@@ -39,7 +39,7 @@ module HybridPlatformsConductor
|
|
39
39
|
end
|
40
40
|
@platform_dirs[platform_type] = [] unless @platform_dirs.key?(platform_type)
|
41
41
|
@platform_dirs[platform_type] << repository_path
|
42
|
-
platform_config_code
|
42
|
+
platform_config_code&.call(repository_path)
|
43
43
|
end
|
44
44
|
# Register this new mixin in the Config DSL
|
45
45
|
extend_config_dsl_with(mixin)
|
@@ -69,8 +69,8 @@ module HybridPlatformsConductor
|
|
69
69
|
def initialize(
|
70
70
|
platform_type,
|
71
71
|
repository_path,
|
72
|
-
logger: Logger.new(
|
73
|
-
logger_stderr: Logger.new(
|
72
|
+
logger: Logger.new($stdout),
|
73
|
+
logger_stderr: Logger.new($stderr),
|
74
74
|
config: Config.new,
|
75
75
|
cmd_runner: CmdRunner.new
|
76
76
|
)
|
@@ -78,7 +78,7 @@ module HybridPlatformsConductor
|
|
78
78
|
@platform_type = platform_type
|
79
79
|
@repository_path = repository_path
|
80
80
|
@cmd_runner = cmd_runner
|
81
|
-
|
81
|
+
init if respond_to?(:init)
|
82
82
|
end
|
83
83
|
|
84
84
|
# Return the name of the platform
|
@@ -100,7 +100,7 @@ module HybridPlatformsConductor
|
|
100
100
|
# * Array<String>: The list of nodes impacted by this diff
|
101
101
|
# * Array<String>: The list of services impacted by this diff
|
102
102
|
# * Boolean: Are there some files that have a global impact (meaning all nodes are potentially impacted by this diff)?
|
103
|
-
def impacts_from(
|
103
|
+
def impacts_from(_files_diffs)
|
104
104
|
# By default, consider all nodes of the platform are impacted by whatever diff.
|
105
105
|
[
|
106
106
|
[],
|
@@ -6,6 +6,7 @@ module HybridPlatformsConductor
|
|
6
6
|
# Provide an API to access information given by Platform Handlers
|
7
7
|
class PlatformsHandler
|
8
8
|
|
9
|
+
# Add some config DSL
|
9
10
|
module ConfigDSLExtension
|
10
11
|
|
11
12
|
# List of platforms repository directories, per platform type
|
@@ -32,8 +33,8 @@ module HybridPlatformsConductor
|
|
32
33
|
# * *config* (Config): Config to be used. [default: Config.new]
|
33
34
|
# * *cmd_runner* (CmdRunner): Command executor to be used. [default: CmdRunner.new]
|
34
35
|
def initialize(
|
35
|
-
logger: Logger.new(
|
36
|
-
logger_stderr: Logger.new(
|
36
|
+
logger: Logger.new($stdout),
|
37
|
+
logger_stderr: Logger.new($stderr),
|
37
38
|
config: Config.new,
|
38
39
|
cmd_runner: CmdRunner.new
|
39
40
|
)
|
@@ -57,6 +58,7 @@ module HybridPlatformsConductor
|
|
57
58
|
)
|
58
59
|
# Check that this platform has unique name
|
59
60
|
raise "Platform name #{platform_handler.name} is declared several times." if @platform_handlers.values.flatten.any? { |known_platform| known_platform.name == platform_handler.name }
|
61
|
+
|
60
62
|
@platform_handlers[platform_type] = [] unless @platform_handlers.key?(platform_type)
|
61
63
|
@platform_handlers[platform_type] << platform_handler
|
62
64
|
end
|
@@ -78,7 +80,7 @@ module HybridPlatformsConductor
|
|
78
80
|
# Result::
|
79
81
|
# * Array<PlatformHandler>: List of platform handlers
|
80
82
|
def known_platforms(platform_type: nil)
|
81
|
-
(platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |
|
83
|
+
(platform_type.nil? ? @platform_handlers.keys : [platform_type]).map { |search_platform_type| (@platform_handlers[search_platform_type] || []) }.flatten
|
82
84
|
end
|
83
85
|
|
84
86
|
# Return the platform handler for a given platform name
|
@@ -40,8 +40,8 @@ module HybridPlatformsConductor
|
|
40
40
|
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
41
41
|
# * *config* (Config): Config to be used. [default: Config.new]
|
42
42
|
def initialize(
|
43
|
-
logger: Logger.new(
|
44
|
-
logger_stderr: Logger.new(
|
43
|
+
logger: Logger.new($stdout),
|
44
|
+
logger_stderr: Logger.new($stderr),
|
45
45
|
config: Config.new
|
46
46
|
)
|
47
47
|
init_loggers(logger, logger_stderr)
|
@@ -22,7 +22,7 @@ module HybridPlatformsConductor
|
|
22
22
|
# * *parse_gems* (Boolean): Do we parse plugins from gems? [default: true]
|
23
23
|
# * *logger* (Logger): Logger to be used [default = Logger.new(STDOUT)]
|
24
24
|
# * *logger_stderr* (Logger): Logger to be used for stderr [default = Logger.new(STDERR)]
|
25
|
-
def initialize(plugins_type, init_plugin: nil, parse_gems: true, logger: Logger.new(
|
25
|
+
def initialize(plugins_type, init_plugin: nil, parse_gems: true, logger: Logger.new($stdout), logger_stderr: Logger.new($stderr))
|
26
26
|
init_loggers(logger, logger_stderr)
|
27
27
|
@plugins_type = plugins_type
|
28
28
|
@init_plugin = init_plugin
|
@@ -37,7 +37,10 @@ module HybridPlatformsConductor
|
|
37
37
|
def_delegators :@plugins, *%i[
|
38
38
|
[]
|
39
39
|
each
|
40
|
+
each_key
|
41
|
+
each_value
|
40
42
|
empty?
|
43
|
+
find
|
41
44
|
key?
|
42
45
|
keys
|
43
46
|
select
|
@@ -71,15 +74,15 @@ module HybridPlatformsConductor
|
|
71
74
|
# Register plugins by parsing gems
|
72
75
|
def register_plugins_from_gems
|
73
76
|
# Require all possible files that could define such a plugin, from all gems
|
74
|
-
files_regexp = /
|
77
|
+
files_regexp = %r{lib/(.*hpc_plugins/#{Regexp.escape(@plugins_type.to_s)}/[^/]+)\.rb$}
|
75
78
|
Gem.loaded_specs.each do |gem_name, gem_specs|
|
76
79
|
# Careful to not use gem_specs.files here as if your gem name contains "-" or other weird characters, files won't appear in the gemspec list.
|
77
80
|
Dir.glob("#{gem_specs.full_gem_path}/lib/**/*.rb").each do |file|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
next unless file =~ files_regexp
|
82
|
+
|
83
|
+
require_name = Regexp.last_match(1)
|
84
|
+
log_debug "[ #{@plugins_type} ] - Require from #{gem_name} file #{require_name}"
|
85
|
+
require require_name
|
83
86
|
end
|
84
87
|
end
|
85
88
|
# Parse the registered classes to search for our plugins
|
@@ -89,10 +92,13 @@ module HybridPlatformsConductor
|
|
89
92
|
# * have been defined by the requires (no unnamed class, as those can be created by clones when using concurrency),
|
90
93
|
# * inherit from the base plugin class,
|
91
94
|
# * have no descendants
|
95
|
+
# Careful: !(class_1 < class_2) != (class_1 >= class_2), so disable the cop here for inversions.
|
96
|
+
# rubocop:disable Style/InverseMethods
|
92
97
|
if !klass.name.nil? && klass < ancestor_class && ObjectSpace.each_object(Class).all? { |other_klass| other_klass.name.nil? || !(other_klass < klass) }
|
93
|
-
plugin_id = klass.name.split('::').last.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase.to_sym
|
98
|
+
plugin_id = klass.name.split('::').last.gsub(/([a-z\d])([A-Z\d])/, '\1_\2').downcase.to_sym
|
94
99
|
self[plugin_id] = klass
|
95
100
|
end
|
101
|
+
# rubocop:enable Style/InverseMethods
|
96
102
|
end
|
97
103
|
end
|
98
104
|
|
@@ -22,8 +22,8 @@ module HybridPlatformsConductor
|
|
22
22
|
def initialize(
|
23
23
|
node,
|
24
24
|
environment: 'production',
|
25
|
-
logger: Logger.new(
|
26
|
-
logger_stderr: Logger.new(
|
25
|
+
logger: Logger.new($stdout),
|
26
|
+
logger_stderr: Logger.new($stderr),
|
27
27
|
config: Config.new,
|
28
28
|
cmd_runner: CmdRunner.new,
|
29
29
|
nodes_handler: NodesHandler.new,
|
@@ -80,7 +80,7 @@ module HybridPlatformsConductor
|
|
80
80
|
@config.ssh_connection_transforms.replace(@config.ssh_connection_transforms.map do |ssh_transform_info|
|
81
81
|
{
|
82
82
|
nodes_selectors_stack: ssh_transform_info[:nodes_selectors_stack].map do |nodes_selector|
|
83
|
-
@nodes_handler.select_nodes(nodes_selector).
|
83
|
+
@nodes_handler.select_nodes(nodes_selector).reject { |selected_node| selected_node == @node }
|
84
84
|
end,
|
85
85
|
transform: ssh_transform_info[:transform]
|
86
86
|
}
|
@@ -154,7 +154,7 @@ module HybridPlatformsConductor
|
|
154
154
|
begin
|
155
155
|
Socket.tcp(instance_ip, port, connect_timeout: remaining_timeout) { true }
|
156
156
|
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL, Errno::ETIMEDOUT
|
157
|
-
log_warn "[ #{@node}/#{@environment} ] - Can't connect to #{instance_ip}:#{port}: #{
|
157
|
+
log_warn "[ #{@node}/#{@environment} ] - Can't connect to #{instance_ip}:#{port}: #{$ERROR_INFO}"
|
158
158
|
false
|
159
159
|
end
|
160
160
|
sleep 1 unless port_listening
|
@@ -15,8 +15,8 @@ module HybridPlatformsConductor
|
|
15
15
|
# * *platforms_handler* (PlatformsHandler): Platforms handler to be used. [default: PlatformsHandler.new]
|
16
16
|
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
17
17
|
def initialize(
|
18
|
-
logger: Logger.new(
|
19
|
-
logger_stderr: Logger.new(
|
18
|
+
logger: Logger.new($stdout),
|
19
|
+
logger_stderr: Logger.new($stderr),
|
20
20
|
config: Config.new,
|
21
21
|
platforms_handler: PlatformsHandler.new,
|
22
22
|
nodes_handler: NodesHandler.new
|
@@ -26,8 +26,8 @@ module HybridPlatformsConductor
|
|
26
26
|
# * *platforms_handler* (PlatformsHandler): Platforms handler to be used. [default = PlatformsHandler.new]
|
27
27
|
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default = NodesHandler.new]
|
28
28
|
def initialize(
|
29
|
-
logger: Logger.new(
|
30
|
-
logger_stderr: Logger.new(
|
29
|
+
logger: Logger.new($stdout),
|
30
|
+
logger_stderr: Logger.new($stderr),
|
31
31
|
config: Config.new,
|
32
32
|
platforms_handler: PlatformsHandler.new,
|
33
33
|
nodes_handler: NodesHandler.new
|
@@ -70,6 +70,7 @@ module HybridPlatformsConductor
|
|
70
70
|
# * *nodes_selectors* (Array<Object>): List of nodes selectors to produce report for
|
71
71
|
def produce_report_for(nodes_selectors)
|
72
72
|
raise "Unknown locale for format #{@format}: #{@locale}" unless @reports_plugins[@format].supported_locales.include? @locale
|
73
|
+
|
73
74
|
@reports_plugins[@format].new(
|
74
75
|
logger: @logger,
|
75
76
|
logger_stderr: @logger_stderr,
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'hybrid_platforms_conductor/logger_helpers'
|
2
|
+
require 'hybrid_platforms_conductor/plugin'
|
3
|
+
|
4
|
+
module HybridPlatformsConductor
|
5
|
+
|
6
|
+
# Ancestor of all secrets reader plugins
|
7
|
+
class SecretsReader < Plugin
|
8
|
+
|
9
|
+
# Constructor
|
10
|
+
#
|
11
|
+
# Parameters::
|
12
|
+
# * *logger* (Logger): Logger to be used [default: Logger.new(STDOUT)]
|
13
|
+
# * *logger_stderr* (Logger): Logger to be used for stderr [default: Logger.new(STDERR)]
|
14
|
+
# * *config* (Config): Config to be used. [default: Config.new]
|
15
|
+
# * *cmd_runner* (CmdRunner): CmdRunner to be used. [default: CmdRunner.new]
|
16
|
+
# * *nodes_handler* (NodesHandler): Nodes handler to be used. [default: NodesHandler.new]
|
17
|
+
def initialize(
|
18
|
+
logger: Logger.new($stdout),
|
19
|
+
logger_stderr: Logger.new($stderr),
|
20
|
+
config: Config.new,
|
21
|
+
cmd_runner: CmdRunner.new,
|
22
|
+
nodes_handler: NodesHandler.new
|
23
|
+
)
|
24
|
+
super(logger: logger, logger_stderr: logger_stderr, config: config)
|
25
|
+
@cmd_runner = cmd_runner
|
26
|
+
@nodes_handler = nodes_handler
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -21,7 +21,8 @@ module HybridPlatformsConductor
|
|
21
21
|
|
22
22
|
@packaged_deployments = []
|
23
23
|
|
24
|
-
include
|
24
|
+
include ParallelThreads
|
25
|
+
include LoggerHelpers
|
25
26
|
|
26
27
|
# Constructor
|
27
28
|
#
|
@@ -34,8 +35,8 @@ module HybridPlatformsConductor
|
|
34
35
|
# * *nodes_handler* (NodesHandler): Nodes Handler to be used. [default: NodesHandler.new]
|
35
36
|
# * *actions_executor* (ActionsExecutor): Actions Executor to be used. [default: ActionsExecutor.new]
|
36
37
|
def initialize(
|
37
|
-
logger: Logger.new(
|
38
|
-
logger_stderr: Logger.new(
|
38
|
+
logger: Logger.new($stdout),
|
39
|
+
logger_stderr: Logger.new($stderr),
|
39
40
|
config: Config.new,
|
40
41
|
cmd_runner: CmdRunner.new,
|
41
42
|
platforms_handler: PlatformsHandler.new,
|
@@ -56,13 +57,11 @@ module HybridPlatformsConductor
|
|
56
57
|
#
|
57
58
|
# Parameters::
|
58
59
|
# * *services* (Hash< String, Array<String> >): Services to be deployed, per node
|
59
|
-
# * *secrets* (Hash): Secrets to be used for deployment
|
60
60
|
# * *local_environment* (Boolean): Are we deploying to a local environment?
|
61
61
|
# Result::
|
62
62
|
# * String or nil: Reason for which we are not allowed to deploy, or nil if deployment is authorized
|
63
63
|
def deploy_allowed?(
|
64
64
|
services:,
|
65
|
-
secrets:,
|
66
65
|
local_environment:
|
67
66
|
)
|
68
67
|
if local_environment
|
@@ -83,7 +82,7 @@ module HybridPlatformsConductor
|
|
83
82
|
head_commit_id = git.log.first.sha
|
84
83
|
git.branches.all? do |branch|
|
85
84
|
branch.gcommit.objectish.include?(' -> ') || (
|
86
|
-
!(branch.full == 'master' || branch.full =~
|
85
|
+
!(branch.full == 'master' || branch.full =~ %r{^remotes/.+/master$}) || branch.gcommit.sha != head_commit_id
|
87
86
|
)
|
88
87
|
end
|
89
88
|
end
|
@@ -108,25 +107,25 @@ module HybridPlatformsConductor
|
|
108
107
|
local_environment:
|
109
108
|
)
|
110
109
|
platforms_for(services).each do |platform, platform_services|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
110
|
+
next unless platform.respond_to?(:package)
|
111
|
+
|
112
|
+
platform_name = platform.name
|
113
|
+
# Compute the package ID that is unique to this packaging, so that we don't mix it with others if needed.
|
114
|
+
package_id = {
|
115
|
+
platform_name: platform_name,
|
116
|
+
services: platform_services.transform_values(&:sort).sort,
|
117
|
+
secrets: secrets.sort,
|
118
|
+
local_environment: local_environment
|
119
|
+
}
|
120
|
+
if ServicesHandler.packaged_deployments.include?(package_id)
|
121
|
+
log_debug "Platform #{platform_name} has already been packaged for this deployment (package ID #{package_id}). Won't package it another time."
|
122
|
+
else
|
123
|
+
platform.package(
|
124
|
+
services: platform_services,
|
125
|
+
secrets: secrets,
|
118
126
|
local_environment: local_environment
|
119
|
-
|
120
|
-
|
121
|
-
log_debug "Platform #{platform_name} has already been packaged for this deployment (package ID #{package_id}). Won't package it another time."
|
122
|
-
else
|
123
|
-
platform.package(
|
124
|
-
services: platform_services,
|
125
|
-
secrets: secrets,
|
126
|
-
local_environment: local_environment
|
127
|
-
)
|
128
|
-
ServicesHandler.packaged_deployments << package_id
|
129
|
-
end
|
127
|
+
)
|
128
|
+
ServicesHandler.packaged_deployments << package_id
|
130
129
|
end
|
131
130
|
end
|
132
131
|
end
|
@@ -145,12 +144,14 @@ module HybridPlatformsConductor
|
|
145
144
|
why_run:
|
146
145
|
)
|
147
146
|
platforms_for(services).each do |platform, platform_services|
|
147
|
+
next unless platform.respond_to?(:prepare_for_deploy)
|
148
|
+
|
148
149
|
platform.prepare_for_deploy(
|
149
150
|
services: platform_services,
|
150
151
|
secrets: secrets,
|
151
152
|
local_environment: local_environment,
|
152
153
|
why_run: why_run
|
153
|
-
)
|
154
|
+
)
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
@@ -164,10 +165,11 @@ module HybridPlatformsConductor
|
|
164
165
|
# * Array< Hash<Symbol,Object> >: List of actions to be done
|
165
166
|
def actions_to_deploy_on(node, services, why_run)
|
166
167
|
services.map do |service|
|
167
|
-
platform = @platforms_handler.known_platforms.find { |
|
168
|
+
platform = @platforms_handler.known_platforms.find { |search_platform| search_platform.deployable_services.include?(service) }
|
168
169
|
raise "No platform is able to deploy the service #{service}" if platform.nil?
|
170
|
+
|
169
171
|
# Add some markers in stdout and stderr so that parsing services-oriented deployment output is easier
|
170
|
-
deploy_marker = "===== [ #{node} / #{service} ] - HPC Service #{why_run ? 'Check' : 'Deploy'
|
172
|
+
deploy_marker = "===== [ #{node} / #{service} ] - HPC Service #{why_run ? 'Check' : 'Deploy'} ====="
|
171
173
|
[{
|
172
174
|
ruby: proc do |stdout, stderr|
|
173
175
|
stdout << "#{deploy_marker} Begin\n"
|
@@ -210,7 +212,7 @@ module HybridPlatformsConductor
|
|
210
212
|
end
|
211
213
|
|
212
214
|
# Regexp: The marker regexp used to separate services deployment
|
213
|
-
MARKER_REGEXP =
|
215
|
+
MARKER_REGEXP = %r{^===== \[ (.+?) / (.+?) \] - HPC Service (\w+) ===== Begin$(.+?)^===== \[ \1 / \2 \] - HPC Service \3 ===== End$}m
|
214
216
|
|
215
217
|
# Parse stdout and stderr of a given deploy run and get the list of tasks with their status, organized per service and node deployed.
|
216
218
|
#
|
@@ -234,8 +236,9 @@ module HybridPlatformsConductor
|
|
234
236
|
log_warn "Mismatch in deployment logs between stdout and stderr: stdout deployed node #{stdout_node}, stderr deployed node #{stderr_node}" unless stdout_node == stderr_node
|
235
237
|
log_warn "Mismatch in deployment logs between stdout and stderr: stdout deployed service #{stdout_service}, stderr deployed service #{stderr_service}" unless stdout_service == stderr_service
|
236
238
|
log_warn "Mismatch in deployment logs between stdout and stderr: stdout deployed mode is #{stdout_mode}, stderr deployed mode is #{stderr_mode}" unless stdout_mode == stderr_mode
|
237
|
-
platform = @platforms_handler.known_platforms.find { |
|
239
|
+
platform = @platforms_handler.known_platforms.find { |search_platform| search_platform.deployable_services.include?(stdout_service) }
|
238
240
|
raise "No platform is able to deploy the service #{stdout_service}" if platform.nil?
|
241
|
+
|
239
242
|
{
|
240
243
|
node: stdout_node,
|
241
244
|
service: stdout_service,
|
@@ -10,7 +10,7 @@ module HybridPlatformsConductor
|
|
10
10
|
def self.only_on_nodes
|
11
11
|
# Just 1 node per service and platform
|
12
12
|
Test.nodes_handler.prefetch_metadata_of Test.nodes_handler.known_nodes, :local_node
|
13
|
-
Test.nodes_handler.known_nodes.
|
13
|
+
Test.nodes_handler.known_nodes.reject { |node| Test.nodes_handler.get_local_node_of(node) }
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
@@ -50,7 +50,7 @@ module HybridPlatformsConductor
|
|
50
50
|
# Result::
|
51
51
|
# * Array<Test>: List of platform tests
|
52
52
|
def platform_tests
|
53
|
-
@tests.
|
53
|
+
@tests.reject { |test| test.platform.nil? }
|
54
54
|
end
|
55
55
|
|
56
56
|
# Return node tests
|
@@ -58,7 +58,7 @@ module HybridPlatformsConductor
|
|
58
58
|
# Result::
|
59
59
|
# * Array<Test>: List of node tests
|
60
60
|
def node_tests
|
61
|
-
@tests.
|
61
|
+
@tests.reject { |test| test.node.nil? }
|
62
62
|
end
|
63
63
|
|
64
64
|
# Select tests corresponding to a given criteria
|
@@ -144,7 +144,7 @@ module HybridPlatformsConductor
|
|
144
144
|
when :only_as_expected
|
145
145
|
test.expected_failure ? test.errors : []
|
146
146
|
when :only_as_non_expected
|
147
|
-
|
147
|
+
test.expected_failure ? [] : test.errors
|
148
148
|
else
|
149
149
|
raise "Unknown errors filter: #{fiter}"
|
150
150
|
end
|
@@ -166,10 +166,10 @@ module HybridPlatformsConductor
|
|
166
166
|
end
|
167
167
|
groups = {}
|
168
168
|
tests.group_by(&first_criteria).each do |first_group, grouped_tests|
|
169
|
-
next_grouped_errors = group_errors(grouped_tests, *group_criterias[1
|
169
|
+
next_grouped_errors = group_errors(grouped_tests, *group_criterias[1..], filter: filter)
|
170
170
|
groups[first_group] = next_grouped_errors unless next_grouped_errors.empty?
|
171
171
|
end
|
172
|
-
|
172
|
+
groups.sort.to_h
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
@@ -184,7 +184,7 @@ module HybridPlatformsConductor
|
|
184
184
|
# * *tested_nodes_in_error_as_expected* (Array<String>): Tested nodes in error in the list that are part of the expected failures
|
185
185
|
def nodes_by_nodes_list
|
186
186
|
no_list_nodes = @nodes_handler.known_nodes
|
187
|
-
|
187
|
+
(
|
188
188
|
@nodes_handler.known_nodes_lists.sort.map do |nodes_list|
|
189
189
|
nodes_from_list = @nodes_handler.nodes_from_list(nodes_list, ignore_unknowns: true)
|
190
190
|
no_list_nodes -= nodes_from_list
|
@@ -193,17 +193,14 @@ module HybridPlatformsConductor
|
|
193
193
|
['No list', no_list_nodes],
|
194
194
|
['All', @nodes_handler.known_nodes]
|
195
195
|
]
|
196
|
-
).
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
}
|
205
|
-
]
|
206
|
-
end]
|
196
|
+
).to_h.transform_values do |list_nodes|
|
197
|
+
{
|
198
|
+
nodes: list_nodes,
|
199
|
+
tested_nodes: list_nodes & @tested_nodes,
|
200
|
+
tested_nodes_in_error: list_nodes & group_errors(node_tests, :node).keys,
|
201
|
+
tested_nodes_in_error_as_expected: list_nodes & group_errors(node_tests, :node, filter: :only_as_expected).keys
|
202
|
+
}
|
203
|
+
end
|
207
204
|
end
|
208
205
|
|
209
206
|
# Flatten a tree hash.
|
@@ -259,7 +256,7 @@ module HybridPlatformsConductor
|
|
259
256
|
# * *not_run*: All non-successful tests have not been run
|
260
257
|
def classify_tests(tests)
|
261
258
|
info = {
|
262
|
-
not_run: tests.
|
259
|
+
not_run: tests.reject(&:executed?),
|
263
260
|
success: tests.select { |test| test.executed? && test.errors.empty? },
|
264
261
|
unexpected_error: tests.select { |test| test.executed? && !test.errors.empty? && test.expected_failure.nil? },
|
265
262
|
expected_error: tests.select { |test| test.executed? && !test.errors.empty? && !test.expected_failure.nil? }
|