hybrid_platforms_conductor 32.3.6
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 +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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
|
2
|
+
|
|
3
|
+
context 'checking CMDB plugin PlatformHandlers' do
|
|
4
|
+
|
|
5
|
+
it 'returns metadata published by the Platform\'s handler' do
|
|
6
|
+
with_test_platform(nodes: { 'test_node' => { meta: { property: 'value' } } }) do
|
|
7
|
+
expect(cmdb(:platform_handlers).get_others(['test_node'], {})).to eq('test_node' => { property: 'value' })
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'returns services published by the Platform\'s handler' do
|
|
12
|
+
with_test_platform(nodes: { 'test_node' => { services: %w[service1 service2] } }) do
|
|
13
|
+
expect(cmdb(:platform_handlers).get_services(['test_node'], {})).to eq('test_node' => %w[service1 service2])
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
|
2
|
+
|
|
3
|
+
context 'checking CMDB plugins\' API called by NodesHandler' do
|
|
4
|
+
|
|
5
|
+
# Get a test platform ready to test using the test CMDB
|
|
6
|
+
#
|
|
7
|
+
# Parameters::
|
|
8
|
+
# * *cmdbs* (Array<Symbol>): The test CMDBs to register [default: [:test_cmdb]]
|
|
9
|
+
# * *additional_platforms_content* (String): Additional configuration [default: '']
|
|
10
|
+
# * Proc: The code to be caklled for tests
|
|
11
|
+
def with_cmdb_test_platform(cmdbs: [:test_cmdb], additional_platforms_content: '')
|
|
12
|
+
with_test_platform(
|
|
13
|
+
{
|
|
14
|
+
nodes: {
|
|
15
|
+
'node1' => {},
|
|
16
|
+
'node2' => {},
|
|
17
|
+
'node3' => {},
|
|
18
|
+
'node4' => {}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
false,
|
|
22
|
+
additional_platforms_content
|
|
23
|
+
) do
|
|
24
|
+
register_test_cmdb(cmdbs)
|
|
25
|
+
yield
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'returns nodes metadata using generic method' do
|
|
30
|
+
with_cmdb_test_platform do
|
|
31
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'NODE1'
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns nodes metadata using dynamic method' do
|
|
36
|
+
with_cmdb_test_platform do
|
|
37
|
+
expect(test_nodes_handler.get_upcase_of('node1')).to eq 'NODE1'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'returns nodes metadata using dynamic method several times (as the method is created dynamically)' do
|
|
42
|
+
with_cmdb_test_platform do
|
|
43
|
+
3.times { expect(test_nodes_handler.get_upcase_of('node1')).to eq 'NODE1' }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'returns nodes metadata using dynamic method even on non-existant properties' do
|
|
48
|
+
with_cmdb_test_platform do
|
|
49
|
+
expect(test_nodes_handler.get_downcase_of('node1')).to eq nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'caches the value of a property for a given node' do
|
|
54
|
+
with_cmdb_test_platform do
|
|
55
|
+
3.times { test_nodes_handler.get_upcase_of('node1') }
|
|
56
|
+
# Check that there has been only 1 call to the plugin
|
|
57
|
+
expect(cmdb(:test_cmdb).calls).to eq [[:get_upcase, ['node1'], {}]]
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'caches the value of a property for a given node even if the value can\'t be fetched' do
|
|
62
|
+
with_cmdb_test_platform do
|
|
63
|
+
3.times { test_nodes_handler.get_nothing_of('node1') }
|
|
64
|
+
# Check that there has been only 1 call to the plugin
|
|
65
|
+
expect(cmdb(:test_cmdb).calls).to eq [[:get_nothing, ['node1'], {}]]
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it 'can prefetch the value of a property for a given node' do
|
|
70
|
+
with_cmdb_test_platform do
|
|
71
|
+
test_nodes_handler.prefetch_metadata_of(['node1'], :upcase)
|
|
72
|
+
cmdb(:test_cmdb).calls = []
|
|
73
|
+
expect(test_nodes_handler.get_upcase_of('node1')).to eq 'NODE1'
|
|
74
|
+
expect(cmdb(:test_cmdb).calls).to eq []
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'can prefetch the value of a property for several nodes at once' do
|
|
79
|
+
with_cmdb_test_platform do
|
|
80
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node3], :upcase)
|
|
81
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
82
|
+
[:get_upcase, %w[node1 node3], {}]
|
|
83
|
+
]
|
|
84
|
+
cmdb(:test_cmdb).calls = []
|
|
85
|
+
expect(test_nodes_handler.get_upcase_of('node1')).to eq 'NODE1'
|
|
86
|
+
expect(test_nodes_handler.get_upcase_of('node2')).to eq 'NODE2'
|
|
87
|
+
expect(test_nodes_handler.get_upcase_of('node3')).to eq 'NODE3'
|
|
88
|
+
expect(test_nodes_handler.get_upcase_of('node4')).to eq 'NODE4'
|
|
89
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
90
|
+
[:get_upcase, ['node2'], {}],
|
|
91
|
+
[:get_upcase, ['node4'], {}]
|
|
92
|
+
]
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'can prefetch the value of a property only for the nodes that were not prefetched before' do
|
|
97
|
+
with_cmdb_test_platform do
|
|
98
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node2 node3], :upcase)
|
|
99
|
+
cmdb(:test_cmdb).calls = []
|
|
100
|
+
test_nodes_handler.prefetch_metadata_of(%w[node2 node3 node4], :upcase)
|
|
101
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
102
|
+
[:get_upcase, ['node4'], {}]
|
|
103
|
+
]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'gives the current metadata to the plugins to be able to use it' do
|
|
108
|
+
with_cmdb_test_platform do
|
|
109
|
+
test_nodes_handler.get_upcase_of('node1')
|
|
110
|
+
expect(test_nodes_handler.get_double_of('node1')).to eq 'node1node1'
|
|
111
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
112
|
+
[:get_upcase, ['node1'], {}],
|
|
113
|
+
[:get_double, ['node1'], { 'node1' => { upcase: 'NODE1' } }]
|
|
114
|
+
]
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'can prefetch the value of several properties for several nodes' do
|
|
119
|
+
with_cmdb_test_platform do
|
|
120
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node3], %i[upcase double])
|
|
121
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
122
|
+
[:get_upcase, %w[node1 node3], {}],
|
|
123
|
+
[:get_double, %w[node1 node3], { 'node1' => { upcase: 'NODE1' }, 'node3' => { upcase: 'NODE3' } }]
|
|
124
|
+
]
|
|
125
|
+
cmdb(:test_cmdb).calls = []
|
|
126
|
+
expect(test_nodes_handler.get_upcase_of('node1')).to eq 'NODE1'
|
|
127
|
+
expect(test_nodes_handler.get_upcase_of('node2')).to eq 'NODE2'
|
|
128
|
+
expect(test_nodes_handler.get_upcase_of('node3')).to eq 'NODE3'
|
|
129
|
+
expect(test_nodes_handler.get_upcase_of('node4')).to eq 'NODE4'
|
|
130
|
+
expect(test_nodes_handler.get_double_of('node1')).to eq 'node1node1'
|
|
131
|
+
expect(test_nodes_handler.get_double_of('node2')).to eq 'node2node2'
|
|
132
|
+
expect(test_nodes_handler.get_double_of('node3')).to eq 'node3node3'
|
|
133
|
+
expect(test_nodes_handler.get_double_of('node4')).to eq 'node4node4'
|
|
134
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
135
|
+
[:get_upcase, ['node2'], {}],
|
|
136
|
+
[:get_upcase, ['node4'], {}],
|
|
137
|
+
[:get_double, ['node2'], { 'node2' => { upcase: 'NODE2' } }],
|
|
138
|
+
[:get_double, ['node4'], { 'node4' => { upcase: 'NODE4' } }]
|
|
139
|
+
]
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it 'does not prefetch the same values for the same nodes' do
|
|
144
|
+
with_cmdb_test_platform do
|
|
145
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node3], %i[upcase double])
|
|
146
|
+
cmdb(:test_cmdb).calls = []
|
|
147
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node3], %i[upcase double])
|
|
148
|
+
expect(cmdb(:test_cmdb).calls).to eq []
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it 'can prefetch the value of several properties for several nodes several times' do
|
|
153
|
+
with_cmdb_test_platform do
|
|
154
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node3], %i[upcase double])
|
|
155
|
+
cmdb(:test_cmdb).calls = []
|
|
156
|
+
test_nodes_handler.prefetch_metadata_of(%w[node1 node4], :double)
|
|
157
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
158
|
+
[:get_double, ['node4'], {}]
|
|
159
|
+
]
|
|
160
|
+
cmdb(:test_cmdb).calls = []
|
|
161
|
+
expect(test_nodes_handler.get_upcase_of('node1')).to eq 'NODE1'
|
|
162
|
+
expect(test_nodes_handler.get_upcase_of('node2')).to eq 'NODE2'
|
|
163
|
+
expect(test_nodes_handler.get_upcase_of('node3')).to eq 'NODE3'
|
|
164
|
+
expect(test_nodes_handler.get_upcase_of('node4')).to eq 'NODE4'
|
|
165
|
+
expect(test_nodes_handler.get_double_of('node1')).to eq 'node1node1'
|
|
166
|
+
expect(test_nodes_handler.get_double_of('node2')).to eq 'node2node2'
|
|
167
|
+
expect(test_nodes_handler.get_double_of('node3')).to eq 'node3node3'
|
|
168
|
+
expect(test_nodes_handler.get_double_of('node4')).to eq 'node4node4'
|
|
169
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
170
|
+
[:get_upcase, ['node2'], {}],
|
|
171
|
+
[:get_upcase, ['node4'], { 'node4' => { double: 'node4node4' } }],
|
|
172
|
+
[:get_double, ['node2'], { 'node2' => { upcase: 'NODE2' } }]
|
|
173
|
+
]
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it 'makes sure to get dependent properties before getting a property' do
|
|
178
|
+
with_cmdb_test_platform do
|
|
179
|
+
expect(test_nodes_handler.get_reversed_double_of('node1')).to eq '1edon1edon'
|
|
180
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
181
|
+
[:get_double, ['node1'], {}],
|
|
182
|
+
[:get_reversed_double, ['node1'], { 'node1' => { double: 'node1node1' } }]
|
|
183
|
+
]
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
it 'makes sure to get dependent properties before getting a property even if the dependency can\'t be set' do
|
|
188
|
+
with_cmdb_test_platform do
|
|
189
|
+
expect(test_nodes_handler.get_reversed_downcase_of('node1')).to eq 'UNKNOWN'
|
|
190
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
191
|
+
[:get_reversed_downcase, ['node1'], { 'node1' => { downcase: nil } }]
|
|
192
|
+
]
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
it 'tries different CMDBs to get a property until one gives it' do
|
|
197
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb2]) do
|
|
198
|
+
expect(test_nodes_handler.get_nothing_of('node1')).to eq 'node1 has nothing'
|
|
199
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
200
|
+
[:get_nothing, ['node1'], {}]
|
|
201
|
+
]
|
|
202
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
203
|
+
[:get_nothing, ['node1'], {}]
|
|
204
|
+
]
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
it 'fails when different CMDBs get a property having conflicting values' do
|
|
209
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb2]) do
|
|
210
|
+
expect { test_nodes_handler.get_different_comment_of('node1') }.to raise_error '[CMDB TestCmdb2.different_comment] - Returned a conflicting value for metadata different_comment of node node1: Comment from test_cmdb2 whereas the value was already set to Comment from test_cmdb'
|
|
211
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
212
|
+
[:get_different_comment, ['node1'], {}]
|
|
213
|
+
]
|
|
214
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
215
|
+
[:get_different_comment, ['node1'], {}]
|
|
216
|
+
]
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
it 'does not fail when different CMDBs get a property having same values' do
|
|
221
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb2]) do
|
|
222
|
+
expect(test_nodes_handler.get_same_comment_of('node1')).to eq 'Comment for node1'
|
|
223
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
224
|
+
[:get_same_comment, ['node1'], {}]
|
|
225
|
+
]
|
|
226
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
227
|
+
[:get_same_comment, ['node1'], {}]
|
|
228
|
+
]
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
it 'does not fail when different CMDBs get a property having conflicting values but one is defined as priority' do
|
|
233
|
+
with_cmdb_test_platform(
|
|
234
|
+
cmdbs: %i[test_cmdb test_cmdb2],
|
|
235
|
+
additional_platforms_content: 'master_cmdbs(test_cmdb2: :different_comment)'
|
|
236
|
+
) do
|
|
237
|
+
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb2'
|
|
238
|
+
expect(cmdb(:test_cmdb).calls).to eq nil
|
|
239
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
240
|
+
[:get_different_comment, ['node1'], {}]
|
|
241
|
+
]
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
it 'can configure different priority rules for different properties' do
|
|
246
|
+
with_cmdb_test_platform(
|
|
247
|
+
cmdbs: %i[test_cmdb test_cmdb2],
|
|
248
|
+
additional_platforms_content: '
|
|
249
|
+
master_cmdbs(
|
|
250
|
+
test_cmdb: :different_comment2,
|
|
251
|
+
test_cmdb2: :different_comment
|
|
252
|
+
)
|
|
253
|
+
'
|
|
254
|
+
) do
|
|
255
|
+
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb2'
|
|
256
|
+
expect(test_nodes_handler.get_different_comment2_of('node1')).to eq 'Comment2 from test_cmdb'
|
|
257
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
258
|
+
[:get_different_comment2, ['node1'], { 'node1' => { different_comment: 'Comment from test_cmdb2' } }]
|
|
259
|
+
]
|
|
260
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
261
|
+
[:get_different_comment, ['node1'], {}]
|
|
262
|
+
]
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
it 'can configure different priority rules for different properties on different nodes' do
|
|
267
|
+
with_cmdb_test_platform(
|
|
268
|
+
cmdbs: %i[test_cmdb test_cmdb2],
|
|
269
|
+
additional_platforms_content: '
|
|
270
|
+
for_nodes(\'node1\') do
|
|
271
|
+
master_cmdbs(
|
|
272
|
+
test_cmdb: :different_comment2,
|
|
273
|
+
test_cmdb2: :different_comment
|
|
274
|
+
)
|
|
275
|
+
end
|
|
276
|
+
for_nodes(\'node2\') do
|
|
277
|
+
master_cmdbs(
|
|
278
|
+
test_cmdb: :different_comment,
|
|
279
|
+
test_cmdb2: :different_comment2
|
|
280
|
+
)
|
|
281
|
+
end
|
|
282
|
+
'
|
|
283
|
+
) do
|
|
284
|
+
expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb2'
|
|
285
|
+
expect(test_nodes_handler.get_different_comment_of('node2')).to eq 'Comment from test_cmdb'
|
|
286
|
+
expect(test_nodes_handler.get_different_comment2_of('node1')).to eq 'Comment2 from test_cmdb'
|
|
287
|
+
expect(test_nodes_handler.get_different_comment2_of('node2')).to eq 'Comment2 from test_cmdb2'
|
|
288
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
289
|
+
[:get_different_comment, %w[node2], {}],
|
|
290
|
+
[:get_different_comment2, %w[node1], { 'node1' => { different_comment: 'Comment from test_cmdb2' } }]
|
|
291
|
+
]
|
|
292
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
293
|
+
[:get_different_comment, %w[node1], {}],
|
|
294
|
+
[:get_different_comment2, %w[node2], { 'node2' => { different_comment: 'Comment from test_cmdb' } }]
|
|
295
|
+
]
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
it 'fails when there are conflicts in the definition of master CMDBs' do
|
|
300
|
+
with_cmdb_test_platform(
|
|
301
|
+
cmdbs: %i[test_cmdb test_cmdb2],
|
|
302
|
+
additional_platforms_content: '
|
|
303
|
+
master_cmdbs(
|
|
304
|
+
test_cmdb: %i[different_comment different_comment2]
|
|
305
|
+
)
|
|
306
|
+
master_cmdbs(
|
|
307
|
+
test_cmdb: :different_comment,
|
|
308
|
+
test_cmdb2: :different_comment2
|
|
309
|
+
)
|
|
310
|
+
'
|
|
311
|
+
) do
|
|
312
|
+
expect { test_nodes_handler.get_different_comment_of('node1') }.to raise_error 'Property different_comment2 have conflicting CMDB masters for node1 declared in the configuration: HybridPlatformsConductorTest::CmdbPlugins::TestCmdb and HybridPlatformsConductorTest::CmdbPlugins::TestCmdb2'
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
it 'fails when the CMDB marked as master does not implement the property' do
|
|
317
|
+
with_cmdb_test_platform(
|
|
318
|
+
cmdbs: %i[test_cmdb test_cmdb2],
|
|
319
|
+
additional_platforms_content: '
|
|
320
|
+
master_cmdbs(
|
|
321
|
+
test_cmdb2: :upcase
|
|
322
|
+
)
|
|
323
|
+
'
|
|
324
|
+
) do
|
|
325
|
+
expect { test_nodes_handler.get_upcase_of('node1') }.to raise_error 'CMDB test_cmdb2 is configured as a master for property upcase on node node1 but it does not implement the needed API to retrieve it'
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
it 'continues trying different CMDBs to get a property even if ones already gives it' do
|
|
330
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb2 test_cmdb]) do
|
|
331
|
+
expect(test_nodes_handler.get_nothing_of('node1')).to eq 'node1 has nothing'
|
|
332
|
+
# test_cmdb was not even called, as it was registered second
|
|
333
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
334
|
+
[:get_nothing, ['node1'], {}]
|
|
335
|
+
]
|
|
336
|
+
expect(cmdb(:test_cmdb2).calls).to eq [
|
|
337
|
+
[:get_nothing, ['node1'], {}]
|
|
338
|
+
]
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
it 'uses the others method to get non registered properties' do
|
|
343
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb_others]) do
|
|
344
|
+
expect(test_nodes_handler.get_downcase_of('node1')).to eq '_node1_'
|
|
345
|
+
expect(cmdb(:test_cmdb_others).calls).to eq [
|
|
346
|
+
[:get_others, ['node1'], {}]
|
|
347
|
+
]
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
it 'uses the others method to get properties for which other CMDBs have no values' do
|
|
352
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb_others]) do
|
|
353
|
+
expect(test_nodes_handler.get_nothing_of('node1')).to eq 'node1 has another nothing'
|
|
354
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
355
|
+
[:get_nothing, ['node1'], {}]
|
|
356
|
+
]
|
|
357
|
+
expect(cmdb(:test_cmdb_others).calls).to eq [
|
|
358
|
+
[:get_others, ['node1'], {}]
|
|
359
|
+
]
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
it 'uses the others method to get properties for which other CMDBs have no values but with lesser priority than CMDBs defining the property' do
|
|
364
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb_others test_cmdb]) do
|
|
365
|
+
expect(test_nodes_handler.get_nothing_of('node1')).to eq 'node1 has another nothing'
|
|
366
|
+
# Here we see that test_cmdb was called first, even when it was registered second
|
|
367
|
+
expect(cmdb(:test_cmdb).calls).to eq [
|
|
368
|
+
[:get_nothing, ['node1'], {}]
|
|
369
|
+
]
|
|
370
|
+
expect(cmdb(:test_cmdb_others).calls).to eq [
|
|
371
|
+
[:get_others, ['node1'], {}]
|
|
372
|
+
]
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
it 'does not cache metadata from others method when they are not the required property' do
|
|
377
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb_others]) do
|
|
378
|
+
expect(test_nodes_handler.get_unknown_of('node1')).to eq nil
|
|
379
|
+
expect(cmdb(:test_cmdb_others).calls).to eq [
|
|
380
|
+
[:get_others, ['node1'], {}]
|
|
381
|
+
]
|
|
382
|
+
cmdb(:test_cmdb_others).calls = []
|
|
383
|
+
expect(test_nodes_handler.get_last_3_of('node1')).to eq 'de1'
|
|
384
|
+
expect(cmdb(:test_cmdb_others).calls).to eq [
|
|
385
|
+
[:get_others, ['node1'], { 'node1' => { unknown: nil } }]
|
|
386
|
+
]
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
it 'does not refuse conflicts between CMDBs and overriden values' do
|
|
391
|
+
with_cmdb_test_platform(cmdbs: %i[test_cmdb_others]) do
|
|
392
|
+
test_nodes_handler.override_metadata_of 'node1', :downcase, 'OVERIDDEN'
|
|
393
|
+
expect(test_nodes_handler.get_unknown_of('node1')).to eq nil
|
|
394
|
+
expect(test_nodes_handler.get_downcase_of('node1')).to eq 'OVERIDDEN'
|
|
395
|
+
end
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
it 'sets metadata that was not prefetched' do
|
|
399
|
+
with_cmdb_test_platform do
|
|
400
|
+
test_nodes_handler.override_metadata_of 'node1', :upcase, 'OVERIDDEN'
|
|
401
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'OVERIDDEN'
|
|
402
|
+
expect(cmdb(:test_cmdb).calls).to eq nil
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
it 'overrides metadata that was already prefetched' do
|
|
407
|
+
with_cmdb_test_platform do
|
|
408
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'NODE1'
|
|
409
|
+
test_nodes_handler.override_metadata_of 'node1', :upcase, 'OVERIDDEN'
|
|
410
|
+
cmdb(:test_cmdb).calls = []
|
|
411
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'OVERIDDEN'
|
|
412
|
+
expect(cmdb(:test_cmdb).calls).to eq []
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
it 'makes sure overriden metadata is accessible to other CMDBs' do
|
|
417
|
+
with_cmdb_test_platform do
|
|
418
|
+
test_nodes_handler.override_metadata_of 'node1', :other_property, 'Other value'
|
|
419
|
+
cmdb(:test_cmdb).calls = []
|
|
420
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'NODE1'
|
|
421
|
+
expect(cmdb(:test_cmdb).calls).to eq [[:get_upcase, ['node1'], { 'node1' => { other_property: 'Other value' } }]]
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
it 'invalidates metadata that was not prefetched' do
|
|
426
|
+
with_cmdb_test_platform do
|
|
427
|
+
test_nodes_handler.invalidate_metadata_of 'node1', :upcase
|
|
428
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'NODE1'
|
|
429
|
+
expect(cmdb(:test_cmdb).calls).to eq [[:get_upcase, ['node1'], {}]]
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
it 'invalidates metadata that was already prefetched' do
|
|
434
|
+
with_cmdb_test_platform do
|
|
435
|
+
test_nodes_handler.metadata_of('node1', :upcase)
|
|
436
|
+
test_nodes_handler.override_metadata_of 'node1', :upcase, 'OVERIDDEN'
|
|
437
|
+
test_nodes_handler.invalidate_metadata_of 'node1', :upcase
|
|
438
|
+
cmdb(:test_cmdb).calls = []
|
|
439
|
+
expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'NODE1'
|
|
440
|
+
expect(cmdb(:test_cmdb).calls).to eq [[:get_upcase, ['node1'], { 'node1' => {} }]]
|
|
441
|
+
end
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
end
|