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,29 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module Helpers
4
+
5
+ module ReportsHandlerHelpers
6
+
7
+ # Register reports plugins in a Reports Handler instance
8
+ #
9
+ # Parameters::
10
+ # * *reports_handler* (ReportsHandler): The Reports Handler instance that need the plugins
11
+ # * *reports_plugins* (Hash<Symbol, Class>): List of report plugins, per test name
12
+ def register_report_plugins(reports_handler, reports_plugins)
13
+ reports_handler.instance_variable_set(:@reports_plugins, reports_plugins)
14
+ end
15
+
16
+ # Get a test ReportsHandler
17
+ #
18
+ # Result::
19
+ # * ReportsHandler: ReportsHandler on which we can do testing
20
+ def test_reports_handler
21
+ @reports_handler = HybridPlatformsConductor::ReportsHandler.new logger: logger, logger_stderr: logger, config: test_config, platforms_handler: test_platforms_handler, nodes_handler: test_nodes_handler unless @reports_handler
22
+ @reports_handler
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,20 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module Helpers
4
+
5
+ module ServicesHandlerHelpers
6
+
7
+ # Get a test ServicesHandler
8
+ #
9
+ # Result::
10
+ # * ServicesHandler: ServicesHandler on which we can do testing
11
+ def test_services_handler
12
+ @services_handler = HybridPlatformsConductor::ServicesHandler.new logger: logger, logger_stderr: logger, config: test_config, cmd_runner: test_cmd_runner, platforms_handler: test_platforms_handler, nodes_handler: test_nodes_handler, actions_executor: test_actions_executor unless @services_handler
13
+ @services_handler
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,38 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module Helpers
4
+
5
+ module TestsRunnerHelpers
6
+
7
+ # Register test plugins in a tests runner instance
8
+ #
9
+ # Parameters::
10
+ # * *tests_runner* (TestsRunner): The Tests Runner instance that need the plugins
11
+ # * *tests_plugins* (Hash<Symbol, Class>): List of tests plugins, per test name
12
+ def register_test_plugins(tests_runner, tests_plugins)
13
+ tests_runner.instance_variable_set(:@tests_plugins, tests_plugins)
14
+ end
15
+
16
+ # Register tests report plugins in a tests runner instance
17
+ #
18
+ # Parameters::
19
+ # * *tests_runner* (TestsRunner): The Tests Runner instance that need the plugin
20
+ # * *tests_report_plugins* (Hash<Symbol, Class>): List of tests plugins, per test name
21
+ def register_tests_report_plugins(tests_runner, tests_report_plugins)
22
+ tests_runner.instance_variable_set(:@reports_plugins, tests_report_plugins)
23
+ end
24
+
25
+ # Get a test Tests Runner
26
+ #
27
+ # Result::
28
+ # * Deployer: Tests Runner on which we can do testing
29
+ def test_tests_runner
30
+ @tests_runner = HybridPlatformsConductor::TestsRunner.new logger: logger, logger_stderr: logger, config: test_config, cmd_runner: test_cmd_runner, platforms_handler: test_platforms_handler, nodes_handler: test_nodes_handler, actions_executor: test_actions_executor, deployer: test_deployer unless @tests_runner
31
+ @tests_runner
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,22 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module MockedLib
4
+
5
+ module MyTestGem
6
+
7
+ module HpcPlugins
8
+
9
+ module TestPluginType
10
+
11
+ class TestPluginId1 < HybridPlatformsConductor::TestPluginType
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,22 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module MockedLib
4
+
5
+ module MyTestGem
6
+
7
+ module HpcPlugins
8
+
9
+ module TestPluginType
10
+
11
+ class TestPluginId2 < HybridPlatformsConductor::TestPluginType
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,26 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module MockedLib
4
+
5
+ module MyTestGem2
6
+
7
+ module SubDir
8
+
9
+ module HpcPlugins
10
+
11
+ module TestPluginType
12
+
13
+ class TestPluginId3 < HybridPlatformsConductor::TestPluginType
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,26 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module MockedLib
4
+
5
+ module MyTestGem2
6
+
7
+ module SubDir
8
+
9
+ module HpcPlugins
10
+
11
+ module TestPluginType2
12
+
13
+ class TestPluginId4 < HybridPlatformsConductor::TestPluginType2
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,225 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module PlatformHandlerPlugins
4
+
5
+ # Fake PlatformHandler that tests can pilot to check that the components of the Conductor behave correctly with plugins
6
+ class Test < HybridPlatformsConductor::PlatformHandler
7
+
8
+ class << self
9
+
10
+ # Platform properties, per platform name.
11
+ # Pilot this variable in the test cases to tune the behaviour of the TestPlatformHandler instances.
12
+ # Properties can be:
13
+ # * *nodes* (Hash< String, Hash<Symbol,Object> >): List of nodes, and their associated info (per node name) [default: {}]:
14
+ # * *meta* (Hash<String,Object>): JSON object storing metadata about this node
15
+ # * *services* (Array<String>): Services bound to this node
16
+ # * *deploy_data* (String or nil): Data to be deployed, or nil to not deploy for real [default: nil]
17
+ # * *nodes_lists* (Hash< String, Array< String > >): Nodes lists, per list name [default: {}]
18
+ # * *deployable_services* (Array<String>): List of deployable services [default: []]
19
+ # * *package* (Proc): Code called when the plugin has to package a repository
20
+ # * *prepare_for_deploy* (Proc): Code called when the plugin has to prepare a deployment
21
+ # * *parse_deploy_output* (Proc): Code called when the plugin needs to parse some deploy output
22
+ # * *impacted_nodes* (Array<String>): Impacted nodes returned by impacts_from
23
+ # * *impacted_services* (Array<String>): Impacted services returned by impacts_from
24
+ # * *impacted_global* (Boolean): Impacted global returned by impacts_from
25
+ # Hash<String, Hash<Symbol,Object> >
26
+ attr_accessor :platforms_info
27
+
28
+ # Reset variables, so that they don't interfere between tests
29
+ def reset
30
+ @platforms_info = {}
31
+ end
32
+
33
+ end
34
+
35
+ attr_reader :files_diffs
36
+
37
+ # Register test classes
38
+ # [API] - This method is optional
39
+ #
40
+ # Result::
41
+ # * Hash<Symbol,Class>: A list of tests classes (that should inherit from Tests::Test), per test name
42
+ def tests
43
+ platform_info.key?(:tests) ? platform_info[:tests] : {}
44
+ end
45
+
46
+ # Get the list of known nodes.
47
+ # [API] - This method is mandatory.
48
+ #
49
+ # Result::
50
+ # * Array<String>: List of node names
51
+ def known_nodes
52
+ platform_info[:nodes].keys
53
+ end
54
+
55
+ # Get the list of known nodes lists names.
56
+ # [API] - This method is optional.
57
+ #
58
+ # Result::
59
+ # * Array<String>: List of nodes lists' names
60
+ def known_nodes_lists
61
+ platform_info[:nodes_lists].keys
62
+ end
63
+
64
+ # Get the list of nodes selectors belonging to a nodes list
65
+ # [API] - This method is optional unless known_nodes_lists has been defined.
66
+ #
67
+ # Parameters::
68
+ # * *nodes_list* (String): Name of the nodes list
69
+ # Result::
70
+ # * Array<Object>: List of nodes selectors
71
+ def nodes_selectors_from_nodes_list(nodes_list_name)
72
+ platform_info[:nodes_lists][nodes_list_name]
73
+ end
74
+
75
+ # Get the metadata of a given node.
76
+ # [API] - This method is mandatory.
77
+ #
78
+ # Parameters::
79
+ # * *node* (String): Node to read metadata from
80
+ # Result::
81
+ # * Hash<String,Object>: The corresponding metadata (as a JSON object)
82
+ def metadata_for(node)
83
+ node_info(node)[:meta] || {}
84
+ end
85
+
86
+ # Return the services for a given node
87
+ # [API] - This method is mandatory.
88
+ #
89
+ # Parameters::
90
+ # * *node* (String): node to read configuration from
91
+ # Result::
92
+ # * Array<String>: The corresponding services
93
+ def services_for(node)
94
+ node_info(node)[:services]
95
+ end
96
+
97
+ # Get the list of services we can deploy
98
+ # [API] - This method is mandatory.
99
+ #
100
+ # Result::
101
+ # * Array<String>: The corresponding services
102
+ def deployable_services
103
+ platform_info.key?(:deployable_services) ? platform_info[:deployable_services] : []
104
+ end
105
+
106
+ # Package the repository, ready to be deployed on artefacts or directly to a node.
107
+ # [API] - This method is mandatory.
108
+ # [API] - @cmd_runner is accessible.
109
+ # [API] - @actions_executor is accessible.
110
+ #
111
+ # Parameters::
112
+ # * *services* (Hash< String, Array<String> >): Services to be deployed, per node
113
+ # * *secrets* (Hash): Secrets to be used for deployment
114
+ # * *local_environment* (Boolean): Are we deploying to a local environment?
115
+ def package(services:, secrets:, local_environment:)
116
+ platform_info[:package].call(services: services, secrets: secrets, local_environment: local_environment) if platform_info.key?(:package)
117
+ end
118
+
119
+ # Prepare deployments.
120
+ # This method is called just before getting and executing the actions to be deployed.
121
+ # It is called once per platform.
122
+ # [API] - This method is optional.
123
+ # [API] - @cmd_runner is accessible.
124
+ # [API] - @actions_executor is accessible.
125
+ #
126
+ # Parameters::
127
+ # * *services* (Hash< String, Array<String> >): Services to be deployed, per node
128
+ # * *secrets* (Hash): Secrets to be used for deployment
129
+ # * *local_environment* (Boolean): Are we deploying to a local environment?
130
+ # * *why_run* (Boolean): Are we deploying in why-run mode?
131
+ def prepare_for_deploy(services:, secrets:, local_environment:, why_run:)
132
+ platform_info[:prepare_for_deploy].call(services: services, secrets: secrets, local_environment: local_environment, why_run: why_run) if platform_info.key?(:prepare_for_deploy)
133
+ end
134
+
135
+ # Get the list of actions to perform to deploy on a given node.
136
+ # Those actions can be executed in parallel with other deployments on other nodes. They must be thread safe.
137
+ # [API] - This method is mandatory.
138
+ # [API] - @cmd_runner is accessible.
139
+ # [API] - @actions_executor is accessible.
140
+ #
141
+ # Parameters::
142
+ # * *node* (String): Node to deploy on
143
+ # * *service* (String): Service to be deployed
144
+ # * *use_why_run* (Boolean): Do we use a why-run mode? [default = true]
145
+ # Result::
146
+ # * Array< Hash<Symbol,Object> >: List of actions to be done
147
+ def actions_to_deploy_on(node, service, use_why_run: true)
148
+ if !use_why_run && node_info(node)[:deploy_data]
149
+ [{ remote_bash: "echo \"#{node_info(node)[:deploy_data]}\" >deployed_file ; echo \"Real deployment done on #{node}\"" }]
150
+ else
151
+ [{ bash: "echo \"#{use_why_run ? 'Checking' : 'Deploying'} #{service} (#{name}) on #{node}\"" }]
152
+ end
153
+ end
154
+
155
+ # Parse stdout and stderr of a given deploy run and get the list of tasks with their status
156
+ # [API] - This method is mandatory.
157
+ #
158
+ # Parameters::
159
+ # * *stdout* (String): stdout to be parsed
160
+ # * *stderr* (String): stderr to be parsed
161
+ # Result::
162
+ # * Array< Hash<Symbol,Object> >: List of task properties. The following properties should be returned, among free ones:
163
+ # * *name* (String): Task name
164
+ # * *status* (Symbol): Task status. Should be on of:
165
+ # * *:changed*: The task has been changed
166
+ # * *:identical*: The task has not been changed
167
+ # * *diffs* (String): Differences, if any
168
+ def parse_deploy_output(stdout, stderr)
169
+ platform_info[:parse_deploy_output].call(stdout, stderr) if platform_info.key?(:parse_deploy_output)
170
+ end
171
+
172
+ # Get the list of impacted nodes and services from a files diff.
173
+ # [API] - This method is optional
174
+ #
175
+ # Parameters::
176
+ # * *files_diffs* (Hash< String, Hash< Symbol, Object > >): List of diffs info, per file name having a diff. Diffs info have the following properties:
177
+ # * *moved_to* (String): The new file path, in case it has been moved [optional]
178
+ # * *diff* (String): The diff content
179
+ # Result::
180
+ # * Array<String>: The list of nodes impacted by this diff
181
+ # * Array<String>: The list of services impacted by this diff
182
+ # * Boolean: Are there some files that have a global impact (meaning all nodes are potentially impacted by this diff)?
183
+ def impacts_from(files_diffs)
184
+ @files_diffs = files_diffs
185
+ if platform_info.key?(:impacted_nodes) || platform_info.key?(:impacted_services) || platform_info.key?(:impacted_global)
186
+ [
187
+ platform_info[:impacted_nodes] || [],
188
+ platform_info[:impacted_services] || [],
189
+ platform_info[:impacted_global] || false
190
+ ]
191
+ else
192
+ super
193
+ end
194
+ end
195
+
196
+ private
197
+
198
+ # Return the platform info
199
+ #
200
+ # Result::
201
+ # * Hash<Symbol, Object>: Platform info (check TestPlatformHandler#platforms_info to know about properties)
202
+ def platform_info
203
+ {
204
+ nodes: {},
205
+ nodes_lists: {},
206
+ }.merge(HybridPlatformsConductorTest::PlatformHandlerPlugins::Test.platforms_info[name])
207
+ end
208
+
209
+ # Return the node info of a given node
210
+ #
211
+ # Parameters::
212
+ # * *node* (String): Node to get info for
213
+ # Result::
214
+ # * Hash<Symbol, Object>: Platform info (check TestPlatformHandler#platforms_info to know about properties)
215
+ def node_info(node)
216
+ {
217
+ deploy_data: nil
218
+ }.merge(platform_info[:nodes][node] || {})
219
+ end
220
+
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -0,0 +1,11 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module PlatformHandlerPlugins
4
+
5
+ # Fake PlatformHandler that tests can pilot to check that the components of the Conductor behave correctly with plugins
6
+ class Test2 < PlatformHandlerPlugins::Test
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,35 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ # Report plugin for tests
4
+ class ReportPlugin < HybridPlatformsConductor::Report
5
+
6
+ class << self
7
+
8
+ # Access the generated reports
9
+ # Array<String>
10
+ attr_accessor :generated_reports
11
+
12
+ end
13
+
14
+ # Give the list of supported locales by this report generator
15
+ # [API] - This method is mandatory.
16
+ #
17
+ # Result::
18
+ # * Array<Symbol>: List of supported locales
19
+ def self.supported_locales
20
+ %i[en fr]
21
+ end
22
+
23
+ # Create a report for a list of nodes, in a given locale
24
+ # [API] - This method is mandatory.
25
+ #
26
+ # Parameters::
27
+ # * *nodes* (Array<String>): List of nodes
28
+ # * *locale_code* (Symbol): The locale code
29
+ def report_for(nodes, locale_code)
30
+ ReportPlugin.generated_reports << "Report generated for #{nodes.join(', ')} in #{locale_code}"
31
+ end
32
+
33
+ end
34
+
35
+ end