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
@@ -0,0 +1,127 @@
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
2
|
+
|
3
|
+
it 'initializes with no platform' do
|
4
|
+
with_platforms '' do
|
5
|
+
expect(test_nodes_handler.known_nodes).to eq []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'initializes with a platform having no node' do
|
10
|
+
with_test_platform do
|
11
|
+
expect(test_nodes_handler.known_nodes).to eq []
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'iterates over defined nodes sequentially' do
|
16
|
+
with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} }) do
|
17
|
+
nodes_iterated = []
|
18
|
+
test_nodes_handler.for_each_node_in(['node2', 'node3', 'node4']) do |node|
|
19
|
+
nodes_iterated << node
|
20
|
+
end
|
21
|
+
expect(nodes_iterated.sort).to eq %w[node2 node3 node4].sort
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'iterates over defined nodes in parallel' do
|
26
|
+
with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} }) do
|
27
|
+
nodes_iterated = []
|
28
|
+
test_nodes_handler.for_each_node_in(['node2', 'node3', 'node4'], parallel: true) do |node|
|
29
|
+
sleep(
|
30
|
+
case node
|
31
|
+
when 'node2'
|
32
|
+
2
|
33
|
+
when 'node3'
|
34
|
+
3
|
35
|
+
when 'node4'
|
36
|
+
1
|
37
|
+
end
|
38
|
+
)
|
39
|
+
nodes_iterated << node
|
40
|
+
end
|
41
|
+
expect(nodes_iterated).to eq %w[node4 node2 node3]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'iterates over defined nodes in parallel and handle errors correctly' do
|
46
|
+
with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} }) do
|
47
|
+
nodes_iterated = []
|
48
|
+
# Make sure we exit the test case even if the error is not handled correctly by using a timeout
|
49
|
+
Timeout.timeout(5) do
|
50
|
+
expect do
|
51
|
+
test_nodes_handler.for_each_node_in(['node2', 'node3', 'node4'], parallel: true) do |node|
|
52
|
+
case node
|
53
|
+
when 'node2'
|
54
|
+
sleep 2
|
55
|
+
when 'node3'
|
56
|
+
sleep 3
|
57
|
+
raise "Error iterating on #{node}"
|
58
|
+
when 'node4'
|
59
|
+
sleep 1
|
60
|
+
end
|
61
|
+
nodes_iterated << node
|
62
|
+
end
|
63
|
+
end.to raise_error 'Error iterating on node3'
|
64
|
+
end
|
65
|
+
expect(nodes_iterated).to eq %w[node4 node2]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'selects the correct configurations for a given node' do
|
70
|
+
with_test_platform(
|
71
|
+
nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {} },
|
72
|
+
nodes_lists: { 'nodeslist1' => %w[node1 node2], 'nodeslist2' => %w[node3 node4] }
|
73
|
+
) do
|
74
|
+
expect(test_nodes_handler.select_confs_for_node('node2', [
|
75
|
+
{
|
76
|
+
conf: 'conf1',
|
77
|
+
nodes_selectors_stack: ['/node1/']
|
78
|
+
},
|
79
|
+
{
|
80
|
+
conf: 'conf2',
|
81
|
+
nodes_selectors_stack: ['/node2/']
|
82
|
+
},
|
83
|
+
{
|
84
|
+
conf: 'conf3',
|
85
|
+
nodes_selectors_stack: [[{ list: 'nodeslist1' }]]
|
86
|
+
},
|
87
|
+
{
|
88
|
+
conf: 'conf4',
|
89
|
+
nodes_selectors_stack: [[{ list: 'nodeslist2' }]]
|
90
|
+
}
|
91
|
+
]).map { |config| config[:conf] }.sort).to eq %w[
|
92
|
+
conf2
|
93
|
+
conf3
|
94
|
+
].sort
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'selects the correct configurations for a given platform' do
|
99
|
+
with_test_platforms(
|
100
|
+
'platform1' => { nodes: { 'node11' => {}, 'node12' => {}, 'node13' => {}, 'node14' => {} } },
|
101
|
+
'platform2' => { nodes: { 'node21' => {}, 'node22' => {}, 'node23' => {}, 'node24' => {} } }
|
102
|
+
) do
|
103
|
+
expect(test_nodes_handler.select_confs_for_platform('platform2', [
|
104
|
+
{
|
105
|
+
conf: 'conf1',
|
106
|
+
nodes_selectors_stack: ['/node1/']
|
107
|
+
},
|
108
|
+
{
|
109
|
+
conf: 'conf2',
|
110
|
+
nodes_selectors_stack: ['/node2/']
|
111
|
+
},
|
112
|
+
{
|
113
|
+
conf: 'conf3',
|
114
|
+
nodes_selectors_stack: [%w[node11 node13 node21 node22 node23 node24]]
|
115
|
+
},
|
116
|
+
{
|
117
|
+
conf: 'conf4',
|
118
|
+
nodes_selectors_stack: [%w[node11 node13 node21 node22 node24]]
|
119
|
+
}
|
120
|
+
]).map { |config| config[:conf] }.sort).to eq %w[
|
121
|
+
conf2
|
122
|
+
conf3
|
123
|
+
].sort
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
@@ -0,0 +1,318 @@
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
2
|
+
|
3
|
+
context 'checking computation of impacted nodes by a git diff' do
|
4
|
+
|
5
|
+
it 'returns all the impacted platform nodes by default' do
|
6
|
+
with_test_platforms(
|
7
|
+
{
|
8
|
+
'platform_1' => { nodes: { 'node11' => {}, 'node12' => {} } },
|
9
|
+
'platform_2' => { nodes: { 'node21' => {}, 'node22' => {} } }
|
10
|
+
},
|
11
|
+
true
|
12
|
+
) do
|
13
|
+
with_cmd_runner_mocked([
|
14
|
+
[/cd .+\/platform_2 && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
15
|
+
]) do
|
16
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('platform_2')).to eq [
|
17
|
+
%w[node21 node22].sort,
|
18
|
+
[],
|
19
|
+
[],
|
20
|
+
true
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'diffs from another commit if asked' do
|
27
|
+
with_test_platform({}, true) do
|
28
|
+
with_cmd_runner_mocked([
|
29
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color from_branch/, proc { [0, '', ''] }]
|
30
|
+
]) do
|
31
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', from_commit: 'from_branch')).to eq [[], [], [], true]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'diffs to another commit if asked' do
|
37
|
+
with_test_platform({}, true) do
|
38
|
+
with_cmd_runner_mocked([
|
39
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master to_branch/, proc { [0, '', ''] }]
|
40
|
+
]) do
|
41
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', to_commit: 'to_branch')).to eq [[], [], [], true]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'gives the platform handler the correct git diff result' do
|
47
|
+
with_test_platform({}, true) do
|
48
|
+
with_cmd_runner_mocked([
|
49
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc do
|
50
|
+
[
|
51
|
+
0,
|
52
|
+
<<~EOS,
|
53
|
+
diff --git a/Gemfile b/Gemfile
|
54
|
+
index d65e2a6..cb9a38e 100644
|
55
|
+
--- a/Gemfile
|
56
|
+
+++ b/Gemfile
|
57
|
+
@@ -1,3 +1,5 @@
|
58
|
+
source 'http://rubygems.org'
|
59
|
+
|
60
|
+
gemspec
|
61
|
+
+
|
62
|
+
+gem 'byebug'
|
63
|
+
|
64
|
+
diff --git a/lib/hybrid_platforms_conductor/nodes_handler.rb b/lib/stale/hybrid_platforms_conductor/nodes_handler.rb
|
65
|
+
index e8e1778..69a84bd 100644
|
66
|
+
--- a/lib/hybrid_platforms_conductor/nodes_handler.rb
|
67
|
+
+++ b/lib/hybrid_platforms_conductor/nodes_handler.rb
|
68
|
+
@@ -133,6 +133,23 @@ module HybridPlatformsConductor
|
69
|
+
options_parser.on('-l', '--nodes-list LIST', 'Select nodes defined in a nodes list (can be used several times)') do |nodes_list|
|
70
|
+
nodes_selectors << { list: nodes_list }
|
71
|
+
end
|
72
|
+
+ options_parser.on(
|
73
|
+
+ '--nodes-git-impact GIT_IMPACT',
|
74
|
+
nodes_selectors << node
|
75
|
+
end
|
76
|
+
EOS
|
77
|
+
''
|
78
|
+
]
|
79
|
+
end]
|
80
|
+
]) do
|
81
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [[], [], [], true]
|
82
|
+
expect(test_platforms_handler.platform('my_remote_platform').files_diffs).to eq(
|
83
|
+
'Gemfile' => {
|
84
|
+
diff: <<~EOS.strip
|
85
|
+
index d65e2a6..cb9a38e 100644
|
86
|
+
--- a/Gemfile
|
87
|
+
+++ b/Gemfile
|
88
|
+
@@ -1,3 +1,5 @@
|
89
|
+
source 'http://rubygems.org'
|
90
|
+
|
91
|
+
gemspec
|
92
|
+
+
|
93
|
+
+gem 'byebug'
|
94
|
+
|
95
|
+
EOS
|
96
|
+
},
|
97
|
+
'lib/hybrid_platforms_conductor/nodes_handler.rb' => {
|
98
|
+
moved_to: 'lib/stale/hybrid_platforms_conductor/nodes_handler.rb',
|
99
|
+
diff: <<~EOS.strip
|
100
|
+
index e8e1778..69a84bd 100644
|
101
|
+
--- a/lib/hybrid_platforms_conductor/nodes_handler.rb
|
102
|
+
+++ b/lib/hybrid_platforms_conductor/nodes_handler.rb
|
103
|
+
@@ -133,6 +133,23 @@ module HybridPlatformsConductor
|
104
|
+
options_parser.on('-l', '--nodes-list LIST', 'Select nodes defined in a nodes list (can be used several times)') do |nodes_list|
|
105
|
+
nodes_selectors << { list: nodes_list }
|
106
|
+
end
|
107
|
+
+ options_parser.on(
|
108
|
+
+ '--nodes-git-impact GIT_IMPACT',
|
109
|
+
nodes_selectors << node
|
110
|
+
end
|
111
|
+
EOS
|
112
|
+
}
|
113
|
+
)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'returns the impacted nodes given by the platform handler' do
|
119
|
+
with_test_platforms(
|
120
|
+
{
|
121
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
122
|
+
'my_remote_platform' => {
|
123
|
+
nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} },
|
124
|
+
impacted_nodes: %w[node1 node3]
|
125
|
+
}
|
126
|
+
},
|
127
|
+
true
|
128
|
+
) do
|
129
|
+
with_cmd_runner_mocked([
|
130
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
131
|
+
]) do
|
132
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
133
|
+
%w[node1 node3],
|
134
|
+
%w[node1 node3],
|
135
|
+
[],
|
136
|
+
false
|
137
|
+
]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'returns the impacted services given by the platform handler' do
|
143
|
+
with_test_platforms(
|
144
|
+
{
|
145
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
146
|
+
'my_remote_platform' => {
|
147
|
+
nodes: {
|
148
|
+
'node1' => { services: %w[service1 service2] },
|
149
|
+
'node2' => { services: %w[service1 service3] },
|
150
|
+
'node3' => { services: %w[service2 service4] }
|
151
|
+
},
|
152
|
+
impacted_services: %w[service1 service3]
|
153
|
+
}
|
154
|
+
},
|
155
|
+
true
|
156
|
+
) do
|
157
|
+
with_cmd_runner_mocked([
|
158
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
159
|
+
]) do
|
160
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
161
|
+
%w[node1 node2],
|
162
|
+
[],
|
163
|
+
%w[service1 service3],
|
164
|
+
false
|
165
|
+
]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'returns the impacted global given by the platform handler' do
|
171
|
+
with_test_platforms(
|
172
|
+
{
|
173
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
174
|
+
'my_remote_platform' => {
|
175
|
+
nodes: {
|
176
|
+
'node1' => { services: %w[service1 service2] },
|
177
|
+
'node2' => { services: %w[service1 service3] },
|
178
|
+
'node3' => { services: %w[service2 service4] }
|
179
|
+
},
|
180
|
+
impacted_global: true
|
181
|
+
}
|
182
|
+
},
|
183
|
+
true
|
184
|
+
) do
|
185
|
+
with_cmd_runner_mocked([
|
186
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
187
|
+
]) do
|
188
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
189
|
+
%w[node1 node2 node3],
|
190
|
+
[],
|
191
|
+
[],
|
192
|
+
true
|
193
|
+
]
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'returns the impacted nodes given by the platform handler' do
|
199
|
+
with_test_platforms(
|
200
|
+
{
|
201
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
202
|
+
'my_remote_platform' => {
|
203
|
+
nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} },
|
204
|
+
impacted_nodes: %w[node1 node3]
|
205
|
+
}
|
206
|
+
},
|
207
|
+
true
|
208
|
+
) do
|
209
|
+
with_cmd_runner_mocked([
|
210
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
211
|
+
]) do
|
212
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
213
|
+
%w[node1 node3],
|
214
|
+
%w[node1 node3],
|
215
|
+
[],
|
216
|
+
false
|
217
|
+
]
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'returns both impacted services and nodes given by the platform handler' do
|
223
|
+
with_test_platforms(
|
224
|
+
{
|
225
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
226
|
+
'my_remote_platform' => {
|
227
|
+
nodes: {
|
228
|
+
'node1' => { services: %w[service1 service2] },
|
229
|
+
'node2' => { services: %w[service1 service3] },
|
230
|
+
'node3' => { services: %w[service2 service4] },
|
231
|
+
'node4' => { services: %w[service2 service4] }
|
232
|
+
},
|
233
|
+
impacted_nodes: %w[node4],
|
234
|
+
impacted_services: %w[service1 service3]
|
235
|
+
}
|
236
|
+
},
|
237
|
+
true
|
238
|
+
) do
|
239
|
+
with_cmd_runner_mocked([
|
240
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
241
|
+
]) do
|
242
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
243
|
+
%w[node1 node2 node4],
|
244
|
+
%w[node4],
|
245
|
+
%w[service1 service3],
|
246
|
+
false
|
247
|
+
]
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'returns all nodes of impacted services' do
|
253
|
+
with_test_platforms(
|
254
|
+
{
|
255
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
256
|
+
'my_remote_platform' => {
|
257
|
+
nodes: {
|
258
|
+
'node1' => { services: %w[service1 service2] },
|
259
|
+
'node2' => { services: %w[service1 service3] },
|
260
|
+
'node3' => { services: %w[service2 service4] },
|
261
|
+
'node4' => { services: %w[service2 service4] },
|
262
|
+
'node5' => { services: %w[service3 service4] },
|
263
|
+
'node6' => { services: %w[service3 service4] },
|
264
|
+
'node7' => { services: %w[service1 service4] }
|
265
|
+
},
|
266
|
+
impacted_services: %w[service2 service3]
|
267
|
+
}
|
268
|
+
},
|
269
|
+
true
|
270
|
+
) do
|
271
|
+
with_cmd_runner_mocked([
|
272
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
273
|
+
]) do
|
274
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform')).to eq [
|
275
|
+
%w[node1 node2 node3 node4 node5 node6],
|
276
|
+
[],
|
277
|
+
%w[service2 service3],
|
278
|
+
false
|
279
|
+
]
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'returns the minimal subset of nodes impacted by services' do
|
285
|
+
with_test_platforms(
|
286
|
+
{
|
287
|
+
'other_platform' => { nodes: { 'other_node_1' => {}, 'other_node_2' => {} } },
|
288
|
+
'my_remote_platform' => {
|
289
|
+
nodes: {
|
290
|
+
'node1' => { services: %w[service1 service2] },
|
291
|
+
'node2' => { services: %w[service1 service3] },
|
292
|
+
'node3' => { services: %w[service2 service4] },
|
293
|
+
'node4' => { services: %w[service2 service4] },
|
294
|
+
'node5' => { services: %w[service3 service4] },
|
295
|
+
'node6' => { services: %w[service3 service4] },
|
296
|
+
'node7' => { services: %w[service1 service4] }
|
297
|
+
},
|
298
|
+
impacted_services: %w[service2 service3]
|
299
|
+
}
|
300
|
+
},
|
301
|
+
true
|
302
|
+
) do
|
303
|
+
with_cmd_runner_mocked([
|
304
|
+
[/cd .+\/my_remote_platform && git --no-pager diff --no-color master/, proc { [0, '', ''] }]
|
305
|
+
]) do
|
306
|
+
expect(test_nodes_handler.impacted_nodes_from_git_diff('my_remote_platform', smallest_set: true)).to eq [
|
307
|
+
%w[node1 node2],
|
308
|
+
[],
|
309
|
+
%w[service2 service3],
|
310
|
+
false
|
311
|
+
]
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
317
|
+
|
318
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
describe HybridPlatformsConductor::NodesHandler do
|
2
|
+
|
3
|
+
context 'checking nodes selection capabilities' do
|
4
|
+
|
5
|
+
# Set the test environment with a given list of nodes for our tests
|
6
|
+
#
|
7
|
+
# Parameters::
|
8
|
+
# * Proc: Code called when environment is ready
|
9
|
+
def with_test_platform_for_nodes
|
10
|
+
with_test_platforms(
|
11
|
+
'platform1' => {
|
12
|
+
nodes: { 'node1' => {}, 'node2' => { services: ['service1'] }, 'node3' => { services: ['service2'] } },
|
13
|
+
nodes_lists: { 'nodeslist1' => %w[node1 node3], 'nodeslist2' => ['/node[12]/'] }
|
14
|
+
},
|
15
|
+
'platform2' => {
|
16
|
+
nodes: { 'node4' => {}, 'node5' => { services: ['service3', 'service1'] }, 'node6' => {} }
|
17
|
+
}
|
18
|
+
) do
|
19
|
+
yield
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# List all tests of nodes selectors, and the corresponding nodes list they should be resolved into
|
24
|
+
{
|
25
|
+
[] => [],
|
26
|
+
[{ all: true }] => %w[node1 node2 node3 node4 node5 node6],
|
27
|
+
'node1' => %w[node1],
|
28
|
+
'/node[12]/' => %w[node1 node2],
|
29
|
+
[{ list: 'nodeslist1' }] => %w[node1 node3],
|
30
|
+
[{ list: 'nodeslist2' }] => %w[node1 node2],
|
31
|
+
[{ platform: 'platform2' }] => %w[node4 node5 node6],
|
32
|
+
[{ service: 'service1' }] => %w[node2 node5],
|
33
|
+
['/node[12]/', { service: 'service1' }] => %w[node1 node2 node5],
|
34
|
+
[{ git_diff: { platform: 'platform2' } }] => %w[node4 node5 node6]
|
35
|
+
}.each do |nodes_selectors, expected_nodes|
|
36
|
+
|
37
|
+
it "selects nodes correctly: #{nodes_selectors} resolves to #{expected_nodes}" do
|
38
|
+
with_test_platform_for_nodes do
|
39
|
+
expect(test_nodes_handler.select_nodes([])).to eq []
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'fails when selecting unknown nodes' do
|
46
|
+
with_test_platform_for_nodes do
|
47
|
+
expect { test_nodes_handler.select_nodes('node1', 'node7') }.to raise_error(RuntimeError, 'Unknown nodes: node7')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'ignore unknown nodes when asked' do
|
52
|
+
with_test_platform_for_nodes do
|
53
|
+
expect(test_nodes_handler.select_nodes(['node1', 'node7'], ignore_unknowns: true).sort).to eq %w[node1 node7].sort
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'selects the correct diff impacts' do
|
58
|
+
with_test_platform_for_nodes do
|
59
|
+
expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
|
60
|
+
'platform2',
|
61
|
+
from_commit: 'master',
|
62
|
+
to_commit: nil,
|
63
|
+
smallest_set: false
|
64
|
+
) { [%w[node4 node6], [], [], false] }
|
65
|
+
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2' } }]).sort).to eq %w[node4 node6].sort
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'selects the correct diff impacts with from commit' do
|
70
|
+
with_test_platform_for_nodes do
|
71
|
+
expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
|
72
|
+
'platform2',
|
73
|
+
from_commit: 'from_commit',
|
74
|
+
to_commit: nil,
|
75
|
+
smallest_set: false
|
76
|
+
) { [%w[node4 node6], [], [], false] }
|
77
|
+
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2', from_commit: 'from_commit' } }]).sort).to eq %w[node4 node6].sort
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'selects the correct diff impacts with to commit' do
|
82
|
+
with_test_platform_for_nodes do
|
83
|
+
expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
|
84
|
+
'platform2',
|
85
|
+
from_commit: 'master',
|
86
|
+
to_commit: 'to_commit',
|
87
|
+
smallest_set: false
|
88
|
+
) { [%w[node4 node6], [], [], false] }
|
89
|
+
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2', to_commit: 'to_commit' } }]).sort).to eq %w[node4 node6].sort
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'selects the correct diff impacts with smallest set' do
|
94
|
+
with_test_platform_for_nodes do
|
95
|
+
expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
|
96
|
+
'platform2',
|
97
|
+
from_commit: 'master',
|
98
|
+
to_commit: nil,
|
99
|
+
smallest_set: true
|
100
|
+
) { [%w[node4 node6], [], [], false] }
|
101
|
+
expect(test_nodes_handler.select_nodes([{ git_diff: { platform: 'platform2', smallest_set: true } }]).sort).to eq %w[node4 node6].sort
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'considers all nodes for en empty nodes selector stack' do
|
106
|
+
with_test_platform_for_nodes do
|
107
|
+
expect(test_nodes_handler.select_from_nodes_selector_stack([]).sort).to eq %w[node1 node2 node3 node4 node5 node6].sort
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'considers nodes selector intersection in a nodes selector stack' do
|
112
|
+
with_test_platform_for_nodes do
|
113
|
+
expect(test_nodes_handler.select_from_nodes_selector_stack([
|
114
|
+
%w[node1 node2 node3],
|
115
|
+
%w[node2 node3 node4]
|
116
|
+
]).sort).to eq %w[node2 node3].sort
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'considers nodes selector intersection between different kind of selectors in a nodes selector stack' do
|
121
|
+
with_test_platform_for_nodes do
|
122
|
+
expect(test_nodes_handler.select_from_nodes_selector_stack([
|
123
|
+
'/node[1256]/',
|
124
|
+
[{ platform: 'platform2' }],
|
125
|
+
[{ service: 'service1' }]
|
126
|
+
]).sort).to eq %w[node5].sort
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|