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.
Files changed (244) hide show
  1. checksums.yaml +7 -0
  2. data/bin/check-node +24 -0
  3. data/bin/deploy +12 -0
  4. data/bin/dump_nodes_json +12 -0
  5. data/bin/free_ips +23 -0
  6. data/bin/free_veids +17 -0
  7. data/bin/get_impacted_nodes +43 -0
  8. data/bin/last_deploys +56 -0
  9. data/bin/nodes_to_deploy +104 -0
  10. data/bin/report +10 -0
  11. data/bin/run +39 -0
  12. data/bin/setup +11 -0
  13. data/bin/ssh_config +14 -0
  14. data/bin/test +13 -0
  15. data/bin/topograph +54 -0
  16. data/lib/hybrid_platforms_conductor/action.rb +82 -0
  17. data/lib/hybrid_platforms_conductor/actions_executor.rb +307 -0
  18. data/lib/hybrid_platforms_conductor/bitbucket.rb +123 -0
  19. data/lib/hybrid_platforms_conductor/cmd_runner.rb +188 -0
  20. data/lib/hybrid_platforms_conductor/cmdb.rb +34 -0
  21. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +78 -0
  22. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +43 -0
  23. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +110 -0
  24. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +38 -0
  25. data/lib/hybrid_platforms_conductor/config.rb +263 -0
  26. data/lib/hybrid_platforms_conductor/confluence.rb +119 -0
  27. data/lib/hybrid_platforms_conductor/connector.rb +84 -0
  28. data/lib/hybrid_platforms_conductor/credentials.rb +127 -0
  29. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +42 -0
  30. data/lib/hybrid_platforms_conductor/deployer.rb +598 -0
  31. data/lib/hybrid_platforms_conductor/executable.rb +145 -0
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb +44 -0
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb +44 -0
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample +79 -0
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +63 -0
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/action/ruby.rb +69 -0
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +61 -0
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +78 -0
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +104 -0
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +114 -0
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/my_cmdb.rb.sample +129 -0
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +66 -0
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +156 -0
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +702 -0
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +292 -0
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +148 -0
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/my_provisioner.rb.sample +103 -0
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +125 -0
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +522 -0
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +707 -0
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +122 -0
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +69 -0
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +164 -0
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/report/my_report_plugin.rb.sample +88 -0
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +61 -0
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +33 -0
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +137 -0
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/test/can_be_checked.rb +21 -0
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +112 -0
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_from_scratch.rb +35 -0
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/connection.rb +28 -0
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +44 -0
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_from_scratch.rb +36 -0
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +49 -0
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +25 -0
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +46 -0
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +45 -0
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +45 -0
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +25 -0
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +77 -0
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +38 -0
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +56 -0
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +54 -0
  74. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +47 -0
  75. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +82 -0
  76. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +120 -0
  77. data/lib/hybrid_platforms_conductor/hpc_plugins/test/my_test_plugin.rb.sample +143 -0
  78. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +74 -0
  79. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +85 -0
  80. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +38 -0
  81. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +38 -0
  82. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre-meltdown-checker.sh +1930 -0
  83. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +56 -0
  84. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +31 -0
  85. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +159 -0
  86. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +122 -0
  87. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/my_test_report.rb.sample +48 -0
  88. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +120 -0
  89. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_errors_status.html.erb +46 -0
  90. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/_confluence_gauge.html.erb +49 -0
  91. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +242 -0
  92. data/lib/hybrid_platforms_conductor/io_router.rb +70 -0
  93. data/lib/hybrid_platforms_conductor/json_dumper.rb +88 -0
  94. data/lib/hybrid_platforms_conductor/logger_helpers.rb +319 -0
  95. data/lib/hybrid_platforms_conductor/mutex_dir +76 -0
  96. data/lib/hybrid_platforms_conductor/nodes_handler.rb +597 -0
  97. data/lib/hybrid_platforms_conductor/parallel_threads.rb +97 -0
  98. data/lib/hybrid_platforms_conductor/platform_handler.rb +188 -0
  99. data/lib/hybrid_platforms_conductor/platforms_handler.rb +118 -0
  100. data/lib/hybrid_platforms_conductor/plugin.rb +53 -0
  101. data/lib/hybrid_platforms_conductor/plugins.rb +101 -0
  102. data/lib/hybrid_platforms_conductor/provisioner.rb +181 -0
  103. data/lib/hybrid_platforms_conductor/report.rb +31 -0
  104. data/lib/hybrid_platforms_conductor/reports_handler.rb +84 -0
  105. data/lib/hybrid_platforms_conductor/services_handler.rb +274 -0
  106. data/lib/hybrid_platforms_conductor/test.rb +141 -0
  107. data/lib/hybrid_platforms_conductor/test_by_service.rb +22 -0
  108. data/lib/hybrid_platforms_conductor/test_report.rb +282 -0
  109. data/lib/hybrid_platforms_conductor/tests_runner.rb +590 -0
  110. data/lib/hybrid_platforms_conductor/thycotic.rb +92 -0
  111. data/lib/hybrid_platforms_conductor/topographer.rb +859 -0
  112. data/lib/hybrid_platforms_conductor/topographer/plugin.rb +20 -0
  113. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +127 -0
  114. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +72 -0
  115. data/lib/hybrid_platforms_conductor/topographer/plugins/my_topographer_output_plugin.rb.sample +37 -0
  116. data/lib/hybrid_platforms_conductor/topographer/plugins/svg.rb +30 -0
  117. data/lib/hybrid_platforms_conductor/version.rb +5 -0
  118. data/spec/hybrid_platforms_conductor_test.rb +159 -0
  119. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +43 -0
  120. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +18 -0
  121. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +102 -0
  122. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +108 -0
  123. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +79 -0
  124. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +199 -0
  125. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +212 -0
  126. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +125 -0
  127. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +50 -0
  128. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +28 -0
  129. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +448 -0
  130. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +313 -0
  131. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +32 -0
  132. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +134 -0
  133. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +256 -0
  134. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +338 -0
  135. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +101 -0
  136. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +165 -0
  137. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +238 -0
  138. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +9 -0
  139. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +243 -0
  140. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +104 -0
  141. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +131 -0
  142. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker/Dockerfile +10 -0
  143. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +123 -0
  144. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +211 -0
  145. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +126 -0
  146. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +290 -0
  147. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +43 -0
  148. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +60 -0
  149. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/proxmox.json +3 -0
  150. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +82 -0
  151. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +786 -0
  152. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +112 -0
  153. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +190 -0
  154. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +200 -0
  155. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +35 -0
  156. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +67 -0
  157. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +79 -0
  158. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +28 -0
  159. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +41 -0
  160. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +33 -0
  161. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +64 -0
  162. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +133 -0
  163. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +19 -0
  164. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +446 -0
  165. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +127 -0
  166. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +318 -0
  167. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +132 -0
  168. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +60 -0
  169. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +58 -0
  170. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +97 -0
  171. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +104 -0
  172. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +243 -0
  173. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +44 -0
  174. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +121 -0
  175. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +142 -0
  176. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +101 -0
  177. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +388 -0
  178. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +274 -0
  179. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +264 -0
  180. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +194 -0
  181. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +37 -0
  182. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +194 -0
  183. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +137 -0
  184. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +257 -0
  185. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +110 -0
  186. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +367 -0
  187. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +111 -0
  188. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +29 -0
  189. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +166 -0
  190. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb2.rb +93 -0
  191. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +60 -0
  192. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others2.rb +58 -0
  193. data/spec/hybrid_platforms_conductor_test/executables/check-node_spec.rb +35 -0
  194. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +35 -0
  195. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +158 -0
  196. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +173 -0
  197. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +283 -0
  198. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +28 -0
  199. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +28 -0
  200. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +67 -0
  201. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +251 -0
  202. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +111 -0
  203. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +71 -0
  204. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +54 -0
  205. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +139 -0
  206. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +60 -0
  207. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +173 -0
  208. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +35 -0
  209. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +41 -0
  210. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +98 -0
  211. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +92 -0
  212. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +37 -0
  213. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +20 -0
  214. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +130 -0
  215. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +149 -0
  216. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +812 -0
  217. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +96 -0
  218. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +20 -0
  219. data/spec/hybrid_platforms_conductor_test/helpers/platform_handler_helpers.rb +35 -0
  220. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +127 -0
  221. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +48 -0
  222. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +789 -0
  223. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +29 -0
  224. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +20 -0
  225. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +38 -0
  226. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id1.rb +22 -0
  227. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/test_plugin_id2.rb +22 -0
  228. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/test_plugin_id3.rb +26 -0
  229. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type2/test_plugin_id4.rb +26 -0
  230. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +225 -0
  231. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test2.rb +11 -0
  232. data/spec/hybrid_platforms_conductor_test/report_plugin.rb +35 -0
  233. data/spec/hybrid_platforms_conductor_test/test_action.rb +66 -0
  234. data/spec/hybrid_platforms_conductor_test/test_connector.rb +151 -0
  235. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +30 -0
  236. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +53 -0
  237. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +47 -0
  238. data/spec/hybrid_platforms_conductor_test/test_plugins/node_ssh.rb +42 -0
  239. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +50 -0
  240. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +50 -0
  241. data/spec/hybrid_platforms_conductor_test/test_provisioner.rb +95 -0
  242. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +49 -0
  243. data/spec/spec_helper.rb +111 -0
  244. metadata +566 -0
