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,10 @@
1
+ # This is an example of Dockerfile that can serve as an image for testing Docker handling in the Deployer
2
+ FROM debian:stretch
3
+
4
+ RUN apt-get update && apt-get install -y openssh-server
5
+ RUN mkdir /var/run/sshd
6
+ RUN echo 'root:root_pwd' | chpasswd
7
+ RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
8
+
9
+ EXPOSE 22
10
+ CMD ["/usr/sbin/sshd", "-D"]
@@ -0,0 +1,123 @@
1
+ require 'net/ssh'
2
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/docker'
3
+
4
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Docker do
5
+
6
+ # Setup a test platform with a test Docker image
7
+ #
8
+ # Parameters::
9
+ # * *environment* (String): Environment to use [default = 'test']
10
+ # * Proc: Code called when everything is setup
11
+ # * Parameters::
12
+ # * *docker_instance* (Provisioner): A new Provisioner instance targeting the Docker container
13
+ # * *repository* (String): The platforms' repository
14
+ def with_test_docker_platform(environment = 'test')
15
+ with_repository('platform') do |repository|
16
+ docker_image_path = "#{repository}/docker_image"
17
+ FileUtils.mkdir_p docker_image_path
18
+ FileUtils.cp "#{__dir__}/docker/Dockerfile", "#{docker_image_path}/Dockerfile"
19
+ with_platforms("
20
+ os_image :test_image, '#{docker_image_path}'
21
+ test_platform path: '#{repository}'
22
+ ") do
23
+ register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
24
+ self.test_platforms_info = { 'platform' => {
25
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42', image: 'test_image' } } }
26
+ } }
27
+ instance = HybridPlatformsConductor::HpcPlugins::Provisioner::Docker.new(
28
+ 'node',
29
+ environment: environment,
30
+ logger: logger,
31
+ logger_stderr: logger,
32
+ config: test_config,
33
+ cmd_runner: test_cmd_runner,
34
+ nodes_handler: test_nodes_handler,
35
+ actions_executor: test_actions_executor
36
+ )
37
+ yield instance, repository
38
+ end
39
+ end
40
+ end
41
+
42
+ it 'creates an instance' do
43
+ # Make sure we use a unique environment for this test
44
+ environment = "test_#{Process.pid}_#{(Time.now - Process.clock_gettime(Process::CLOCK_BOOTTIME)).strftime('%Y%m%d%H%M%S')}"
45
+ with_test_docker_platform(environment) do |instance|
46
+ expect(::Docker::Container).to receive(:create).and_call_original
47
+ instance.create
48
+ instance.wait_for_state! :created
49
+ begin
50
+ # Test that the instance is created
51
+ expect(::Docker::Container.all(all: true).find { |container| container.info['Names'].include? "/hpc_docker_container_node_#{environment}" }).not_to eq nil
52
+ expect(instance.state).to eq :created
53
+ ensure
54
+ # Clean the Docker containers if needed
55
+ instance.destroy unless instance.state == :missing
56
+ end
57
+ end
58
+ end
59
+
60
+ it 'reuses an instance already created' do
61
+ with_test_docker_platform do |instance|
62
+ instance.create
63
+ instance.wait_for_state! :created
64
+ begin
65
+ expect(::Docker::Container).not_to receive(:create)
66
+ instance.create
67
+ expect(instance.state).to eq :created
68
+ ensure
69
+ # Clean the Docker containers if needed
70
+ instance.destroy unless instance.state == :missing
71
+ end
72
+ end
73
+ end
74
+
75
+ it 'starts an instance' do
76
+ with_test_docker_platform("test_#{Process.pid}_#{(Time.now - Process.clock_gettime(Process::CLOCK_BOOTTIME)).strftime('%Y%m%d%H%M%S')}") do |instance|
77
+ instance.create
78
+ begin
79
+ instance.start
80
+ instance.wait_for_state! :running
81
+ instance.wait_for_port! 22
82
+ # Test that the instance is running correctly
83
+ message = nil
84
+ Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
85
+ message = ssh.exec!('echo UpAndRunning')
86
+ end
87
+ expect(message).to eq "UpAndRunning\n"
88
+ expect(instance.state).to eq :running
89
+ ensure
90
+ # Clean the Docker containers if needed
91
+ instance.stop if instance.state == :running
92
+ instance.destroy unless instance.state == :missing
93
+ end
94
+ end
95
+ end
96
+
97
+ it 'stops an instance' do
98
+ # Make sure we use a unique environment for this test
99
+ with_test_docker_platform("test_#{Process.pid}_#{(Time.now - Process.clock_gettime(Process::CLOCK_BOOTTIME)).strftime('%Y%m%d%H%M%S')}") do |instance|
100
+ instance.create
101
+ begin
102
+ instance.start
103
+ instance.wait_for_state! :running
104
+ instance.stop
105
+ expect(instance.state).to eq :exited
106
+ ensure
107
+ # Clean the Docker containers if needed
108
+ instance.destroy unless instance.state == :missing
109
+ end
110
+ end
111
+ end
112
+
113
+ it 'destroys an instance' do
114
+ # Make sure we use a unique environment for this test
115
+ with_test_docker_platform("test_#{Process.pid}_#{(Time.now - Process.clock_gettime(Process::CLOCK_BOOTTIME)).strftime('%Y%m%d%H%M%S')}") do |instance|
116
+ instance.create
117
+ instance.wait_for_state! :created
118
+ instance.destroy
119
+ expect(instance.state).to eq :missing
120
+ end
121
+ end
122
+
123
+ end
@@ -0,0 +1,211 @@
1
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/podman'
2
+
3
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Podman do
4
+
5
+ # Setup a test platform with a test Podman image
6
+ #
7
+ # Parameters::
8
+ # * *environment* (String): Environment to use [default = 'test']
9
+ # * Proc: Code called when everything is setup
10
+ # * Parameters::
11
+ # * *instance* (Provisioner): A new Provisioner instance targeting the Podman container
12
+ # * *repository* (String): The platforms' repository
13
+ def with_test_podman_platform(environment = 'test')
14
+ with_repository('platform') do |repository|
15
+ docker_image_path = "#{repository}/docker_image"
16
+ FileUtils.mkdir_p docker_image_path
17
+ FileUtils.cp "#{__dir__}/docker/Dockerfile", "#{docker_image_path}/Dockerfile"
18
+ with_platforms("
19
+ os_image :test_image, '#{docker_image_path}'
20
+ test_platform path: '#{repository}'
21
+ ") do
22
+ register_platform_handlers test: HybridPlatformsConductorTest::PlatformHandlerPlugins::Test
23
+ self.test_platforms_info = { 'platform' => {
24
+ nodes: { 'node' => { meta: { host_ip: '192.168.42.42', image: 'test_image' } } }
25
+ } }
26
+ instance = HybridPlatformsConductor::HpcPlugins::Provisioner::Podman.new(
27
+ 'node',
28
+ environment: environment,
29
+ logger: logger,
30
+ logger_stderr: logger,
31
+ config: test_config,
32
+ cmd_runner: test_cmd_runner,
33
+ nodes_handler: test_nodes_handler,
34
+ actions_executor: test_actions_executor
35
+ )
36
+ yield instance, repository
37
+ end
38
+ end
39
+ end
40
+
41
+ it 'creates an instance' do
42
+ with_test_podman_platform do |instance, repository|
43
+ with_cmd_runner_mocked([
44
+ ['whoami', proc { [0, 'test_user', ''] }],
45
+ [
46
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
47
+ proc { [0, '', ''] }
48
+ ],
49
+ [
50
+ 'sudo podman container list --all | grep hpc_container_node_test',
51
+ proc { [1, '', ''] }
52
+ ],
53
+ [
54
+ 'sudo podman container create --name hpc_container_node_test hpc_image_test_image',
55
+ proc { [0, '', ''] }
56
+ ]
57
+ ]) do
58
+ instance.create
59
+ end
60
+ end
61
+ end
62
+
63
+ it 'creates an instance as root' do
64
+ with_test_podman_platform do |instance, repository|
65
+ with_cmd_runner_mocked([
66
+ ['whoami', proc { [0, 'root', ''] }],
67
+ [
68
+ "cd #{repository}/docker_image && podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
69
+ proc { [0, '', ''] }
70
+ ],
71
+ [
72
+ 'podman container list --all | grep hpc_container_node_test',
73
+ proc { [1, '', ''] }
74
+ ],
75
+ [
76
+ 'podman container create --name hpc_container_node_test hpc_image_test_image',
77
+ proc { [0, '', ''] }
78
+ ]
79
+ ]) do
80
+ instance.create
81
+ end
82
+ end
83
+ end
84
+
85
+ it 'reuses an instance already created' do
86
+ with_test_podman_platform do |instance, repository|
87
+ with_cmd_runner_mocked([
88
+ ['whoami', proc { [0, 'test_user', ''] }],
89
+ [
90
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
91
+ proc { [0, '', ''] }
92
+ ],
93
+ [
94
+ /^sudo podman container list --all | grep hpc_container_node_test_\d+_\d+$/,
95
+ proc { [0, "062ede10d1c0 localhost/hpc_image_debian_9:latest /usr/sbin/sshd -D 7 days ago Exited (0) 6 days ago hpc_container_node_test_\n", ''] }
96
+ ]
97
+ ]) do
98
+ instance.create
99
+ end
100
+ end
101
+ end
102
+
103
+ it 'starts an instance' do
104
+ with_test_podman_platform do |instance, repository|
105
+ with_cmd_runner_mocked([
106
+ ['whoami', proc { [0, 'test_user', ''] }],
107
+ [
108
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
109
+ proc { [0, '', ''] }
110
+ ],
111
+ [
112
+ /^sudo podman container list --all | grep hpc_container_node_test_\d+_\d+$/,
113
+ proc { [0, "062ede10d1c0 localhost/hpc_image_debian_9:latest /usr/sbin/sshd -D 7 days ago Exited (0) 6 days ago hpc_container_node_test_\n", ''] }
114
+ ],
115
+ ['sudo podman container start --cgroup-manager=cgroupfs hpc_container_node_test', proc { [0, '', ''] }]
116
+ ]) do
117
+ instance.create
118
+ instance.start
119
+ end
120
+ end
121
+ end
122
+
123
+ it 'stops an instance' do
124
+ with_test_podman_platform do |instance, repository|
125
+ with_cmd_runner_mocked([
126
+ ['whoami', proc { [0, 'test_user', ''] }],
127
+ [
128
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
129
+ proc { [0, '', ''] }
130
+ ],
131
+ [
132
+ /^sudo podman container list --all | grep hpc_container_node_test_\d+_\d+$/,
133
+ proc { [0, "062ede10d1c0 localhost/hpc_image_debian_9:latest /usr/sbin/sshd -D 7 days ago Exited (0) 6 days ago hpc_container_node_test_\n", ''] }
134
+ ],
135
+ ['sudo podman container start --cgroup-manager=cgroupfs hpc_container_node_test', proc { [0, '', ''] }],
136
+ ['sudo podman container stop hpc_container_node_test', proc { [0, '', ''] }]
137
+ ]) do
138
+ instance.create
139
+ instance.start
140
+ instance.stop
141
+ end
142
+ end
143
+ end
144
+
145
+ it 'destroys an instance' do
146
+ with_test_podman_platform do |instance, repository|
147
+ with_cmd_runner_mocked([
148
+ ['whoami', proc { [0, 'test_user', ''] }],
149
+ [
150
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
151
+ proc { [0, '', ''] }
152
+ ],
153
+ [
154
+ /^sudo podman container list --all | grep hpc_container_node_test_\d+_\d+$/,
155
+ proc { [0, "062ede10d1c0 localhost/hpc_image_debian_9:latest /usr/sbin/sshd -D 7 days ago Exited (0) 6 days ago hpc_container_node_test_\n", ''] }
156
+ ],
157
+ ['sudo podman container rm hpc_container_node_test', proc { [0, '', ''] }]
158
+ ]) do
159
+ instance.create
160
+ instance.destroy
161
+ end
162
+ end
163
+ end
164
+
165
+ it 'gets the status of a missing instance' do
166
+ with_test_podman_platform do |instance, repository|
167
+ expect(instance.state).to eq :missing
168
+ end
169
+ end
170
+
171
+ it 'gets the status of a created instance' do
172
+ with_test_podman_platform do |instance, repository|
173
+ with_cmd_runner_mocked([
174
+ ['whoami', proc { [0, 'test_user', ''] }],
175
+ [
176
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
177
+ proc { [0, '', ''] }
178
+ ],
179
+ [
180
+ /^sudo podman container list --all | grep hpc_container_node_test_\d+_\d+$/,
181
+ proc { [0, "062ede10d1c0 localhost/hpc_image_debian_9:latest /usr/sbin/sshd -D 7 days ago Exited (0) 6 days ago hpc_container_node_test_\n", ''] }
182
+ ],
183
+ ['sudo podman container inspect hpc_container_node_test', proc { [0, '[{"State":{"Status": "created"}}]', ''] }]
184
+ ]) do
185
+ instance.create
186
+ expect(instance.state).to eq :created
187
+ end
188
+ end
189
+ end
190
+
191
+ it 'gets the IP of a created instance' do
192
+ with_test_podman_platform do |instance, repository|
193
+ with_cmd_runner_mocked([
194
+ ['whoami', proc { [0, 'test_user', ''] }],
195
+ [
196
+ "cd #{repository}/docker_image && sudo podman build --tag hpc_image_test_image --security-opt seccomp=/usr/share/containers/seccomp.json --cgroup-manager=cgroupfs .",
197
+ proc { [0, '', ''] }
198
+ ],
199
+ [
200
+ /^sudo podman container list --all | grep hpc_container_node_test_\d+_\d+$/,
201
+ proc { [0, "062ede10d1c0 localhost/hpc_image_debian_9:latest /usr/sbin/sshd -D 7 days ago Exited (0) 6 days ago hpc_container_node_test_\n", ''] }
202
+ ],
203
+ ['sudo podman container inspect hpc_container_node_test | grep IPAddress', proc { [0, ' "IPAddress": "192.168.42.42",', ''] }]
204
+ ]) do
205
+ instance.create
206
+ expect(instance.ip).to eq '192.168.42.42'
207
+ end
208
+ end
209
+ end
210
+
211
+ end
@@ -0,0 +1,126 @@
1
+ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
+
3
+ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
+
5
+ context 'checking Config DSL extensions' do
6
+
7
+ it 'declares proxmox configuratin in Config DSL' do
8
+ with_repository do |repository|
9
+ platforms = <<~EOS
10
+ proxmox(
11
+ api_url: 'https://my-proxmox.my-domain.com:8006',
12
+ sync_node: 'test_node',
13
+ test_config: {
14
+ pve_nodes: ['pve_node_name'],
15
+ vm_ips_list: %w[
16
+ 192.168.0.100
17
+ 192.168.0.101
18
+ ],
19
+ vm_ids_range: [1000, 1100],
20
+ coeff_ram_consumption: 10,
21
+ coeff_disk_consumption: 1,
22
+ expiration_period_secs: 24 * 60 * 60,
23
+ limits: {
24
+ nbr_vms_max: 5,
25
+ cpu_loads_thresholds: [10, 10, 10],
26
+ ram_percent_used_max: 0.75,
27
+ disk_percent_used_max: 0.75
28
+ }
29
+ },
30
+ vm_config: {
31
+ vm_dns_servers: ['8.8.8.8'],
32
+ vm_search_domain: 'my-domain.com',
33
+ vm_gateway: '192.168.0.1'
34
+ }
35
+ )
36
+ proxmox(
37
+ api_url: 'https://my-proxmox2.my-domain.com:8006',
38
+ sync_node: 'test_node2',
39
+ test_config: {
40
+ pve_nodes: ['pve_node_name2'],
41
+ vm_ips_list: %w[
42
+ 192.168.0.102
43
+ 192.168.0.103
44
+ ],
45
+ vm_ids_range: [2000, 2100],
46
+ coeff_ram_consumption: 20,
47
+ coeff_disk_consumption: 2,
48
+ expiration_period_secs: 12 * 60 * 60,
49
+ limits: {
50
+ nbr_vms_max: 3,
51
+ cpu_loads_thresholds: [20, 20, 20],
52
+ ram_percent_used_max: 0.85,
53
+ disk_percent_used_max: 0.85
54
+ }
55
+ },
56
+ vm_config: {
57
+ vm_dns_servers: ['9.9.9.9'],
58
+ vm_search_domain: 'my-domain2.com',
59
+ vm_gateway: '192.168.0.2'
60
+ },
61
+ default_timeout: 666
62
+ )
63
+ EOS
64
+ with_platforms platforms do
65
+ expect(test_config.proxmox_servers).to eq [
66
+ {
67
+ api_url: 'https://my-proxmox.my-domain.com:8006',
68
+ sync_node: 'test_node',
69
+ test_config: {
70
+ pve_nodes: ['pve_node_name'],
71
+ vm_ips_list: %w[
72
+ 192.168.0.100
73
+ 192.168.0.101
74
+ ],
75
+ vm_ids_range: [1000, 1100],
76
+ coeff_ram_consumption: 10,
77
+ coeff_disk_consumption: 1,
78
+ expiration_period_secs: 24 * 60 * 60,
79
+ limits: {
80
+ nbr_vms_max: 5,
81
+ cpu_loads_thresholds: [10, 10, 10],
82
+ ram_percent_used_max: 0.75,
83
+ disk_percent_used_max: 0.75
84
+ }
85
+ },
86
+ vm_config: {
87
+ vm_dns_servers: ['8.8.8.8'],
88
+ vm_search_domain: 'my-domain.com',
89
+ vm_gateway: '192.168.0.1'
90
+ }
91
+ },
92
+ {
93
+ api_url: 'https://my-proxmox2.my-domain.com:8006',
94
+ sync_node: 'test_node2',
95
+ test_config: {
96
+ pve_nodes: ['pve_node_name2'],
97
+ vm_ips_list: %w[
98
+ 192.168.0.102
99
+ 192.168.0.103
100
+ ],
101
+ vm_ids_range: [2000, 2100],
102
+ coeff_ram_consumption: 20,
103
+ coeff_disk_consumption: 2,
104
+ expiration_period_secs: 12 * 60 * 60,
105
+ limits: {
106
+ nbr_vms_max: 3,
107
+ cpu_loads_thresholds: [20, 20, 20],
108
+ ram_percent_used_max: 0.85,
109
+ disk_percent_used_max: 0.85
110
+ }
111
+ },
112
+ vm_config: {
113
+ vm_dns_servers: ['9.9.9.9'],
114
+ vm_search_domain: 'my-domain2.com',
115
+ vm_gateway: '192.168.0.2'
116
+ },
117
+ default_timeout: 666
118
+ }
119
+ ]
120
+ end
121
+ end
122
+ end
123
+
124
+ end
125
+
126
+ end