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,290 @@
1
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
+
3
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
+
5
+ context 'checking containers creation' do
6
+
7
+ it 'creates an instance' do
8
+ with_test_proxmox_platform do |instance|
9
+ mock_proxmox_calls_with [
10
+ # 1 - The info on existing containers
11
+ mock_proxmox_to_get_nodes_info
12
+ ]
13
+ instance.create
14
+ expect(@proxmox_create_options).to eq({
15
+ 'cores' => 2,
16
+ 'cpulimit' => 2,
17
+ 'description' => "===== HPC info =====\nnode: node\nenvironment: test\ndebug: false\n",
18
+ 'hostname' => 'node.test.hpc-test.com',
19
+ 'memory' => 1024,
20
+ 'nameserver' => '8.8.8.8',
21
+ 'net0' => 'name=eth0,bridge=vmbr0,gw=192.168.0.1',
22
+ 'ostemplate' => 'template_storage/os_image.tar.gz',
23
+ 'password' => 'root_pwd',
24
+ 'rootfs' => 'local-lvm:10',
25
+ 'searchdomain' => 'my-domain.com'
26
+ })
27
+ end
28
+ end
29
+
30
+ it 'creates an instance for an environment exceeding hostname size limit' do
31
+ env_name = 'really_big_environment_name_that_will_exceed_for_sure_the_limit_of_hostnames_' * 10
32
+ expected_hostname = 'node.really-big-environment-name-that-will-76ce77cc.hpc-test.com'
33
+ with_test_proxmox_platform(environment: env_name) do |instance|
34
+ mock_proxmox_calls_with(
35
+ [
36
+ # 1 - The info on existing containers
37
+ mock_proxmox_to_get_nodes_info
38
+ ],
39
+ expected_file_id: 'node_really_big_environment_name_that_will_exceed_for_sure_the_limit_of_hostnames_really_big_environment_name_that_will_exceed_for_sure_the_limit_of_hostnames_really_big_environment_name_that_will_exceed_for_sure_the_limit_of_hostnam-258ca1fc'
40
+ )
41
+ instance.create
42
+ expect(@proxmox_create_options['hostname']).to eq expected_hostname
43
+ end
44
+ end
45
+
46
+ it 'creates an instance as root' do
47
+ with_test_proxmox_platform do |instance|
48
+ test_actions_executor.connector(:ssh).ssh_user = 'root'
49
+ mock_proxmox_calls_with(
50
+ [
51
+ # 1 - The info on existing containers
52
+ mock_proxmox_to_get_nodes_info
53
+ ],
54
+ expected_sudo: false
55
+ )
56
+ instance.create
57
+ expect(@proxmox_create_options).to eq({
58
+ 'cores' => 2,
59
+ 'cpulimit' => 2,
60
+ 'description' => "===== HPC info =====\nnode: node\nenvironment: test\ndebug: false\n",
61
+ 'hostname' => 'node.test.hpc-test.com',
62
+ 'memory' => 1024,
63
+ 'nameserver' => '8.8.8.8',
64
+ 'net0' => 'name=eth0,bridge=vmbr0,gw=192.168.0.1',
65
+ 'ostemplate' => 'template_storage/os_image.tar.gz',
66
+ 'password' => 'root_pwd',
67
+ 'rootfs' => 'local-lvm:10',
68
+ 'searchdomain' => 'my-domain.com'
69
+ })
70
+ end
71
+ end
72
+
73
+ it 'creates an instance using credentials from environment' do
74
+ with_test_proxmox_platform do |instance|
75
+ ENV['hpc_user_for_proxmox'] = 'test_proxmox_user'
76
+ ENV['hpc_password_for_proxmox'] = 'test_proxmox_password'
77
+ mock_proxmox_calls_with(
78
+ [
79
+ # 1 - The info on existing containers
80
+ mock_proxmox_to_get_nodes_info(proxmox_user: 'test_proxmox_user', proxmox_password: 'test_proxmox_password')
81
+ ],
82
+ proxmox_user: 'test_proxmox_user',
83
+ proxmox_password: 'test_proxmox_password'
84
+ )
85
+ instance.create
86
+ end
87
+ end
88
+
89
+ it 'creates an instance using credentials from environment and a different realm' do
90
+ with_test_proxmox_platform do |instance|
91
+ ENV['hpc_user_for_proxmox'] = 'test_proxmox_user'
92
+ ENV['hpc_password_for_proxmox'] = 'test_proxmox_password'
93
+ ENV['hpc_realm_for_proxmox'] = 'test_proxmox_realm'
94
+ mock_proxmox_calls_with(
95
+ [
96
+ # 1 - The info on existing containers
97
+ mock_proxmox_to_get_nodes_info(
98
+ proxmox_user: 'test_proxmox_user',
99
+ proxmox_password: 'test_proxmox_password',
100
+ proxmox_realm: 'test_proxmox_realm'
101
+ )
102
+ ],
103
+ proxmox_user: 'test_proxmox_user',
104
+ proxmox_password: 'test_proxmox_password',
105
+ proxmox_realm: 'test_proxmox_realm'
106
+ )
107
+ instance.create
108
+ end
109
+ end
110
+
111
+ it 'fails to create an instance when the reserve_proxmox_container sync node ends in error' do
112
+ with_test_proxmox_platform do |instance|
113
+ mock_proxmox_calls_with([
114
+ # 1 - The info on existing containers
115
+ mock_proxmox_to_get_nodes_info
116
+ ],
117
+ error_on_create: 'Error while getting resources'
118
+ )
119
+ expect { instance.create }.to raise_error '[ node/test ] - Error returned by reserve_proxmox_container --create ./proxmox/create/create_node_test.json --config ./proxmox/config/config_node_test.json: Error while getting resources'
120
+ end
121
+ end
122
+
123
+ it 'creates an instance using resources defined for a given node' do
124
+ with_test_proxmox_platform(node_metadata: {
125
+ deploy_resources_min: {
126
+ cpus: 24,
127
+ ram_mb: 4096,
128
+ disk_gb: 20
129
+ }
130
+ }) do |instance|
131
+ mock_proxmox_calls_with(
132
+ [
133
+ # 1 - The info on existing containers
134
+ mock_proxmox_to_get_nodes_info
135
+ ]
136
+ )
137
+ instance.create
138
+ expect(@proxmox_create_options).to eq({
139
+ 'cores' => 24,
140
+ 'cpulimit' => 24,
141
+ 'description' => "===== HPC info =====\nnode: node\nenvironment: test\ndebug: false\n",
142
+ 'hostname' => 'node.test.hpc-test.com',
143
+ 'memory' => 4096,
144
+ 'nameserver' => '8.8.8.8',
145
+ 'net0' => 'name=eth0,bridge=vmbr0,gw=192.168.0.1',
146
+ 'ostemplate' => 'template_storage/os_image.tar.gz',
147
+ 'password' => 'root_pwd',
148
+ 'rootfs' => 'local-lvm:20',
149
+ 'searchdomain' => 'my-domain.com'
150
+ })
151
+ end
152
+ end
153
+
154
+ it 'reuses an existing instance' do
155
+ with_test_proxmox_platform do |instance|
156
+ mock_proxmox_calls_with(
157
+ [
158
+ # 1 - The info on existing containers
159
+ mock_proxmox_to_get_nodes_info(
160
+ nodes_info: [
161
+ {
162
+ 'status' => 'online',
163
+ 'node' => 'pve_node_name'
164
+ }
165
+ ],
166
+ extra_expects: proc do |proxmox|
167
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc') do
168
+ [
169
+ {
170
+ 'vmid' => '1042'
171
+ }
172
+ ]
173
+ end
174
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1042/config') do
175
+ {
176
+ 'net0' => 'ip=192.168.0.101/32',
177
+ 'description' => <<~EOS
178
+ ===== HPC info =====
179
+ node: node
180
+ environment: test
181
+ EOS
182
+ }
183
+ end
184
+ end
185
+ )
186
+ ],
187
+ reserve: false
188
+ )
189
+ instance.create
190
+ end
191
+ end
192
+
193
+ it 'does not reuse an instance on a PVE node offline' do
194
+ with_test_proxmox_platform do |instance|
195
+ mock_proxmox_calls_with [
196
+ # 1 - The info on existing containers
197
+ mock_proxmox_to_get_nodes_info(
198
+ nodes_info: [
199
+ {
200
+ 'status' => 'offline',
201
+ 'node' => 'pve_node_name'
202
+ }
203
+ ]
204
+ )
205
+ ]
206
+ instance.create
207
+ end
208
+ end
209
+
210
+ it 'does not reuse an instance on a PVE node that does not belong to the list of authorized PVE nodes' do
211
+ with_test_proxmox_platform do |instance|
212
+ mock_proxmox_calls_with [
213
+ # 1 - The info on existing containers
214
+ mock_proxmox_to_get_nodes_info(
215
+ nodes_info: [
216
+ {
217
+ 'status' => 'online',
218
+ 'node' => 'pve_other_node_name'
219
+ }
220
+ ]
221
+ )
222
+ ]
223
+ instance.create
224
+ end
225
+ end
226
+
227
+ it 'does not reuse an instance that serves another environment' do
228
+ with_test_proxmox_platform do |instance|
229
+ mock_proxmox_calls_with [
230
+ # 1 - The info on existing containers
231
+ mock_proxmox_to_get_nodes_info(
232
+ nodes_info: [
233
+ {
234
+ 'status' => 'online',
235
+ 'node' => 'pve_node_name'
236
+ }
237
+ ],
238
+ extra_expects: proc do |proxmox|
239
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc') do
240
+ [
241
+ {
242
+ 'vmid' => '1042'
243
+ }
244
+ ]
245
+ end
246
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1042/config') do
247
+ {
248
+ 'description' => <<~EOS
249
+ ===== HPC info =====
250
+ node: node
251
+ environment: other_environment
252
+ EOS
253
+ }
254
+ end
255
+ end
256
+ )
257
+ ]
258
+ instance.create
259
+ end
260
+ end
261
+
262
+ it 'does not reuse an instance that does not belong to the authorized VM ID range' do
263
+ with_test_proxmox_platform do |instance|
264
+ mock_proxmox_calls_with [
265
+ # 1 - The info on existing containers
266
+ mock_proxmox_to_get_nodes_info(
267
+ nodes_info: [
268
+ {
269
+ 'status' => 'online',
270
+ 'node' => 'pve_node_name'
271
+ }
272
+ ],
273
+ extra_expects: proc do |proxmox|
274
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc') do
275
+ [
276
+ {
277
+ 'vmid' => '100'
278
+ }
279
+ ]
280
+ end
281
+ end
282
+ )
283
+ ]
284
+ instance.create
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end
@@ -0,0 +1,43 @@
1
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
+
3
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
+
5
+ context 'checking containers destroy' do
6
+
7
+ it 'destroys an instance' do
8
+ with_test_proxmox_platform do |instance|
9
+ mock_proxmox_calls_with(
10
+ [
11
+ # 1 - The info on existing containers
12
+ mock_proxmox_to_get_nodes_info
13
+ ],
14
+ destroy_vm: true
15
+ )
16
+ instance.create
17
+ instance.destroy
18
+ expect(@proxmox_destroy_options).to eq({
19
+ 'vm_id' => 1024,
20
+ 'environment' => 'test',
21
+ 'node' => 'node'
22
+ })
23
+ end
24
+ end
25
+
26
+ it 'fails to destroy an instance when the Proxmox task ends in error' do
27
+ with_test_proxmox_platform do |instance|
28
+ mock_proxmox_calls_with(
29
+ [
30
+ # 1 - The info on existing containers
31
+ mock_proxmox_to_get_nodes_info
32
+ ],
33
+ destroy_vm: true,
34
+ error_on_destroy: 'Error while destroy'
35
+ )
36
+ instance.create
37
+ expect { instance.destroy }.to raise_error '[ node/test ] - Error returned by reserve_proxmox_container --destroy ./proxmox/destroy/destroy_node_test.json --config ./proxmox/config/config_node_test.json: Error while destroy'
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,60 @@
1
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
+
3
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
+
5
+ context 'checking containers IP retrieval' do
6
+
7
+ it 'returns the IP of a newly created instance' do
8
+ with_test_proxmox_platform do |instance|
9
+ mock_proxmox_calls_with [
10
+ # 1 - The info on existing containers
11
+ mock_proxmox_to_get_nodes_info
12
+ ]
13
+ instance.create
14
+ expect(instance.ip).to eq '192.168.0.100'
15
+ end
16
+ end
17
+
18
+ it 'returns the IP of a reused instance' do
19
+ with_test_proxmox_platform do |instance|
20
+ mock_proxmox_calls_with(
21
+ [
22
+ # 1 - The info on existing containers
23
+ mock_proxmox_to_get_nodes_info(
24
+ nodes_info: [
25
+ {
26
+ 'status' => 'online',
27
+ 'node' => 'pve_node_name'
28
+ }
29
+ ],
30
+ extra_expects: proc do |proxmox|
31
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc') do
32
+ [
33
+ {
34
+ 'vmid' => '1042'
35
+ }
36
+ ]
37
+ end
38
+ expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1042/config') do
39
+ {
40
+ 'net0' => 'ip=192.168.42.101/32',
41
+ 'description' => <<~EOS
42
+ ===== HPC info =====
43
+ node: node
44
+ environment: test
45
+ EOS
46
+ }
47
+ end
48
+ end
49
+ )
50
+ ],
51
+ reserve: false
52
+ )
53
+ instance.create
54
+ expect(instance.ip).to eq '192.168.42.101'
55
+ end
56
+ end
57
+
58
+ end
59
+
60
+ end
@@ -0,0 +1,3 @@
1
+ {
2
+ "template": "template_storage/os_image.tar.gz"
3
+ }
@@ -0,0 +1,82 @@
1
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
+
3
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
+
5
+ context 'checking the reserve_proxmox_container sync tool' do
6
+
7
+ context 'checking how VMs are being destroyed' do
8
+
9
+ it 'releases a previously reserved VM that has been reserved and is running' do
10
+ with_sync_node do
11
+ mock_proxmox(mocked_pve_nodes: {
12
+ 'pve_node_name' => { lxc_containers: { 1042 => { status: 'running', creation_date: (Time.now - 60).utc, node: 'node', environment: 'test_env' } } }
13
+ })
14
+ expect(call_release_proxmox_container(1042, 'node', 'test_env')).to eq({ pve_node: 'pve_node_name' })
15
+ expect_proxmox_actions_to_be [
16
+ [:post, 'nodes/pve_node_name/lxc/1042/status/stop'],
17
+ [:delete, 'nodes/pve_node_name/lxc/1042']
18
+ ]
19
+ end
20
+ end
21
+
22
+ it 'releases a previously reserved VM that has been reserved and is stopped' do
23
+ with_sync_node do
24
+ mock_proxmox(mocked_pve_nodes: {
25
+ 'pve_node_name' => { lxc_containers: { 1042 => { status: 'stopped', creation_date: (Time.now - 60).utc, node: 'node', environment: 'test_env' } } }
26
+ })
27
+ expect(call_release_proxmox_container(1042, 'node', 'test_env')).to eq({ pve_node: 'pve_node_name' })
28
+ expect_proxmox_actions_to_be [
29
+ [:delete, 'nodes/pve_node_name/lxc/1042']
30
+ ]
31
+ end
32
+ end
33
+
34
+ it 'releases a previously reserved VM that has disappeared' do
35
+ with_sync_node do
36
+ mock_proxmox
37
+ expect(call_release_proxmox_container(1042, 'node', 'test_env')).to eq({})
38
+ expect_proxmox_actions_to_be []
39
+ end
40
+ end
41
+
42
+ it 'releases a previously reserved VM without impacting other VMs' do
43
+ with_sync_node do
44
+ mock_proxmox(mocked_pve_nodes: {
45
+ 'pve_node_name' => { lxc_containers: {
46
+ 1042 => { status: 'running', creation_date: (Time.now - 60).utc, node: 'node', environment: 'test_env' },
47
+ 1043 => { status: 'running', creation_date: (Time.now - 60).utc, node: 'node', environment: 'test_env' }
48
+ }
49
+ } })
50
+ expect(call_release_proxmox_container(1042, 'node', 'test_env')).to eq({ pve_node: 'pve_node_name' })
51
+ expect_proxmox_actions_to_be [
52
+ [:post, 'nodes/pve_node_name/lxc/1042/status/stop'],
53
+ [:delete, 'nodes/pve_node_name/lxc/1042']
54
+ ]
55
+ end
56
+ end
57
+
58
+ it 'does not release a previously reserved VM that has now a different node' do
59
+ with_sync_node do
60
+ mock_proxmox(mocked_pve_nodes: {
61
+ 'pve_node_name' => { lxc_containers: { 1042 => { status: 'stopped', creation_date: (Time.now - 60).utc, node: 'node', environment: 'test_env' } } }
62
+ })
63
+ expect(call_release_proxmox_container(1042, 'other_node', 'test_env')).to eq({})
64
+ expect_proxmox_actions_to_be []
65
+ end
66
+ end
67
+
68
+ it 'does not release a previously reserved VM that has now a different environment' do
69
+ with_sync_node do
70
+ mock_proxmox(mocked_pve_nodes: {
71
+ 'pve_node_name' => { lxc_containers: { 1042 => { status: 'stopped', creation_date: (Time.now - 60).utc, node: 'node', environment: 'test_env' } } }
72
+ })
73
+ expect(call_release_proxmox_container(1042, 'node', 'other_test_env')).to eq({})
74
+ expect_proxmox_actions_to_be []
75
+ end
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+
82
+ end