hybrid_platforms_conductor 32.3.6

Sign up to get free protection for your applications and to get access to all the features.
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,9 @@
1
+ describe HybridPlatformsConductor::Deployer do
2
+
3
+ context 'checking why-run mode' do
4
+
5
+ deploy_specs_for(check_mode: true)
6
+
7
+ end
8
+
9
+ end
@@ -0,0 +1,243 @@
1
+ describe HybridPlatformsConductor::Deployer do
2
+
3
+ context 'checking real deploy mode' do
4
+
5
+ deploy_specs_for(check_mode: false)
6
+
7
+ # Expect the test services handler to be called to deploy a given list of services
8
+ #
9
+ # Parameters::
10
+ # * *services* (Hash<String, Array<String> >): List of services to be expected, per node name
11
+ def expect_services_handler_to_deploy(services)
12
+ expect(test_services_handler).to receive(:deploy_allowed?).with(
13
+ services: services,
14
+ secrets: {},
15
+ local_environment: false
16
+ ) do
17
+ nil
18
+ end
19
+ expect(test_services_handler).to receive(:package).with(
20
+ services: services,
21
+ secrets: {},
22
+ local_environment: false
23
+ )
24
+ expect(test_services_handler).to receive(:prepare_for_deploy).with(
25
+ services: services,
26
+ secrets: {},
27
+ local_environment: false,
28
+ why_run: false
29
+ )
30
+ services.each do |node, services|
31
+ expect(test_services_handler).to receive(:actions_to_deploy_on).with(node, services, false) do
32
+ [{ bash: "echo \"Deploying on #{node}\"" }]
33
+ end
34
+ expect(test_services_handler).to receive(:log_info_for).with(node, services) do
35
+ {
36
+ repo_name_0: 'platform',
37
+ commit_id_0: '123456',
38
+ commit_message_0: "Test commit for #{node}: #{services.join(', ')}"
39
+ }
40
+ end
41
+ end
42
+ end
43
+
44
+ it 'deploys correct logs information on 1 node' do
45
+ with_test_platform({ nodes: { 'node' => { services: %w[service1 service2] } } }, true) do
46
+ with_connections_mocked_on ['node'] do
47
+ test_actions_executor.connector(:ssh).ssh_user = 'test_user'
48
+ expect_services_handler_to_deploy('node' => %w[service1 service2])
49
+ expect_actions_executor_runs([
50
+ # First run, we expect the mutex to be setup, and the deployment actions to be run
51
+ proc { |actions_per_nodes| expect_actions_to_deploy_on(actions_per_nodes, 'node') },
52
+ # Second run, we expect the mutex to be released
53
+ proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, 'node') },
54
+ # Third run, we expect logs to be uploaded on the node
55
+ proc do |actions_per_nodes|
56
+ # Check logs content
57
+ local_log_file = actions_per_nodes['node'][:scp].first[0]
58
+ expect(File.exist?(local_log_file)).to eq true
59
+ expect_logs_to_be(File.read(local_log_file), 'Deploy successful', '',
60
+ date: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
61
+ user: 'test_user',
62
+ debug: 'No',
63
+ repo_name_0: 'platform',
64
+ commit_id_0: '123456',
65
+ commit_message_0: 'Test commit for node: service1, service2',
66
+ services: 'service1, service2',
67
+ exit_status: '0'
68
+ )
69
+ expect_actions_to_upload_logs(actions_per_nodes, 'node')
70
+ end
71
+ ])
72
+ expect(test_deployer.deploy_on('node')).to eq('node' => [0, 'Deploy successful', ''])
73
+ end
74
+ end
75
+ end
76
+
77
+ it 'deploys correct logs information on several nodes' do
78
+ with_test_platform({ nodes: {
79
+ 'node1' => { services: %w[service1] },
80
+ 'node2' => { services: %w[service2] }
81
+ } }, true) do
82
+ with_connections_mocked_on %w[node1 node2] do
83
+ test_actions_executor.connector(:ssh).ssh_user = 'test_user'
84
+ expect_services_handler_to_deploy(
85
+ 'node1' => %w[service1],
86
+ 'node2' => %w[service2]
87
+ )
88
+ expect_actions_executor_runs([
89
+ # First run, we expect the mutex to be setup, and the deployment actions to be run
90
+ proc { |actions_per_nodes| expect_actions_to_deploy_on(actions_per_nodes, %w[node1 node2]) },
91
+ # Second run, we expect the mutex to be released
92
+ proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, %w[node1 node2]) },
93
+ # Third run, we expect logs to be uploaded on the node
94
+ proc do |actions_per_nodes|
95
+ # Check logs content
96
+ local_log_file1 = actions_per_nodes['node1'][:scp].first[0]
97
+ expect(File.exist?(local_log_file1)).to eq true
98
+ expect_logs_to_be(File.read(local_log_file1), 'Deploy successful', '',
99
+ date: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
100
+ user: 'test_user',
101
+ debug: 'No',
102
+ repo_name_0: 'platform',
103
+ commit_id_0: '123456',
104
+ commit_message_0: 'Test commit for node1: service1',
105
+ services: 'service1',
106
+ exit_status: '0'
107
+ )
108
+ local_log_file2 = actions_per_nodes['node2'][:scp].first[0]
109
+ expect(File.exist?(local_log_file2)).to eq true
110
+ expect_logs_to_be(File.read(local_log_file2), 'Deploy successful', '',
111
+ date: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
112
+ user: 'test_user',
113
+ debug: 'No',
114
+ repo_name_0: 'platform',
115
+ commit_id_0: '123456',
116
+ commit_message_0: 'Test commit for node2: service2',
117
+ services: 'service2',
118
+ exit_status: '0'
119
+ )
120
+ expect_actions_to_upload_logs(actions_per_nodes, %w[node1 node2])
121
+ end
122
+ ])
123
+ expect(test_deployer.deploy_on(%w[node1 node2])).to eq(
124
+ 'node1' => [0, 'Deploy successful', ''],
125
+ 'node2' => [0, 'Deploy successful', '']
126
+ )
127
+ end
128
+ end
129
+ end
130
+
131
+ it 'deploys correct logs information on 1 node even when there is a failing deploy' do
132
+ with_test_platform({ nodes: { 'node' => { services: %w[service1 service2] } } }, true) do
133
+ with_connections_mocked_on ['node'] do
134
+ test_actions_executor.connector(:ssh).ssh_user = 'test_user'
135
+ expect_services_handler_to_deploy('node' => %w[service1 service2])
136
+ expect_actions_executor_runs([
137
+ # First run, we expect the mutex to be setup, and the deployment actions to be run
138
+ proc do |actions_per_nodes|
139
+ expect_actions_to_deploy_on(
140
+ actions_per_nodes,
141
+ 'node',
142
+ mocked_result: { 'node' => [:failed_action, "Failed deploy stdout\n", "Failed deploy stderr\n"] }
143
+ )
144
+ end,
145
+ # Second run, we expect the mutex to be released
146
+ proc { |actions_per_nodes| expect_actions_to_unlock(actions_per_nodes, 'node') },
147
+ # Third run, we expect logs to be uploaded on the node
148
+ proc do |actions_per_nodes|
149
+ # Check logs content
150
+ local_log_file = actions_per_nodes['node'][:scp].first[0]
151
+ expect(File.exist?(local_log_file)).to eq true
152
+ expect_logs_to_be(File.read(local_log_file), "Failed deploy stdout\n", 'Failed deploy stderr',
153
+ date: /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/,
154
+ user: 'test_user',
155
+ debug: 'No',
156
+ repo_name_0: 'platform',
157
+ commit_id_0: '123456',
158
+ commit_message_0: 'Test commit for node: service1, service2',
159
+ services: 'service1, service2',
160
+ exit_status: 'failed_action'
161
+ )
162
+ expect_actions_to_upload_logs(actions_per_nodes, 'node')
163
+ end
164
+ ])
165
+ expect(test_deployer.deploy_on('node')).to eq('node' => [:failed_action, "Failed deploy stdout\n", "Failed deploy stderr\n"])
166
+ end
167
+ end
168
+ end
169
+
170
+ it 'gets deployment info from log files' do
171
+ with_test_platform({ nodes: { 'node' => {} } }) do |repository|
172
+ expect_actions_executor_runs([
173
+ # Expect the actions to get log files
174
+ proc do |actions_per_nodes|
175
+ expect(actions_per_nodes).to eq('node' => { remote_bash: 'cd /var/log/deployments && ls -t | head -1 | xargs sed \'/===== STDOUT =====/q\'' })
176
+ { 'node' => [0, "Property1: Value1\nProperty2: Value2", ''] }
177
+ end
178
+ ])
179
+ expect(test_deployer.deployment_info_from('node')).to eq(
180
+ 'node' => {
181
+ Property1: 'Value1',
182
+ Property2: 'Value2'
183
+ }
184
+ )
185
+ end
186
+ end
187
+
188
+ it 'gets deployment info with some properties converted from log files' do
189
+ with_test_platform({ nodes: { 'node' => {} } }) do |repository|
190
+ expect_actions_executor_runs([
191
+ # Expect the actions to get log files
192
+ proc do |actions_per_nodes|
193
+ expect(actions_per_nodes).to eq('node' => { remote_bash: 'cd /var/log/deployments && ls -t | head -1 | xargs sed \'/===== STDOUT =====/q\'' })
194
+ { 'node' => [0, <<~EOS, ''] }
195
+ date: Thu Nov 23 18:43:01 UTC 2017
196
+ debug: Yes
197
+ diff_files_0: file1, file2, file3
198
+ services: service1, service2, service3
199
+ EOS
200
+ end
201
+ ])
202
+ expect(test_deployer.deployment_info_from('node')).to eq(
203
+ 'node' => {
204
+ date: Time.parse('2017-11-23 18:43:01 UTC'),
205
+ debug: true,
206
+ diff_files_0: %w[file1 file2 file3],
207
+ services: %w[service1 service2 service3]
208
+ }
209
+ )
210
+ end
211
+ end
212
+
213
+ it 'gets deployment info from several log files' do
214
+ with_test_platform({ nodes: { 'node1' => {}, 'node2' => {} } }) do |repository|
215
+ expect_actions_executor_runs([
216
+ # Expect the actions to get log files
217
+ proc do |actions_per_nodes|
218
+ expect(actions_per_nodes).to eq(
219
+ 'node1' => { remote_bash: 'cd /var/log/deployments && ls -t | head -1 | xargs sed \'/===== STDOUT =====/q\'' },
220
+ 'node2' => { remote_bash: 'cd /var/log/deployments && ls -t | head -1 | xargs sed \'/===== STDOUT =====/q\'' }
221
+ )
222
+ {
223
+ 'node1' => [0, "Property1: Value1\nProperty2: Value2", ''],
224
+ 'node2' => [0, "Property3: Value3\nProperty4: Value4", '']
225
+ }
226
+ end
227
+ ])
228
+ expect(test_deployer.deployment_info_from(%w[node1 node2])).to eq(
229
+ 'node1' => {
230
+ Property1: 'Value1',
231
+ Property2: 'Value2'
232
+ },
233
+ 'node2' => {
234
+ Property3: 'Value3',
235
+ Property4: 'Value4'
236
+ }
237
+ )
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -0,0 +1,104 @@
1
+ describe HybridPlatformsConductor::Deployer do
2
+
3
+ context 'checking parsing output of deployments' do
4
+
5
+ it 'returns tasks of deployment logs' do
6
+ with_test_platform do
7
+ expect(test_services_handler).to receive(:parse_deploy_output).with('stdout', 'stderr') do
8
+ [
9
+ {
10
+ node: 'node',
11
+ service: 'service',
12
+ check: false,
13
+ tasks: [
14
+ {
15
+ name: 'Task1',
16
+ status: :identical
17
+ },
18
+ {
19
+ name: 'Task2',
20
+ status: :changed,
21
+ diffs: 'Diffs for Task2'
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ end
27
+ expect(test_deployer.parse_deploy_output('node', 'stdout', 'stderr')).to eq [
28
+ {
29
+ name: 'Task1',
30
+ status: :identical
31
+ },
32
+ {
33
+ name: 'Task2',
34
+ status: :changed,
35
+ diffs: 'Diffs for Task2'
36
+ }
37
+ ]
38
+ end
39
+ end
40
+
41
+ it 'returns tasks of deployment logs from several services deployments' do
42
+ with_test_platform do
43
+ expect(test_services_handler).to receive(:parse_deploy_output).with('stdout', 'stderr') do
44
+ [
45
+ {
46
+ node: 'node1',
47
+ service: 'service1',
48
+ check: false,
49
+ tasks: [
50
+ {
51
+ name: 'Task1',
52
+ status: :identical
53
+ },
54
+ {
55
+ name: 'Task2',
56
+ status: :changed,
57
+ diffs: 'Diffs for Task2'
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ node: 'node2',
63
+ service: 'service2',
64
+ check: false,
65
+ tasks: [
66
+ {
67
+ name: 'Task3',
68
+ status: :identical
69
+ },
70
+ {
71
+ name: 'Task4',
72
+ status: :changed,
73
+ diffs: 'Diffs for Task4'
74
+ }
75
+ ]
76
+ }
77
+ ]
78
+ end
79
+ expect(test_deployer.parse_deploy_output('node', 'stdout', 'stderr')).to eq [
80
+ {
81
+ name: 'Task1',
82
+ status: :identical
83
+ },
84
+ {
85
+ name: 'Task2',
86
+ status: :changed,
87
+ diffs: 'Diffs for Task2'
88
+ },
89
+ {
90
+ name: 'Task3',
91
+ status: :identical
92
+ },
93
+ {
94
+ name: 'Task4',
95
+ status: :changed,
96
+ diffs: 'Diffs for Task4'
97
+ }
98
+ ]
99
+ end
100
+ end
101
+
102
+ end
103
+
104
+ end
@@ -0,0 +1,131 @@
1
+ require 'net/ssh'
2
+ require 'securerandom'
3
+
4
+ describe HybridPlatformsConductor::Deployer do
5
+
6
+ context 'checking provisioning' do
7
+
8
+ it 'gives a new test instance ready to be used in place of the node' do
9
+ with_test_platform(
10
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }
11
+ ) do |repository|
12
+ register_plugins(:provisioner, { test_provisioner: HybridPlatformsConductorTest::TestProvisioner })
13
+ File.write("#{test_config.hybrid_platforms_dir}/dummy_secrets.json", '{}')
14
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = %i[created created running exited]
15
+ HybridPlatformsConductorTest::TestProvisioner.mocked_ip = '172.17.0.1'
16
+ expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }) do |&block|
17
+ block.call
18
+ end
19
+ provisioner = nil
20
+ test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner') do |test_deployer, test_instance|
21
+ expect(test_deployer.local_environment).to eq true
22
+ provisioner = test_instance
23
+ expect(test_instance.node).to eq 'node'
24
+ expect(test_instance.environment).to match /^#{Regexp.escape(`whoami`.strip)}_hpc_testing_provisioner_\d+_\d+_\w+$/
25
+ end
26
+ expect(provisioner.actions).to eq %i[create state state start state ip ip stop state destroy]
27
+ end
28
+ end
29
+
30
+ it 'gives a new test instance ready to be used in place of the node, using the timeout given by the provisioner' do
31
+ with_test_platform(
32
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }
33
+ ) do |repository|
34
+ register_plugins(:provisioner, { test_provisioner: HybridPlatformsConductorTest::TestProvisioner })
35
+ File.write("#{test_config.hybrid_platforms_dir}/dummy_secrets.json", '{}')
36
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = %i[created created running exited]
37
+ HybridPlatformsConductorTest::TestProvisioner.mocked_ip = '172.17.0.1'
38
+ HybridPlatformsConductorTest::TestProvisioner.mocked_default_timeout = 666
39
+ expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 666 }) do |&block|
40
+ block.call
41
+ end
42
+ provisioner = nil
43
+ test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner') do |test_deployer, test_instance|
44
+ expect(test_deployer.local_environment).to eq true
45
+ provisioner = test_instance
46
+ expect(test_instance.node).to eq 'node'
47
+ expect(test_instance.environment).to match /^#{Regexp.escape(`whoami`.strip)}_hpc_testing_provisioner_\d+_\d+_\w+$/
48
+ end
49
+ expect(provisioner.actions).to eq %i[create state state start state ip ip stop state destroy]
50
+ end
51
+ end
52
+
53
+ it 'does not destroy instances when asked to reuse' do
54
+ with_test_platform(
55
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }
56
+ ) do |repository|
57
+ register_plugins(:provisioner, { test_provisioner: HybridPlatformsConductorTest::TestProvisioner })
58
+ File.write("#{test_config.hybrid_platforms_dir}/dummy_secrets.json", '{}')
59
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = %i[created created running exited]
60
+ HybridPlatformsConductorTest::TestProvisioner.mocked_ip = '172.17.0.1'
61
+ expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }) do |&block|
62
+ block.call
63
+ end
64
+ provisioner = nil
65
+ test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner', reuse_instance: true) do |test_deployer, test_instance|
66
+ expect(test_deployer.local_environment).to eq true
67
+ provisioner = test_instance
68
+ expect(test_instance.node).to eq 'node'
69
+ expect(test_instance.environment).to eq "#{`whoami`.strip}_hpc_testing_provisioner"
70
+ end
71
+ expect(provisioner.actions).to eq %i[create state state start state ip ip stop state]
72
+ end
73
+ end
74
+
75
+ it 'reuses running instances when asked to reuse' do
76
+ with_test_platform(
77
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }
78
+ ) do |repository|
79
+ register_plugins(:provisioner, { test_provisioner: HybridPlatformsConductorTest::TestProvisioner })
80
+ File.write("#{test_config.hybrid_platforms_dir}/dummy_secrets.json", '{}')
81
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = %i[running running running exited]
82
+ HybridPlatformsConductorTest::TestProvisioner.mocked_ip = '172.17.0.1'
83
+ expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }) do |&block|
84
+ block.call
85
+ end
86
+ provisioner = nil
87
+ test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner', reuse_instance: true) do |test_deployer, test_instance|
88
+ expect(test_deployer.local_environment).to eq true
89
+ provisioner = test_instance
90
+ expect(test_instance.node).to eq 'node'
91
+ expect(test_instance.environment).to eq "#{`whoami`.strip}_hpc_testing_provisioner"
92
+ end
93
+ expect(provisioner.actions).to eq %i[create state state state ip ip stop state]
94
+ end
95
+ end
96
+
97
+ it 'fails when the provisioner can\'t start' do
98
+ with_test_platform(
99
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }
100
+ ) do |repository|
101
+ register_plugins(:provisioner, { test_provisioner: HybridPlatformsConductorTest::TestProvisioner })
102
+ File.write("#{test_config.hybrid_platforms_dir}/dummy_secrets.json", '{}')
103
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = %i[created created created exited exited]
104
+ expect do
105
+ test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner') do |test_deployer, test_instance|
106
+ end
107
+ end.to raise_error /\[ node\/#{Regexp.escape(`whoami`.strip)}_hpc_testing_provisioner_\d+_\d+_\w+ \] - Instance fails to be in a state among \(running\) with timeout 1\. Currently in state exited/
108
+ end
109
+ end
110
+
111
+ it 'fails when the provisioner can\'t have its SSH port opened' do
112
+ with_test_platform(
113
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42' } } }
114
+ ) do |repository|
115
+ register_plugins(:provisioner, { test_provisioner: HybridPlatformsConductorTest::TestProvisioner })
116
+ File.write("#{test_config.hybrid_platforms_dir}/dummy_secrets.json", '{}')
117
+ HybridPlatformsConductorTest::TestProvisioner.mocked_states = %i[created created running exited]
118
+ HybridPlatformsConductorTest::TestProvisioner.mocked_ip = '172.17.0.1'
119
+ expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }) do |&block|
120
+ raise Errno::ETIMEDOUT, 'Timeout while reading from port 22'
121
+ end
122
+ expect do
123
+ test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner') do |test_deployer, test_instance|
124
+ end
125
+ end.to raise_error /\[ node\/#{Regexp.escape(`whoami`.strip)}_hpc_testing_provisioner_\d+_\d+_\w+ \] - Instance fails to have port 22 opened with timeout 1\./
126
+ end
127
+ end
128
+
129
+ end
130
+
131
+ end