@@ -0,0 +1,274 @@
1
+ describe HybridPlatformsConductor::ServicesHandler do
2
+
3
+ context 'checking parsing deployment outputs' do
4
+
5
+ it 'parses a deployment log for a node' do
6
+ with_test_platform(
7
+ nodes: { 'node' => { services: %w[service1] } },
8
+ deployable_services: %w[service1],
9
+ parse_deploy_output: proc do |stdout, stderr|
10
+ expect(stdout.strip).to eq 'Task1: ok'
11
+ expect(stderr.strip).to eq 'Service1 stderr'
12
+ [{ name: 'Task1', status: :identical }]
13
+ end
14
+ ) do
15
+ stdout = <<~EOS_STDOUT
16
+ First log lines
17
+ ===== [ node / service1 ] - HPC Service Deploy ===== Begin
18
+ Task1: ok
19
+ ===== [ node / service1 ] - HPC Service Deploy ===== End
20
+ Last log lines
21
+ EOS_STDOUT
22
+ stderr = <<~EOS_STDERR
23
+ ===== [ node / service1 ] - HPC Service Deploy ===== Begin
24
+ Service1 stderr
25
+ ===== [ node / service1 ] - HPC Service Deploy ===== End
26
+ EOS_STDERR
27
+ expect(test_services_handler.parse_deploy_output(stdout, stderr)).to eq [
28
+ {
29
+ node: 'node',
30
+ service: 'service1',
31
+ check: false,
32
+ tasks: [{ name: 'Task1', status: :identical }]
33
+ }
34
+ ]
35
+ end
36
+ end
37
+
38
+ it 'parses a deployment log for a node in check mode' do
39
+ with_test_platform(
40
+ nodes: { 'node' => { services: %w[service1] } },
41
+ deployable_services: %w[service1],
42
+ parse_deploy_output: proc do |stdout, stderr|
43
+ expect(stdout.strip).to eq 'Task1: ok'
44
+ expect(stderr.strip).to eq 'Service1 stderr'
45
+ [{ name: 'Task1', status: :identical }]
46
+ end
47
+ ) do
48
+ stdout = <<~EOS_STDOUT
49
+ First log lines
50
+ ===== [ node / service1 ] - HPC Service Check ===== Begin
51
+ Task1: ok
52
+ ===== [ node / service1 ] - HPC Service Check ===== End
53
+ Last log lines
54
+ EOS_STDOUT
55
+ stderr = <<~EOS_STDERR
56
+ ===== [ node / service1 ] - HPC Service Check ===== Begin
57
+ Service1 stderr
58
+ ===== [ node / service1 ] - HPC Service Check ===== End
59
+ EOS_STDERR
60
+ expect(test_services_handler.parse_deploy_output(stdout, stderr)).to eq [
61
+ {
62
+ node: 'node',
63
+ service: 'service1',
64
+ check: true,
65
+ tasks: [{ name: 'Task1', status: :identical }]
66
+ }
67
+ ]
68
+ end
69
+ end
70
+
71
+ it 'parses a deployment log for a node even if stderr is empty' do
72
+ with_test_platform(
73
+ nodes: { 'node' => { services: %w[service1] } },
74
+ deployable_services: %w[service1],
75
+ parse_deploy_output: proc do |stdout, stderr|
76
+ expect(stdout.strip).to eq 'Task1: ok'
77
+ expect(stderr.strip).to eq ''
78
+ [{ name: 'Task1', status: :identical }]
79
+ end
80
+ ) do
81
+ stdout = <<~EOS_STDOUT
82
+ First log lines
83
+ ===== [ node / service1 ] - HPC Service Deploy ===== Begin
84
+ Task1: ok
85
+ ===== [ node / service1 ] - HPC Service Deploy ===== End
86
+ Last log lines
87
+ EOS_STDOUT
88
+ expect(test_services_handler.parse_deploy_output(stdout, '')).to eq [
89
+ {
90
+ node: 'node',
91
+ service: 'service1',
92
+ check: false,
93
+ tasks: [{ name: 'Task1', status: :identical }]
94
+ }
95
+ ]
96
+ end
97
+ end
98
+
99
+ it 'parses a deployment log for a node deploying several services' do
100
+ with_test_platform(
101
+ nodes: { 'node' => { services: %w[service1 service2] } },
102
+ deployable_services: %w[service1 service2],
103
+ parse_deploy_output: proc do |stdout, stderr|
104
+ task_name, status_str = stdout.match(/^(.+?): (.+)$/)[1..2]
105
+ expect(stderr.strip).to eq "#{task_name} stderr"
106
+ [{ name: task_name, status: status_str.to_sym }]
107
+ end
108
+ ) do
109
+ stdout = <<~EOS_STDOUT
110
+ First log lines
111
+ ===== [ node / service1 ] - HPC Service Deploy ===== Begin
112
+ Task1: identical
113
+ ===== [ node / service1 ] - HPC Service Deploy ===== End
114
+ Other log lines
115
+ ===== [ node / service2 ] - HPC Service Deploy ===== Begin
116
+ Task2: identical
117
+ ===== [ node / service2 ] - HPC Service Deploy ===== End
118
+ Last log lines
119
+ EOS_STDOUT
120
+ stderr = <<~EOS_STDERR
121
+ ===== [ node / service1 ] - HPC Service Deploy ===== Begin
122
+ Task1 stderr
123
+ ===== [ node / service1 ] - HPC Service Deploy ===== End
124
+ ===== [ node / service2 ] - HPC Service Deploy ===== Begin
125
+ Task2 stderr
126
+ ===== [ node / service2 ] - HPC Service Deploy ===== End
127
+ EOS_STDERR
128
+ expect(test_services_handler.parse_deploy_output(stdout, stderr)).to eq [
129
+ {
130
+ node: 'node',
131
+ service: 'service1',
132
+ check: false,
133
+ tasks: [{ name: 'Task1', status: :identical }]
134
+ },
135
+ {
136
+ node: 'node',
137
+ service: 'service2',
138
+ check: false,
139
+ tasks: [{ name: 'Task2', status: :identical }]
140
+ }
141
+ ]
142
+ end
143
+ end
144
+
145
+ it 'parses a deployment log for several nodes deploying several services' do
146
+ with_test_platform(
147
+ nodes: { 'node1' => { services: %w[service1 service2] }, 'node2' => { services: %w[service1 service2] } },
148
+ deployable_services: %w[service1 service2],
149
+ parse_deploy_output: proc do |stdout, stderr|
150
+ task_name, status_str = stdout.match(/^(.+?): (.+)$/)[1..2]
151
+ expect(stderr.strip).to eq "#{task_name} stderr"
152
+ [{ name: task_name, status: status_str.to_sym }]
153
+ end
154
+ ) do
155
+ stdout = <<~EOS_STDOUT
156
+ First log lines
157
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== Begin
158
+ Task11: identical
159
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== End
160
+ ===== [ node2 / service2 ] - HPC Service Check ===== Begin
161
+ Task22: identical
162
+ ===== [ node2 / service2 ] - HPC Service Check ===== End
163
+ Other log lines
164
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== Begin
165
+ Task12: identical
166
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== End
167
+ Last log lines
168
+ EOS_STDOUT
169
+ stderr = <<~EOS_STDERR
170
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== Begin
171
+ Task11 stderr
172
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== End
173
+ ===== [ node2 / service2 ] - HPC Service Check ===== Begin
174
+ Task22 stderr
175
+ ===== [ node2 / service2 ] - HPC Service Check ===== End
176
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== Begin
177
+ Task12 stderr
178
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== End
179
+ EOS_STDERR
180
+ expect(test_services_handler.parse_deploy_output(stdout, stderr)).to eq [
181
+ {
182
+ node: 'node1',
183
+ service: 'service1',
184
+ check: false,
185
+ tasks: [{ name: 'Task11', status: :identical }]
186
+ },
187
+ {
188
+ node: 'node2',
189
+ service: 'service2',
190
+ check: true,
191
+ tasks: [{ name: 'Task22', status: :identical }]
192
+ },
193
+ {
194
+ node: 'node1',
195
+ service: 'service2',
196
+ check: false,
197
+ tasks: [{ name: 'Task12', status: :identical }]
198
+ }
199
+ ]
200
+ end
201
+ end
202
+
203
+ it 'parses a deployment log for several nodes deploying several services using different platforms' do
204
+ with_test_platforms(
205
+ 'platform1' => {
206
+ nodes: { 'node1' => { services: %w[service1 service2] }, 'node2' => { services: %w[service1 service2] } },
207
+ deployable_services: %w[service1],
208
+ parse_deploy_output: proc do |stdout, stderr|
209
+ task_name, status_str = stdout.match(/^(.+?1): (.+)$/)[1..2]
210
+ expect(stderr.strip).to eq "#{task_name} stderr"
211
+ [{ name: task_name, status: status_str.to_sym }]
212
+ end
213
+ },
214
+ 'platform2' => {
215
+ nodes: {},
216
+ deployable_services: %w[service2],
217
+ parse_deploy_output: proc do |stdout, stderr|
218
+ task_name, status_str = stdout.match(/^(.+?2): (.+)$/)[1..2]
219
+ expect(stderr.strip).to eq "#{task_name} stderr"
220
+ [{ name: task_name, status: status_str.to_sym }]
221
+ end
222
+ },
223
+ ) do
224
+ stdout = <<~EOS_STDOUT
225
+ First log lines
226
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== Begin
227
+ Task11: identical
228
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== End
229
+ ===== [ node2 / service2 ] - HPC Service Check ===== Begin
230
+ Task22: identical
231
+ ===== [ node2 / service2 ] - HPC Service Check ===== End
232
+ Other log lines
233
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== Begin
234
+ Task12: identical
235
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== End
236
+ Last log lines
237
+ EOS_STDOUT
238
+ stderr = <<~EOS_STDERR
239
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== Begin
240
+ Task11 stderr
241
+ ===== [ node1 / service1 ] - HPC Service Deploy ===== End
242
+ ===== [ node2 / service2 ] - HPC Service Check ===== Begin
243
+ Task22 stderr
244
+ ===== [ node2 / service2 ] - HPC Service Check ===== End
245
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== Begin
246
+ Task12 stderr
247
+ ===== [ node1 / service2 ] - HPC Service Deploy ===== End
248
+ EOS_STDERR
249
+ expect(test_services_handler.parse_deploy_output(stdout, stderr)).to eq [
250
+ {
251
+ node: 'node1',
252
+ service: 'service1',
253
+ check: false,
254
+ tasks: [{ name: 'Task11', status: :identical }]
255
+ },
256
+ {
257
+ node: 'node2',
258
+ service: 'service2',
259
+ check: true,
260
+ tasks: [{ name: 'Task22', status: :identical }]
261
+ },
262
+ {
263
+ node: 'node1',
264
+ service: 'service2',
265
+ check: false,
266
+ tasks: [{ name: 'Task12', status: :identical }]
267
+ }
268
+ ]
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end
@@ -0,0 +1,264 @@
1
+ describe HybridPlatformsConductor::ServicesHandler do
2
+
3
+ context 'checking preparation for deployment' do
4
+
5
+ it 'prepares 1 platform' do
6
+ called = false
7
+ with_test_platform(
8
+ nodes: { 'node1' => { services: %w[service1] }, 'node2' => {}, 'node3' => {} },
9
+ deployable_services: %w[service1],
10
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
11
+ expect(services).to eq('node1' => %w[service1])
12
+ expect(secrets).to eq({})
13
+ expect(local_environment).to eq false
14
+ expect(why_run).to eq false
15
+ called = true
16
+ end
17
+ ) do
18
+ test_services_handler.prepare_for_deploy(
19
+ services: { 'node1' => %w[service1] },
20
+ secrets: {},
21
+ local_environment: false,
22
+ why_run: false
23
+ )
24
+ expect(called).to eq true
25
+ end
26
+ end
27
+
28
+ it 'prepares 1 platform with secrets' do
29
+ called = false
30
+ with_test_platform(
31
+ nodes: { 'node1' => { services: %w[service1] }, 'node2' => {}, 'node3' => {} },
32
+ deployable_services: %w[service1],
33
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
34
+ expect(services).to eq('node1' => %w[service1])
35
+ expect(secrets).to eq('my_secret' => 'value')
36
+ expect(local_environment).to eq false
37
+ expect(why_run).to eq false
38
+ called = true
39
+ end
40
+ ) do
41
+ test_services_handler.prepare_for_deploy(
42
+ services: { 'node1' => %w[service1] },
43
+ secrets: { 'my_secret' => 'value' },
44
+ local_environment: false,
45
+ why_run: false
46
+ )
47
+ expect(called).to eq true
48
+ end
49
+ end
50
+
51
+ it 'prepares 1 platform with local environment' do
52
+ called = false
53
+ with_test_platform(
54
+ nodes: { 'node1' => { services: %w[service1] }, 'node2' => {}, 'node3' => {} },
55
+ deployable_services: %w[service1],
56
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
57
+ expect(services).to eq('node1' => %w[service1])
58
+ expect(secrets).to eq({})
59
+ expect(local_environment).to eq true
60
+ expect(why_run).to eq false
61
+ called = true
62
+ end
63
+ ) do
64
+ test_services_handler.prepare_for_deploy(
65
+ services: { 'node1' => %w[service1] },
66
+ secrets: {},
67
+ local_environment: true,
68
+ why_run: false
69
+ )
70
+ expect(called).to eq true
71
+ end
72
+ end
73
+
74
+ it 'prepares 1 platform in why-run mode' do
75
+ called = false
76
+ with_test_platform(
77
+ nodes: { 'node1' => { services: %w[service1] }, 'node2' => {}, 'node3' => {} },
78
+ deployable_services: %w[service1],
79
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
80
+ expect(services).to eq('node1' => %w[service1])
81
+ expect(secrets).to eq({})
82
+ expect(local_environment).to eq false
83
+ expect(why_run).to eq true
84
+ called = true
85
+ end
86
+ ) do
87
+ test_services_handler.prepare_for_deploy(
88
+ services: { 'node1' => %w[service1] },
89
+ secrets: {},
90
+ local_environment: false,
91
+ why_run: true
92
+ )
93
+ expect(called).to eq true
94
+ end
95
+ end
96
+
97
+ it 'prepares several platforms' do
98
+ called = {
99
+ 'platform1' => false,
100
+ 'platform2' => false,
101
+ 'platform3' => false
102
+ }
103
+ with_test_platforms(
104
+ 'platform1' => {
105
+ nodes: { 'node1' => { services: %w[service1] } },
106
+ deployable_services: %w[service1],
107
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
108
+ expect(services).to eq('node1' => %w[service1])
109
+ expect(secrets).to eq({})
110
+ expect(local_environment).to eq false
111
+ expect(why_run).to eq false
112
+ called['platform1'] = true
113
+ end
114
+ },
115
+ 'platform2' => {
116
+ nodes: { 'node2' => { services: %w[service2] } },
117
+ deployable_services: %w[service2],
118
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
119
+ expect(services).to eq('node2' => %w[service2])
120
+ expect(secrets).to eq({})
121
+ expect(local_environment).to eq false
122
+ expect(why_run).to eq false
123
+ called['platform2'] = true
124
+ end
125
+ },
126
+ 'platform3' => {
127
+ nodes: { 'node3' => { services: %w[service3] } },
128
+ deployable_services: %w[service3],
129
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
130
+ expect(services).to eq('node3' => %w[service3])
131
+ expect(secrets).to eq({})
132
+ expect(local_environment).to eq false
133
+ expect(why_run).to eq false
134
+ called['platform3'] = true
135
+ end
136
+ }
137
+ ) do
138
+ test_services_handler.prepare_for_deploy(
139
+ services: { 'node1' => %w[service1], 'node2' => %w[service2], 'node3' => %w[service3] },
140
+ secrets: {},
141
+ local_environment: false,
142
+ why_run: false
143
+ )
144
+ expect(called).to eq(
145
+ 'platform1' => true,
146
+ 'platform2' => true,
147
+ 'platform3' => true
148
+ )
149
+ end
150
+ end
151
+
152
+ it 'prepares only concerned platforms' do
153
+ called = {
154
+ 'platform1' => false,
155
+ 'platform2' => false,
156
+ 'platform3' => false
157
+ }
158
+ with_test_platforms(
159
+ 'platform1' => {
160
+ nodes: { 'node1' => { services: %w[service1] } },
161
+ deployable_services: %w[service1],
162
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
163
+ expect(services).to eq('node1' => %w[service1])
164
+ expect(secrets).to eq({})
165
+ expect(local_environment).to eq false
166
+ expect(why_run).to eq false
167
+ called['platform1'] = true
168
+ end
169
+ },
170
+ 'platform2' => {
171
+ nodes: { 'node2' => { services: %w[service2] } },
172
+ deployable_services: %w[service2],
173
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
174
+ expect(services).to eq('node2' => %w[service2])
175
+ expect(secrets).to eq({})
176
+ expect(local_environment).to eq false
177
+ expect(why_run).to eq false
178
+ called['platform2'] = true
179
+ end
180
+ },
181
+ 'platform3' => {
182
+ nodes: { 'node3' => { services: %w[service3] } },
183
+ deployable_services: %w[service3],
184
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
185
+ expect(services).to eq('node1' => %w[service3])
186
+ expect(secrets).to eq({})
187
+ expect(local_environment).to eq false
188
+ expect(why_run).to eq false
189
+ called['platform3'] = true
190
+ end
191
+ }
192
+ ) do
193
+ test_services_handler.prepare_for_deploy(
194
+ services: { 'node1' => %w[service1 service3] },
195
+ secrets: {},
196
+ local_environment: false,
197
+ why_run: false
198
+ )
199
+ expect(called).to eq(
200
+ 'platform1' => true,
201
+ 'platform2' => false,
202
+ 'platform3' => true
203
+ )
204
+ end
205
+ end
206
+
207
+ it 'prepares platforms only with services they can deploy' do
208
+ called = {
209
+ 'platform1' => false,
210
+ 'platform2' => false,
211
+ 'platform3' => false
212
+ }
213
+ with_test_platforms(
214
+ 'platform1' => {
215
+ nodes: { 'node' => { services: %w[service1 service2 service3 service4 service5 service6] } },
216
+ deployable_services: %w[service1 service2],
217
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
218
+ expect(services).to eq('node' => %w[service1 service2])
219
+ expect(secrets).to eq({})
220
+ expect(local_environment).to eq false
221
+ expect(why_run).to eq false
222
+ called['platform1'] = true
223
+ end
224
+ },
225
+ 'platform2' => {
226
+ nodes: {},
227
+ deployable_services: %w[service3 service4],
228
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
229
+ expect(services).to eq('node' => %w[service3])
230
+ expect(secrets).to eq({})
231
+ expect(local_environment).to eq false
232
+ expect(why_run).to eq false
233
+ called['platform2'] = true
234
+ end
235
+ },
236
+ 'platform3' => {
237
+ nodes: {},
238
+ deployable_services: %w[service5 service6],
239
+ prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
240
+ expect(services).to eq('node' => %w[service5 service6])
241
+ expect(secrets).to eq({})
242
+ expect(local_environment).to eq false
243
+ expect(why_run).to eq false
244
+ called['platform3'] = true
245
+ end
246
+ }
247
+ ) do
248
+ test_services_handler.prepare_for_deploy(
249
+ services: { 'node' => %w[service1 service2 service3 service5 service6] },
250
+ secrets: {},
251
+ local_environment: false,
252
+ why_run: false
253
+ )
254
+ expect(called).to eq(
255
+ 'platform1' => true,
256
+ 'platform2' => true,
257
+ 'platform3' => true
258
+ )
259
+ end
260
+ end
261
+
262
+ end
263
+
264
+ end