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,49 @@
1
+ require 'net/ssh'
2
+ require 'hybrid_platforms_conductor/test_by_service'
3
+
4
+ module HybridPlatformsConductor
5
+
6
+ module HpcPlugins
7
+
8
+ module Test
9
+
10
+ # Test that deploy removes root access
11
+ class DeployRemovesRootAccess < TestByService
12
+
13
+ # Check my_test_plugin.rb.sample documentation for signature details.
14
+ def test_for_node
15
+ @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'deploy_removes_root_access', reuse_instance: log_debug?) do |deployer, instance|
16
+ # Check that we can connect with root
17
+ ssh_ok = false
18
+ begin
19
+ Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
20
+ ssh_ok = ssh.exec!('echo Works').strip == 'Works'
21
+ end
22
+ rescue
23
+ end
24
+ assert_equal ssh_ok, true, 'Root does not have access from the empty image'
25
+ if ssh_ok
26
+ deployer.nbr_retries_on_error = 3
27
+ deployer.deploy_on @node
28
+ # As sshd is certainly being restarted, start and stop the container to reload it.
29
+ deployer.restart @node
30
+ # Check that we can't connect with root
31
+ ssh_ok = false
32
+ begin
33
+ Net::SSH.start(instance.ip, 'root', password: 'root_pwd', auth_methods: ['password'], verify_host_key: :never) do |ssh|
34
+ ssh_ok = ssh.exec!('echo Works').strip == 'Works'
35
+ end
36
+ rescue
37
+ end
38
+ assert_equal ssh_ok, false, 'Root can still connect on the image after deployment'
39
+ end
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,25 @@
1
+ require 'json'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Test that the node has not diverged since last deployment
10
+ class Divergence < HybridPlatformsConductor::Test
11
+
12
+ # Check my_test_plugin.rb.sample documentation for signature details.
13
+ def test_on_check_node(stdout, stderr, exit_status)
14
+ @deployer.parse_deploy_output(@node, stdout, stderr).each do |task_info|
15
+ error "Task #{task_info[:name]} has diverged", JSON.pretty_generate(task_info) if task_info[:status] == :changed
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,46 @@
1
+ require 'hybrid_platforms_conductor/cmd_runner'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Check that all executables run correctly, from an environment/installation point of view.
10
+ class Executables < HybridPlatformsConductor::Test
11
+
12
+ # Check my_test_plugin.rb.sample documentation for signature details.
13
+ def test
14
+ example_platform = PlatformsHandler.new.known_platforms.first
15
+ example_node = example_platform.known_nodes.first
16
+ [
17
+ "#{CmdRunner.executables_prefix}check-node --node #{example_node} --show-commands",
18
+ "#{CmdRunner.executables_prefix}deploy --node #{example_node} --show-commands --why-run",
19
+ "#{CmdRunner.executables_prefix}dump_nodes_json --help",
20
+ "#{CmdRunner.executables_prefix}free_ips",
21
+ "#{CmdRunner.executables_prefix}free_veids",
22
+ "#{CmdRunner.executables_prefix}get_impacted_nodes --platform #{example_platform.name} --show-commands",
23
+ "#{CmdRunner.executables_prefix}last_deploys --node #{example_node} --show-commands",
24
+ "#{CmdRunner.executables_prefix}nodes_to_deploy --node #{example_node} --show-commands",
25
+ "#{CmdRunner.executables_prefix}report --node #{example_node} --format stdout",
26
+ "#{CmdRunner.executables_prefix}run --node #{example_node} --show-commands --interactive",
27
+ "#{CmdRunner.executables_prefix}setup --help",
28
+ "#{CmdRunner.executables_prefix}ssh_config",
29
+ "#{CmdRunner.executables_prefix}test --help",
30
+ "#{CmdRunner.executables_prefix}topograph --from \"--node #{example_node}\" --to \"--node #{example_node}\" --skip-run --output graphviz:graph.gv"
31
+ ].each do |cmd|
32
+ log_debug "Testing #{cmd}"
33
+ exit_status, stdout, _stderr = @cmd_runner.run_cmd "#{cmd} 2>&1", no_exception: true, log_to_stdout: log_debug?
34
+ assert_equal(exit_status, 0, "Command #{cmd} returned code #{exit_status}:\n#{stdout}")
35
+ end
36
+ # Remove the file created by Topograph if it exists
37
+ File.unlink('graph.gv') if File.exist?('graph.gv')
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -0,0 +1,45 @@
1
+ require 'hybrid_platforms_conductor/common_config_dsl/file_system_tests'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Perform various tests on a node's file system
10
+ class FileSystem < HybridPlatformsConductor::Test
11
+
12
+ self.extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
13
+
14
+ # Check my_test_plugin.rb.sample documentation for signature details.
15
+ def test_on_node
16
+ # Flatten the paths rules so that we can spot inconsistencies in configuration
17
+ Hash[
18
+ @config.aggregate_files_rules(@nodes_handler, @node).map do |path, rule_info|
19
+ [
20
+ "if sudo /bin/bash -c '[[ -d \"#{path}\" ]]' ; then echo 1 ; else echo 0 ; fi",
21
+ {
22
+ validator: proc do |stdout, stderr|
23
+ case stdout.last
24
+ when '1'
25
+ error "Path found that should be absent: #{path}" if rule_info[:state] == :absent
26
+ when '0'
27
+ error "Path not found that should be present: #{path}" if rule_info[:state] == :present
28
+ else
29
+ error "Could not check for existence of path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
30
+ end
31
+ end,
32
+ timeout: 2
33
+ }
34
+ ]
35
+ end
36
+ ]
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,45 @@
1
+ require 'hybrid_platforms_conductor/common_config_dsl/file_system_tests'
2
+
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Perform various tests on a HDFS's file system
10
+ class FileSystemHdfs < HybridPlatformsConductor::Test
11
+
12
+ self.extend_config_dsl_with CommonConfigDsl::FileSystemTests, :init_file_system_tests
13
+
14
+ # Check my_test_plugin.rb.sample documentation for signature details.
15
+ def test_on_node
16
+ # Flatten the paths rules so that we can spot inconsistencies in configuration
17
+ Hash[
18
+ @config.aggregate_files_rules(@nodes_handler, @node, file_system_type: :hdfs).map do |path, rule_info|
19
+ [
20
+ "if sudo#{rule_info[:context][:sudo_user] ? " -u #{rule_info[:context][:sudo_user]}" : ''} hdfs dfs -ls \"#{path}\" ; then echo 1 ; else echo 0 ; fi",
21
+ {
22
+ validator: proc do |stdout, stderr|
23
+ case stdout.last
24
+ when '1'
25
+ error "HDFS path found that should be absent: #{path}" if rule_info[:state] == :absent
26
+ when '0'
27
+ error "HDFS path not found that should be present: #{path}" if rule_info[:state] == :present
28
+ else
29
+ error "Could not check for existence of HDFS path #{path}", "----- STDOUT:\n#{stdout.join("\n")}----- STDERR:\n#{stderr.join("\n")}"
30
+ end
31
+ end,
32
+ timeout: 5
33
+ }
34
+ ]
35
+ end
36
+ ]
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,25 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Test that the hostname is correct
8
+ class Hostname < HybridPlatformsConductor::Test
9
+
10
+ # Check my_test_plugin.rb.sample documentation for signature details.
11
+ def test_on_node
12
+ {
13
+ 'sudo hostname -s' => proc do |stdout|
14
+ assert_equal stdout.first, @node, "Expected hostname to be #{@node}, but got #{stdout.first} instead."
15
+ end
16
+ }
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,77 @@
1
+ require 'json'
2
+ require 'hybrid_platforms_conductor/common_config_dsl/idempotence_tests'
3
+ require 'hybrid_platforms_conductor/test_by_service'
4
+
5
+ module HybridPlatformsConductor
6
+
7
+ module HpcPlugins
8
+
9
+ module Test
10
+
11
+ # Test that a check-node after a deploy returns no error.
12
+ # This tests uses the testadmin user access once deployed.
13
+ # Don't forget to add the testadmin private key in your SSH agent if you run this test locally.
14
+ class Idempotence < TestByService
15
+
16
+ self.extend_config_dsl_with CommonConfigDsl::IdempotenceTests, :init_idempotence_tests
17
+
18
+ # Check my_test_plugin.rb.sample documentation for signature details.
19
+ def test_for_node
20
+ @deployer.with_test_provisioned_instance(@config.tests_provisioner_id, @node, environment: 'idempotence', reuse_instance: log_debug?) do |deployer, instance|
21
+ # First deploy as root
22
+ deployer.nbr_retries_on_error = 3
23
+ exit_status, _stdout, _stderr = deployer.deploy_on(@node)[@node]
24
+ if exit_status == 0
25
+ # As it's possible sshd has to be restarted because of a change in its conf, restart the container.
26
+ # Otherwise you'll get the following error upon reconnection:
27
+ # System is booting up. See pam_nologin(8)
28
+ # Authentication failed.
29
+ instance.stop
30
+ instance.with_running_instance(port: 22) do
31
+ # Now that the node has been deployed, use the a_testadmin user for the check-node (as root has no more access)
32
+ deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user = 'a_testadmin'
33
+ deployer.instance_variable_get(:@actions_executor).connector(:ssh).passwords.delete(@node)
34
+ deployer.use_why_run = true
35
+ deployer.nbr_retries_on_error = 0
36
+ result = deployer.deploy_on(@node)
37
+ assert_equal result.size, 1, "Wrong number of nodes being tested: #{result.size}"
38
+ tested_node, (exit_status, stdout, stderr) = result.first
39
+ if exit_status.is_a?(Symbol)
40
+ # In debug mode, the logger is the normal one, already outputting the error. No need to get it back from the logs.
41
+ error "Check-node could not run because of error: #{exit_status}.", log_debug? ? nil : deployer.stdouts_to_s
42
+ else
43
+ assert_equal tested_node, @node, "Wrong node being tested: #{tested_node} should be #{@node}"
44
+ assert_equal exit_status, 0, "Check-node returned error code #{exit_status}"
45
+ # Check that the output of the check-node returns no changes.
46
+ ignored_tasks = @nodes_handler.select_confs_for_node(@node, @config.ignored_idempotence_tasks).inject({}) do |merged_ignored_tasks, conf|
47
+ merged_ignored_tasks.merge(conf[:ignored_tasks])
48
+ end
49
+ @deployer.parse_deploy_output(@node, stdout, stderr).each do |task_info|
50
+ if task_info[:status] == :changed
51
+ if ignored_tasks.key?(task_info[:name])
52
+ # It was expected that this task is not idempotent
53
+ log_debug "Task #{task_info[:name]} was expected to not be idempotent. Reason: #{ignored_tasks[task_info[:name]]}"
54
+ else
55
+ extra_details = task_info.slice(*(task_info.keys - %i[name status diffs]))
56
+ error_details = []
57
+ error_details << "----- Changes:\n#{task_info[:diffs].strip}\n-----" if task_info[:diffs]
58
+ error_details << "----- Additional details:\n#{JSON.pretty_generate(extra_details)}\n-----" unless extra_details.empty?
59
+ error "Task #{task_info[:name]} is not idempotent", error_details.empty? ? nil : error_details.join("\n")
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ else
66
+ error 'Unable to deploy from scratch. Fix this before testing idempotence.', log_debug? ? nil : deployer.stdouts_to_s
67
+ end
68
+ end
69
+ end
70
+
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+
77
+ end
@@ -0,0 +1,38 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Test that the private IP address is correct
8
+ class Ip < HybridPlatformsConductor::Test
9
+
10
+ # Check my_test_plugin.rb.sample documentation for signature details.
11
+ def test_on_node
12
+ {
13
+ 'sudo hostname -I' => proc do |stdout|
14
+ if stdout.first.nil?
15
+ error 'No IP returned by "hostname -I"'
16
+ else
17
+ private_ips = @nodes_handler.get_private_ips_of @node
18
+ if private_ips
19
+ host_ips = stdout.first.split(' ').select { |ip| ip =~ /^172\.16\.\d+\.\d+$/ }.sort
20
+ ref_ips = private_ips.sort
21
+ assert_equal(
22
+ host_ips,
23
+ ref_ips,
24
+ "Expected IPs to be #{ref_ips}, but got #{host_ips} instead"
25
+ )
26
+ end
27
+ end
28
+ end
29
+ }
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,56 @@
1
+ require 'nokogiri'
2
+ require 'hybrid_platforms_conductor/credentials'
3
+ require 'hybrid_platforms_conductor/common_config_dsl/bitbucket'
4
+
5
+ module HybridPlatformsConductor
6
+
7
+ module HpcPlugins
8
+
9
+ module Test
10
+
11
+ # Check that all repositories have a correct Jenkins CI configuration.
12
+ class JenkinsCiConf < HybridPlatformsConductor::Test
13
+
14
+ self.extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
15
+
16
+ # Check my_test_plugin.rb.sample documentation for signature details.
17
+ def test
18
+ @config.for_each_bitbucket_repo do |bitbucket, repo_info|
19
+ if repo_info[:jenkins_ci_url].nil?
20
+ error "Repository #{repo_info[:name]} does not have any Jenkins CI URL configured."
21
+ else
22
+ Credentials.with_credentials_for(:jenkins_ci, @logger, @logger_stderr, url: repo_info[:jenkins_ci_url]) do |jenkins_user, jenkins_password|
23
+ # Get its config
24
+ begin
25
+ doc = Nokogiri::XML(open("#{repo_info[:jenkins_ci_url]}/config.xml", http_basic_authentication: [jenkins_user, jenkins_password]).read)
26
+ # Check that this job builds the correct Bitbucket repository
27
+ assert_equal(
28
+ doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/serverUrl').text,
29
+ bitbucket.bitbucket_url,
30
+ "Job #{repo_info[:jenkins_ci_url]} does not build repository from Bitbucket"
31
+ )
32
+ assert_equal(
33
+ doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repoOwner').text.downcase,
34
+ repo_info[:project].downcase,
35
+ "Job #{repo_info[:jenkins_ci_url]} does not build repository from project #{repo_info[:project]}"
36
+ )
37
+ assert_equal(
38
+ doc.xpath('/org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject/sources/data/jenkins.branch.BranchSource/source/repository').text,
39
+ repo_info[:name],
40
+ "Job #{repo_info[:jenkins_ci_url]} does not build repository named #{repo_info[:name]}"
41
+ )
42
+ rescue
43
+ error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{repo_info[:jenkins_ci_url]}: #{$!}"
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+ require 'hybrid_platforms_conductor/credentials'
3
+ require 'hybrid_platforms_conductor/common_config_dsl/bitbucket'
4
+
5
+ module HybridPlatformsConductor
6
+
7
+ module HpcPlugins
8
+
9
+ module Test
10
+
11
+ # Check that all repositories have a successful master branch on a Jenkins CI
12
+ class JenkinsCiMastersOk < HybridPlatformsConductor::Test
13
+
14
+ self.extend_config_dsl_with CommonConfigDsl::Bitbucket, :init_bitbucket
15
+
16
+ SUCCESS_STATUSES = [
17
+ # Add nil as the status of a currently running job (which is always the case for hybrid-platforms) is null
18
+ nil,
19
+ # Add ABORTED as it is impossible to make Groovy Pipelines return SUCCESS when we want to abort it normally.
20
+ 'ABORTED',
21
+ 'SUCCESS'
22
+ ]
23
+
24
+ # Check my_test_plugin.rb.sample documentation for signature details.
25
+ def test
26
+ @config.for_each_bitbucket_repo do |_bitbucket, repo_info|
27
+ if repo_info[:jenkins_ci_url].nil?
28
+ error "Repository #{repo_info[:name]} does not have any Jenkins CI URL configured."
29
+ else
30
+ master_info_url = "#{repo_info[:jenkins_ci_url]}/job/master/api/json"
31
+ Credentials.with_credentials_for(:jenkins_ci, @logger, @logger_stderr, url: master_info_url) do |jenkins_user, jenkins_password|
32
+ begin
33
+ # Get the master branch info from the API
34
+ master_info = JSON.parse(open(master_info_url, http_basic_authentication: [jenkins_user, jenkins_password]).read)
35
+ # Get the last build's URL
36
+ last_build_info_url = "#{master_info['lastBuild']['url']}/api/json"
37
+ last_build_info = JSON.parse(open(last_build_info_url, http_basic_authentication: [jenkins_user, jenkins_password]).read)
38
+ log_debug "Build info for #{master_info_url}:\n#{JSON.pretty_generate(last_build_info)}"
39
+ error "Last build for job #{repo_info[:project]}/#{repo_info[:name]} is in status #{last_build_info['result']}: #{master_info['lastBuild']['url']}" unless SUCCESS_STATUSES.include?(last_build_info['result'])
40
+ rescue
41
+ error "Error while checking Jenkins CI job for #{repo_info[:project]}/#{repo_info[:name]} from URL #{master_info_url}: #{$!}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
54
+ end