hybrid_platforms_conductor 32.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/check-node +24 -0
- data/bin/deploy +12 -0
- data/bin/dump_nodes_json +12 -0
- data/bin/free_ips +23 -0
- data/bin/free_veids +17 -0
- data/bin/get_impacted_nodes +43 -0
- data/bin/last_deploys +56 -0
- data/bin/nodes_to_deploy +104 -0
- data/bin/report +10 -0
- data/bin/run +39 -0
- data/bin/setup +11 -0
- data/bin/ssh_config +14 -0
- data/bin/test +13 -0
- data/bin/topograph +54 -0
- data/lib/hybrid_platforms_conductor/action.rb +82 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
- data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
- data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
- data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
- data/lib/hybrid_platforms_conductor/config.rb +263 -0
- data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
- data/lib/hybrid_platforms_conductor/connector.rb +84 -0
- data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
- data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
- data/lib/hybrid_platforms_conductor/executable.rb +145 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
- data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
- data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
- data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
- data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
- data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
- data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
- data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
- data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
- data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
- data/lib/hybrid_platforms_conductor/report.rb +31 -0
- data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
- data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
- data/lib/hybrid_platforms_conductor/test.rb +141 -0
- data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
- data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
- data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
- data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
- data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
- data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
- data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
- data/lib/hybrid_platforms_conductor/version.rb +5 -0
- data/spec/hybrid_platforms_conductor_test.rb +159 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
- data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
- data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
- data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
- data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
- data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
- data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
- data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
- data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
- data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
- data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
- data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
- data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
- data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
- data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
- data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
- data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
- data/spec/spec_helper.rb +111 -0
- metadata +566 -0
data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
2
|
+
|
3
|
+
context 'checking Platform Handlers plugins\' API called by NodesHandler' do
|
4
|
+
|
5
|
+
it 'returns nodes' do
|
6
|
+
with_test_platform(nodes: { 'node1' => {}, 'node2' => {} }) do
|
7
|
+
expect(test_nodes_handler.known_nodes.sort).to eq %w[node1 node2].sort
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'returns nodes lists' do
|
12
|
+
with_test_platform(nodes_lists: { 'test_nodes_list' => [] }) do
|
13
|
+
expect(test_nodes_handler.known_nodes_lists).to eq ['test_nodes_list']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns nodes defined in a nodes lists' do
|
18
|
+
with_test_platform(
|
19
|
+
nodes: { 'node1' => {}, 'node2' => {} },
|
20
|
+
nodes_lists: { 'test_nodes_list' => %w[node1 node2] }
|
21
|
+
) do
|
22
|
+
expect(test_nodes_handler.nodes_from_list('test_nodes_list').sort).to eq %w[node1 node2].sort
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns nodes selectors defined in a nodes lists' do
|
27
|
+
with_test_platform(
|
28
|
+
nodes: {
|
29
|
+
'node10' => { services: ['test_service'] },
|
30
|
+
'node11' => { services: ['test_service_2'] },
|
31
|
+
'node20' => { services: ['test_service_3', 'test_service'] },
|
32
|
+
'node21' => { services: ['test_service_2'] }
|
33
|
+
},
|
34
|
+
nodes_lists: { 'test_nodes_list' => ['/node1.+/', { service: 'test_service' }] }
|
35
|
+
) do
|
36
|
+
expect(test_nodes_handler.nodes_from_list('test_nodes_list').sort).to eq %w[node10 node11 node20].sort
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns nodes defined in a nodes lists while ignoring unknown ones' do
|
41
|
+
with_test_platform(
|
42
|
+
nodes: { 'node1' => {} },
|
43
|
+
nodes_lists: { 'test_nodes_list' => %w[node1 node2] }
|
44
|
+
) do
|
45
|
+
expect(test_nodes_handler.nodes_from_list('test_nodes_list', ignore_unknowns: true).sort).to eq %w[node1 node2].sort
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'fails when returning unknown nodes defined in a nodes lists' do
|
50
|
+
with_test_platform(
|
51
|
+
nodes: { 'node1' => {} },
|
52
|
+
nodes_lists: { 'test_nodes_list' => %w[node1 node2] }
|
53
|
+
) do
|
54
|
+
expect { test_nodes_handler.nodes_from_list('test_nodes_list') }.to raise_error(RuntimeError, 'Unknown nodes: node2')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
2
|
+
|
3
|
+
context 'checking aggregations across several platforms' do
|
4
|
+
|
5
|
+
it 'returns nodes' do
|
6
|
+
with_test_platforms(
|
7
|
+
'platform1' => { nodes: { 'node1' => {}, 'node2' => {} } },
|
8
|
+
'platform2' => { nodes: { 'node3' => {}, 'node4' => {} } }
|
9
|
+
) do
|
10
|
+
expect(test_nodes_handler.known_nodes.sort).to eq %w[node1 node2 node3 node4].sort
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'fails when several platforms define the same nodes' do
|
15
|
+
with_test_platforms(
|
16
|
+
'platform1' => { nodes: { 'node1' => {}, 'node2' => {} } },
|
17
|
+
'platform2' => { nodes: { 'node1' => {}, 'node4' => {} } }
|
18
|
+
) do
|
19
|
+
expect { test_nodes_handler.known_nodes }.to raise_error(RuntimeError, /Can\'t register node1/)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns nodes lists' do
|
24
|
+
with_test_platforms(
|
25
|
+
'platform1' => { nodes_lists: { 'nodeslist1' => [] } },
|
26
|
+
'platform2' => { nodes_lists: { 'nodeslist2' => [] } }
|
27
|
+
) do
|
28
|
+
expect(test_nodes_handler.known_nodes_lists.sort).to eq %w[nodeslist1 nodeslist2].sort
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'fails when several platforms define the same nodes lists' do
|
33
|
+
with_test_platforms(
|
34
|
+
'platform1' => { nodes_lists: { 'nodeslist1' => [] } },
|
35
|
+
'platform2' => { nodes_lists: { 'nodeslist1' => [] } }
|
36
|
+
) do
|
37
|
+
expect { test_nodes_handler.known_nodes_lists }.to raise_error(RuntimeError, /Can\'t register nodes list nodeslist1/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns services' do
|
42
|
+
with_test_platforms(
|
43
|
+
'platform1' => { nodes: {
|
44
|
+
'node1' => { services: ['service1'] },
|
45
|
+
'node2' => { services: ['service2'] }
|
46
|
+
} },
|
47
|
+
'platform2' => { nodes: {
|
48
|
+
'node3' => { services: ['service1', 'service4'] },
|
49
|
+
'node4' => { services: ['service3'] }
|
50
|
+
} }
|
51
|
+
) do
|
52
|
+
expect(test_nodes_handler.known_services.sort).to eq %w[service1 service2 service3 service4].sort
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
describe HybridPlatformsConductor::PlatformHandler do
|
2
|
+
|
3
|
+
it 'returns the correct platform type' do
|
4
|
+
with_test_platform do
|
5
|
+
expect(test_platforms_handler.platform('platform').platform_type).to eq :test
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'returns the correct path' do
|
10
|
+
with_test_platform do
|
11
|
+
expect(test_platforms_handler.platform('platform').repository_path).to eq "#{Dir.tmpdir}/hpc_test/platform"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns the correct info' do
|
16
|
+
with_test_platform do
|
17
|
+
expect(test_platforms_handler.platform('platform').info).to eq(repo_name: 'platform')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'returns the correct name when platform is not a Git repository' do
|
22
|
+
with_repository('my_remote_platform', as_git: false) do |repository|
|
23
|
+
with_platforms "test_platform path: '#{repository}'" do
|
24
|
+
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
25
|
+
self.test_platforms_info = { 'my_remote_platform' => {} }
|
26
|
+
expect(test_platforms_handler.platform('my_remote_platform').name).to eq 'my_remote_platform'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'returns the correct name when platform is a Git repository' do
|
32
|
+
with_repository('my_remote_platform', as_git: true) do |repository|
|
33
|
+
with_platforms "test_platform path: '#{repository}'" do
|
34
|
+
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
35
|
+
self.test_platforms_info = { 'my_remote_platform' => {} }
|
36
|
+
expect(test_platforms_handler.platform('my_remote_platform').name).to eq 'my_remote_platform'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'returns the correct info when platform is a Git repository' do
|
42
|
+
with_repository('my_remote_platform', as_git: true) do |repository|
|
43
|
+
with_platforms "test_platform path: '#{repository}'" do
|
44
|
+
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
45
|
+
self.test_platforms_info = { 'my_remote_platform' => {} }
|
46
|
+
commit = Git.open(repository).log.first
|
47
|
+
expect(test_platforms_handler.platform('my_remote_platform').info).to eq(
|
48
|
+
repo_name: 'my_remote_platform',
|
49
|
+
status: {
|
50
|
+
added_files: [],
|
51
|
+
changed_files: [],
|
52
|
+
deleted_files: [],
|
53
|
+
untracked_files: []
|
54
|
+
},
|
55
|
+
commit: {
|
56
|
+
author: {
|
57
|
+
email: 'email@email.com',
|
58
|
+
name: 'Thats Me'
|
59
|
+
},
|
60
|
+
date: commit.date.utc,
|
61
|
+
id: commit.sha,
|
62
|
+
message: 'Test commit',
|
63
|
+
ref: 'master'
|
64
|
+
}
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'returns the differing files in the info when platform is a Git repository' do
|
71
|
+
with_repository('my_remote_platform', as_git: true) do |repository|
|
72
|
+
with_platforms "test_platform path: '#{repository}'" do
|
73
|
+
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
74
|
+
self.test_platforms_info = { 'my_remote_platform' => {} }
|
75
|
+
# Make the repository be a Git repository
|
76
|
+
git = Git.open(repository)
|
77
|
+
FileUtils.touch("#{repository}/test_file_1")
|
78
|
+
FileUtils.touch("#{repository}/test_file_2")
|
79
|
+
git.add(['test_file_1', 'test_file_2'])
|
80
|
+
git.commit('Test commit')
|
81
|
+
# Make some diffs
|
82
|
+
FileUtils.touch("#{repository}/new_file")
|
83
|
+
FileUtils.touch("#{repository}/added_file")
|
84
|
+
git.add('added_file')
|
85
|
+
git.remove('test_file_1')
|
86
|
+
File.write("#{repository}/test_file_2", 'New content')
|
87
|
+
expect(test_platforms_handler.platform('my_remote_platform').info[:status]).to eq(
|
88
|
+
added_files: ['added_file'],
|
89
|
+
changed_files: ['test_file_2'],
|
90
|
+
deleted_files: ['test_file_1'],
|
91
|
+
untracked_files: ['new_file']
|
92
|
+
)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
describe HybridPlatformsConductor::PlatformsHandler do
|
2
|
+
|
3
|
+
context 'checking config specific DSL' do
|
4
|
+
|
5
|
+
it 'returns platform directories along with platform types' do
|
6
|
+
with_test_platforms(
|
7
|
+
'platform1' => { platform_type: :test },
|
8
|
+
'platform2' => { platform_type: :test2 },
|
9
|
+
'platform3' => { platform_type: :test }
|
10
|
+
) do |repositories|
|
11
|
+
expect(test_config.platform_dirs.keys.sort).to eq %i[test test2].sort
|
12
|
+
expect(test_config.platform_dirs[:test].sort).to eq [
|
13
|
+
repositories['platform1'],
|
14
|
+
repositories['platform3']
|
15
|
+
].sort
|
16
|
+
expect(test_config.platform_dirs[:test2].sort).to eq [
|
17
|
+
repositories['platform2']
|
18
|
+
].sort
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns no platform types by default' do
|
25
|
+
with_test_platforms do
|
26
|
+
expect(test_platforms_handler.platform_types).to eq({})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns no platform by default' do
|
31
|
+
with_test_platforms do
|
32
|
+
expect(test_platforms_handler.known_platforms).to eq []
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns defined platform types' do
|
37
|
+
with_test_platforms(
|
38
|
+
'platform1' => { platform_type: :test },
|
39
|
+
'platform2' => { platform_type: :test2 },
|
40
|
+
'platform3' => { platform_type: :test }
|
41
|
+
) do
|
42
|
+
expect(test_platforms_handler.platform_types).to eq(
|
43
|
+
test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test,
|
44
|
+
test2: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test2
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'returns defined platforms' do
|
50
|
+
with_test_platforms(
|
51
|
+
'platform1' => { platform_type: :test },
|
52
|
+
'platform2' => { platform_type: :test2 },
|
53
|
+
'platform3' => { platform_type: :test }
|
54
|
+
) do
|
55
|
+
expect(test_platforms_handler.known_platforms.map(&:name).sort).to eq %w[platform1 platform2 platform3].sort
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'fails if several platforms share the same name' do
|
60
|
+
with_repository('platform1') do |repository|
|
61
|
+
with_test_platforms(
|
62
|
+
{
|
63
|
+
'platform1' => { platform_type: :test },
|
64
|
+
'platform2' => { platform_type: :test2 }
|
65
|
+
},
|
66
|
+
false,
|
67
|
+
"test2_platform path: \'#{repository}\'"
|
68
|
+
) do
|
69
|
+
expect { test_platforms_handler.known_platforms }.to raise_error 'Platform name platform1 is declared several times.'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'returns defined platforms filtered by platform type' do
|
75
|
+
with_test_platforms(
|
76
|
+
'platform1' => { platform_type: :test },
|
77
|
+
'platform2' => { platform_type: :test2 },
|
78
|
+
'platform3' => { platform_type: :test }
|
79
|
+
) do
|
80
|
+
expect(test_platforms_handler.known_platforms(platform_type: :test).map(&:name).sort).to eq %w[platform1 platform3].sort
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'selects a platform based on its name' do
|
85
|
+
with_test_platforms(
|
86
|
+
'platform1' => { platform_type: :test },
|
87
|
+
'platform2' => { platform_type: :test2 },
|
88
|
+
'platform3' => { platform_type: :test }
|
89
|
+
) do
|
90
|
+
expect(test_platforms_handler.platform('platform2').name).to eq 'platform2'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'selects nil for an unknown platform name' do
|
95
|
+
with_test_platforms(
|
96
|
+
'platform1' => { platform_type: :test },
|
97
|
+
'platform2' => { platform_type: :test2 },
|
98
|
+
'platform3' => { platform_type: :test }
|
99
|
+
) do
|
100
|
+
expect(test_platforms_handler.platform('platform4')).to eq nil
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
# Define the base class of the test plugins
|
2
|
+
module HybridPlatformsConductor
|
3
|
+
|
4
|
+
class TestPluginType < Plugin
|
5
|
+
end
|
6
|
+
|
7
|
+
class TestPluginType2 < Plugin
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
module HybridPlatformsConductorTest
|
13
|
+
|
14
|
+
class RandomClass < HybridPlatformsConductor::Plugin
|
15
|
+
end
|
16
|
+
|
17
|
+
class RandomClassWithValidation < HybridPlatformsConductor::Plugin
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
attr_accessor :validation_result, :validation_done
|
22
|
+
|
23
|
+
# Are dependencies met before using an instance of this plugin?
|
24
|
+
# This method can be overriden by any plugin
|
25
|
+
#
|
26
|
+
# Result::
|
27
|
+
# * Boolean: Are dependencies met before using an instance of this plugin?
|
28
|
+
def valid?
|
29
|
+
@validation_done = true
|
30
|
+
@validation_result
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
class RandomClassWithPlatformsDslExtension < HybridPlatformsConductor::Plugin
|
38
|
+
|
39
|
+
module MyPlatformsDslExtension
|
40
|
+
|
41
|
+
attr_reader :my_property
|
42
|
+
|
43
|
+
# Set property
|
44
|
+
#
|
45
|
+
# Parameters::
|
46
|
+
# * *value* (Integer): Value to be set
|
47
|
+
def set_my_property(value)
|
48
|
+
@my_property = value * 2
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
extend_config_dsl_with MyPlatformsDslExtension
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
class RandomClassWithPlatformsDslExtensionAndInitializer < HybridPlatformsConductor::Plugin
|
58
|
+
|
59
|
+
module MyPlatformsDslExtension
|
60
|
+
|
61
|
+
attr_reader :my_other_property
|
62
|
+
|
63
|
+
# Initializer
|
64
|
+
def init_my_dsl
|
65
|
+
@my_other_property = 42
|
66
|
+
end
|
67
|
+
|
68
|
+
# Set property
|
69
|
+
#
|
70
|
+
# Parameters::
|
71
|
+
# * *value* (Integer): Value to be set
|
72
|
+
def set_my_other_property(value)
|
73
|
+
@my_other_property += value
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
extend_config_dsl_with MyPlatformsDslExtension, :init_my_dsl
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
describe HybridPlatformsConductor::Plugins do
|
85
|
+
|
86
|
+
it 'returns no plugins by default' do
|
87
|
+
with_test_platform do
|
88
|
+
expect(HybridPlatformsConductor::Plugins.new(:test_plugin_type, logger: logger, logger_stderr: logger).keys).to eq []
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'can register a new plugin with a given class' do
|
93
|
+
with_test_platform do
|
94
|
+
plugins = HybridPlatformsConductor::Plugins.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
95
|
+
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClass
|
96
|
+
expect(plugins.keys).to eq [:new_plugin]
|
97
|
+
expect(plugins[:new_plugin]).to eq HybridPlatformsConductorTest::RandomClass
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'can register a new plugin with an initializer' do
|
102
|
+
with_test_platform do
|
103
|
+
plugins = HybridPlatformsConductor::Plugins.new(
|
104
|
+
:test_plugin_type,
|
105
|
+
init_plugin: proc do |plugin_class|
|
106
|
+
plugin_class.name
|
107
|
+
end,
|
108
|
+
logger: logger,
|
109
|
+
logger_stderr: logger
|
110
|
+
)
|
111
|
+
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClass
|
112
|
+
expect(plugins.keys).to eq [:new_plugin]
|
113
|
+
expect(plugins[:new_plugin]).to eq 'HybridPlatformsConductorTest::RandomClass'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'validates a plugin class before registering it' do
|
118
|
+
with_test_platform do
|
119
|
+
plugins = HybridPlatformsConductor::Plugins.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
120
|
+
HybridPlatformsConductorTest::RandomClassWithValidation.validation_done = false
|
121
|
+
HybridPlatformsConductorTest::RandomClassWithValidation.validation_result = true
|
122
|
+
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClassWithValidation
|
123
|
+
expect(plugins.keys).to eq [:new_plugin]
|
124
|
+
expect(plugins[:new_plugin]).to eq HybridPlatformsConductorTest::RandomClassWithValidation
|
125
|
+
expect(HybridPlatformsConductorTest::RandomClassWithValidation.validation_done).to eq true
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'does not register a plugin that fails validation' do
|
130
|
+
with_test_platform do
|
131
|
+
plugins = HybridPlatformsConductor::Plugins.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
132
|
+
HybridPlatformsConductorTest::RandomClassWithValidation.validation_done = false
|
133
|
+
HybridPlatformsConductorTest::RandomClassWithValidation.validation_result = false
|
134
|
+
plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClassWithValidation
|
135
|
+
expect(plugins.keys).to eq []
|
136
|
+
expect(HybridPlatformsConductorTest::RandomClassWithValidation.validation_done).to eq true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'discovers automatically plugins of a given type in the hpc_plugins directory of a gem' do
|
141
|
+
with_test_platform do
|
142
|
+
# Mock the discovery of Ruby gems
|
143
|
+
expect(Gem).to receive(:loaded_specs) do
|
144
|
+
my_test_gem_spec = double('Test gemspec for gem my_test_gem')
|
145
|
+
expect(my_test_gem_spec).to receive(:full_gem_path) { '__gem_full_path__' }
|
146
|
+
expect(Dir).to receive(:glob).with('__gem_full_path__/lib/**/*.rb') do
|
147
|
+
[
|
148
|
+
'__gem_full_path__/lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb'
|
149
|
+
]
|
150
|
+
end
|
151
|
+
{
|
152
|
+
'my_test_gem' => my_test_gem_spec
|
153
|
+
}
|
154
|
+
end
|
155
|
+
# Alter the load path to mock an extra Rubygem
|
156
|
+
$LOAD_PATH.unshift "#{__dir__}/../mocked_lib"
|
157
|
+
begin
|
158
|
+
plugins = HybridPlatformsConductor::Plugins.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
159
|
+
expect(plugins.keys).to eq [:test_plugin_id1]
|
160
|
+
expect(plugins[:test_plugin_id1]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem::HpcPlugins::TestPluginType::TestPluginId1
|
161
|
+
ensure
|
162
|
+
$LOAD_PATH.shift
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'discovers automatically several plugins of different types in the hpc_plugins directories of several gems' do
|
168
|
+
with_test_platform do
|
169
|
+
# Mock the discovery of Ruby gems
|
170
|
+
expect(Gem).to receive(:loaded_specs).twice do
|
171
|
+
my_test_gem_spec = double('Test gemspec for gem my_test_gem')
|
172
|
+
expect(my_test_gem_spec).to receive(:full_gem_path) { '__gem_full_path__' }
|
173
|
+
expect(Dir).to receive(:glob).with('__gem_full_path__/lib/**/*.rb') do
|
174
|
+
[
|
175
|
+
'__gem_full_path__/lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb',
|
176
|
+
'__gem_full_path__/lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb'
|
177
|
+
]
|
178
|
+
end
|
179
|
+
my_test_gem2_spec = double('Test gemspec for gem my_test_gem2')
|
180
|
+
expect(my_test_gem2_spec).to receive(:full_gem_path) { '__gem2_full_path__' }
|
181
|
+
expect(Dir).to receive(:glob).with('__gem2_full_path__/lib/**/*.rb') do
|
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
|
187
|
+
{
|
188
|
+
'my_test_gem' => my_test_gem_spec,
|
189
|
+
'my_test_gem2' => my_test_gem2_spec
|
190
|
+
}
|
191
|
+
end
|
192
|
+
# Alter the load path to mock an extra Rubygem
|
193
|
+
$LOAD_PATH.unshift "#{__dir__}/../mocked_lib"
|
194
|
+
begin
|
195
|
+
plugins = HybridPlatformsConductor::Plugins.new(:test_plugin_type, logger: logger, logger_stderr: logger)
|
196
|
+
expect(plugins.keys.sort).to eq %i[test_plugin_id1 test_plugin_id2 test_plugin_id3].sort
|
197
|
+
expect(plugins[:test_plugin_id1]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem::HpcPlugins::TestPluginType::TestPluginId1
|
198
|
+
expect(plugins[:test_plugin_id2]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem::HpcPlugins::TestPluginType::TestPluginId2
|
199
|
+
expect(plugins[:test_plugin_id3]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem2::SubDir::HpcPlugins::TestPluginType::TestPluginId3
|
200
|
+
plugins2 = HybridPlatformsConductor::Plugins.new(:test_plugin_type2, logger: logger, logger_stderr: logger)
|
201
|
+
expect(plugins2.keys).to eq [:test_plugin_id4]
|
202
|
+
expect(plugins2[:test_plugin_id4]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGem2::SubDir::HpcPlugins::TestPluginType2::TestPluginId4
|
203
|
+
ensure
|
204
|
+
$LOAD_PATH.shift
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
it 'does not discover automatically plugins from gems if asked' do
|
210
|
+
with_test_platform do
|
211
|
+
# Mock the discovery of Ruby gems
|
212
|
+
expect(Gem).not_to receive(:loaded_specs)
|
213
|
+
expect(HybridPlatformsConductor::Plugins.new(:test_plugin_type, parse_gems: false, logger: logger, logger_stderr: logger).keys).to eq []
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'extends the Config DSL from a plugin' do
|
218
|
+
with_repository('platform') do |repository|
|
219
|
+
with_platforms("
|
220
|
+
test_platform path: '#{repository}'
|
221
|
+
set_my_property 42
|
222
|
+
") do
|
223
|
+
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
224
|
+
self.test_platforms_info = { 'platform' => {} }
|
225
|
+
expect(test_config.my_property).to eq 84
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'extends the Config DSL with an initializer from a plugin' do
|
231
|
+
with_repository('platform') do |repository|
|
232
|
+
with_platforms("
|
233
|
+
test_platform path: '#{repository}'
|
234
|
+
set_my_other_property 66
|
235
|
+
") do
|
236
|
+
register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
|
237
|
+
self.test_platforms_info = { 'platform' => {} }
|
238
|
+
expect(test_config.my_other_property).to eq 108
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|