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,47 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Check that the repository is having a Git linear strategy on master.
8
+ class LinearStrategy < HybridPlatformsConductor::Test
9
+
10
+ # Number of seconds of the period after which we tolerate non-linear history in git
11
+ LOOKING_PERIOD = 6 * 31 * 24 * 60 * 60 # 6 months
12
+
13
+ # Check my_test_plugin.rb.sample documentation for signature details.
14
+ def test_on_platform
15
+ _exit_status, stdout, _stderr = @cmd_runner.run_cmd(
16
+ "cd #{@platform.repository_path} && git --no-pager log --merges --pretty=format:\"%H\"",
17
+ log_to_stdout: log_debug?
18
+ )
19
+ stdout.split("\n").each do |merge_commit_id|
20
+ _exit_status, stdout, _stderr = @cmd_runner.run_cmd(<<~EOS, log_to_stdout: log_debug?, no_exception: true, expected_code: [0, 1])
21
+ cd #{@platform.repository_path} && \
22
+ git --no-pager log \
23
+ $(git merge-base \
24
+ --octopus \
25
+ $(git --no-pager log #{merge_commit_id} --max-count 1 --pretty=format:\"%P\") \
26
+ )..#{merge_commit_id} \
27
+ --pretty=format:\"%H\" \
28
+ --graph \
29
+ | grep '|'
30
+ EOS
31
+ if !stdout.empty?
32
+ _exit_status, stdout, _stderr = @cmd_runner.run_cmd(
33
+ "cd #{@platform.repository_path} && git --no-pager log #{merge_commit_id} --pretty=format:%aI",
34
+ log_to_stdout: log_debug?
35
+ )
36
+ error "Git history is not linear because of Merge commit #{merge_commit_id}" if Time.now - Time.parse(stdout.strip) < LOOKING_PERIOD
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,82 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Test that the node's local users
8
+ class LocalUsers < HybridPlatformsConductor::Test
9
+
10
+ # Config DSL extension for this test plugin
11
+ module ConfigDslExtension
12
+
13
+ # List of users that should be absent from local users. Each info has the following properties:
14
+ # * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
15
+ # * *users* (Array<String>): List of users.
16
+ # Array< Hash<Symbol, Object> >
17
+ attr_reader :users_that_should_be_absent
18
+
19
+ # List of users that should be present from local users. Each info has the following properties:
20
+ # * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
21
+ # * *users* (Array<String>): List of users.
22
+ # Array< Hash<Symbol, Object> >
23
+ attr_reader :users_that_should_be_present
24
+
25
+ # Initialize the DSL
26
+ def init_local_users_test
27
+ @users_that_should_be_absent = []
28
+ @users_that_should_be_present = []
29
+ end
30
+
31
+ # Set a list of local users that should be absent.
32
+ #
33
+ # Parameters::
34
+ # * *users* (String or Array<String>): List of (or single) users
35
+ def check_local_users_do_not_exist(users)
36
+ @users_that_should_be_absent << {
37
+ nodes_selectors_stack: current_nodes_selectors_stack,
38
+ users: users.is_a?(Array) ? users : [users]
39
+ }
40
+ end
41
+
42
+ # Set a list of local users that should be present.
43
+ #
44
+ # Parameters::
45
+ # * *users* (String or Array<String>): List of (or single) users
46
+ def check_local_users_do_exist(users)
47
+ @users_that_should_be_present << {
48
+ nodes_selectors_stack: current_nodes_selectors_stack,
49
+ users: users.is_a?(Array) ? users : [users]
50
+ }
51
+ end
52
+
53
+ end
54
+
55
+ self.extend_config_dsl_with ConfigDslExtension, :init_local_users_test
56
+
57
+ # Check my_test_plugin.rb.sample documentation for signature details.
58
+ def test_on_node
59
+ {
60
+ "sudo cat /etc/passwd" => proc do |stdout|
61
+ passwd_users = stdout.map { |passwd_line| passwd_line.split(':').first }
62
+ missing_users = @nodes_handler.
63
+ select_confs_for_node(@node, @config.users_that_should_be_present).
64
+ inject([]) { |merged_users, users_info| merged_users + users_info[:users] }.
65
+ uniq - passwd_users
66
+ error "Missing local users that should be present: #{missing_users.join(', ')}" unless missing_users.empty?
67
+ extra_users = passwd_users & @nodes_handler.
68
+ select_confs_for_node(@node, @config.users_that_should_be_absent).
69
+ inject([]) { |merged_users, users_info| merged_users + users_info[:users] }.
70
+ uniq
71
+ error "Extra local users that should be absent: #{extra_users.join(', ')}" unless extra_users.empty?
72
+ end
73
+ }
74
+ end
75
+
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+
82
+ end
@@ -0,0 +1,120 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Various tests on mounts
8
+ class Mounts < HybridPlatformsConductor::Test
9
+
10
+ # Config DSL extension for this test plugin
11
+ module ConfigDslExtension
12
+
13
+ # List of mount rules that should be absent. Each info has the following properties:
14
+ # * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
15
+ # * *mount_rules* (Hash<String or Regexp, String or Regexp>): List of rules to check for absence.
16
+ # Array< Hash<Symbol, Object> >
17
+ attr_reader :mount_rules_that_should_be_absent
18
+
19
+ # List of mount rules that should be present. Each info has the following properties:
20
+ # * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
21
+ # * *mount_rules* (Hash<String or Regexp, String or Regexp>): List of rules to check for presence.
22
+ # Array< Hash<Symbol, Object> >
23
+ attr_reader :mount_rules_that_should_be_present
24
+
25
+ # Initialize the DSL
26
+ def init_mounts_test
27
+ @mount_rules_that_should_be_absent = []
28
+ @mount_rules_that_should_be_present = []
29
+ end
30
+
31
+ # Give a list of mounts rules to check for absence
32
+ #
33
+ # Parameters::
34
+ # * *mount_rules* (Hash<String or Regexp, String or Regexp>):
35
+ # List of (or single) sets of { source => destination } mounts that should not be present.
36
+ # Each source or destination can be a string for exact match, or a regexp to match a pattern on the mounts done on the node.
37
+ def check_mounts_do_not_include(mount_rules)
38
+ @mount_rules_that_should_be_absent << {
39
+ mount_rules: mount_rules,
40
+ nodes_selectors_stack: current_nodes_selectors_stack
41
+ }
42
+ end
43
+
44
+ # Give a list of mounts rules to check for presence
45
+ #
46
+ # Parameters::
47
+ # * *mount_rules* (Hash<String or Regexp, String or Regexp>):
48
+ # List of (or single) sets of { source => destination } mounts that should be present.
49
+ # Each source or destination can be a string for exact match, or a regexp to match a pattern on the mounts done on the node.
50
+ def check_mounts_do_include(mount_rules)
51
+ @mount_rules_that_should_be_present << {
52
+ mount_rules: mount_rules,
53
+ nodes_selectors_stack: current_nodes_selectors_stack
54
+ }
55
+ end
56
+
57
+ end
58
+
59
+ self.extend_config_dsl_with ConfigDslExtension, :init_mounts_test
60
+
61
+ # Check my_test_plugin.rb.sample documentation for signature details.
62
+ def test_on_node
63
+ {
64
+ 'sudo mount' => proc do |stdout|
65
+ mounts_info = stdout.map do |line|
66
+ fields = line.split
67
+ {
68
+ src: fields[0],
69
+ dst: fields[2],
70
+ type: fields[4],
71
+ options: fields[5][1..-2].split(',')
72
+ }
73
+ end
74
+ # Check all mount rules
75
+ @nodes_handler.select_confs_for_node(@node, @config.mount_rules_that_should_be_present).each do |mount_rules_info|
76
+ mount_rules_info[:mount_rules].each do |rule_src, rule_dst|
77
+ error "Missing mount matching #{rule_src} => #{rule_dst}", "Mounts: #{JSON.pretty_generate(mounts_info)}" unless mounts_info.any? { |mount_info| mount_matches?(mount_info, rule_src, rule_dst) }
78
+ end
79
+ end
80
+ @nodes_handler.select_confs_for_node(@node, @config.mount_rules_that_should_be_absent).each do |mount_rules_info|
81
+ mount_rules_info[:mount_rules].each do |rule_src, rule_dst|
82
+ extra_mounts = mounts_info.select { |mount_info| mount_matches?(mount_info, rule_src, rule_dst) }
83
+ error "The following mounts should not be present: #{extra_mounts.map { |mount_info| "#{mount_info[:src]} => #{mount_info[:dst]}" }.join(', ')} as forbidden by the rule #{rule_src} => #{rule_dst}", "Mounts: #{JSON.pretty_generate(mounts_info)}" unless extra_mounts.empty?
84
+ end
85
+ end
86
+ end
87
+ }
88
+ end
89
+
90
+ private
91
+
92
+ # Does a given mount info matches a rule source and destination?
93
+ #
94
+ # Parameters::
95
+ # * *mount_info* (Hash<Symbol,Object>): The mount info
96
+ # * *src* (String): Mount source
97
+ # * *dst* (String): Mount destination
98
+ # * *type* (String): Mount type
99
+ # * *options* (Array<String>): Mount options
100
+ # * *rule_src* (String or Regexp): Rule source
101
+ # * *rule_dst* (String or Regexp): Rule destination
102
+ # Result::
103
+ # * Boolean: Does a given mount info matches a rule source and destination?
104
+ def mount_matches?(mount_info, rule_src, rule_dst)
105
+ (
106
+ (rule_src.is_a?(String) && mount_info[:src] == rule_src) ||
107
+ (rule_src.is_a?(Regexp) && mount_info[:src] =~ rule_src)
108
+ ) && (
109
+ (rule_dst.is_a?(String) && mount_info[:dst] == rule_dst) ||
110
+ (rule_dst.is_a?(Regexp) && mount_info[:dst] =~ rule_dst)
111
+ )
112
+ end
113
+
114
+ end
115
+
116
+ end
117
+
118
+ end
119
+
120
+ end
@@ -0,0 +1,143 @@
1
+ # This file is an example of a generic Test plugin.
2
+ # The MyTestPlugin example contains example of code that could be used to write a plugin for new tests.
3
+ module HybridPlatformsConductor
4
+
5
+ module HpcPlugins
6
+
7
+ module Test
8
+
9
+ # Brief description of the plugin here.
10
+ # The name should match the file name.
11
+ # It should always inherit from Tests::Test.
12
+ #
13
+ # A test plugin can define 1 or several test methods, whose name will drive the way the test is run:
14
+ # * test: Global test run once.
15
+ # * test_for_platform: Platform-specific test run once per platform.
16
+ # * test_for_node: Node-specific test run once per node.
17
+ # * test_on_node: Node-specific test that test some SSH command execution directly on the node.
18
+ # * test_on_check_node: Node-specific test that test the result of a why-run deployment on the node.
19
+ # * self.only_on_platforms: Give a list of the platform types this test is supposed to run on. If nil, it means all.
20
+ # * self.only_on_nodes: Give a list of the node names this test is supposed to run on. If nil, it means all.
21
+ #
22
+ # In all instance methods of a test plugin, the following variables are accessible:
23
+ # * @nodes_handler (NodesHandler): Nodes handler used to access information about the platforms
24
+ # * @deployer (Deployer): Deployer used to deploy or check on the platforms
25
+ # In all instance methods of a test plugin, the following methods can be used for assertions (see their description in the file test.rb):
26
+ # * assert_equal(tested_object, expected_object, error_msg): Check equality between 2 objects and logs an error in case of mismatch.
27
+ # * assert_match(tested_object, expected_object, error_msg): Check string Regexp matching and logs an error in case of mismatch.
28
+ # * error(message): Log an error.
29
+ class MyTestPlugin < HybridPlatformsConductor::Test
30
+
31
+ # Are dependencies met before using this plugin?
32
+ # [API] - This method is optional
33
+ #
34
+ # Result::
35
+ # * Boolean: Are dependencies met before using this plugin?
36
+ def self.valid?
37
+ true
38
+ end
39
+
40
+ # Add a Mixin to the DSL parsing the platforms configuration file.
41
+ # This can be used by any plugin to add plugin-specific configuration getters and setters, accessible later from NodesHandler instances.
42
+ # An optional initializer can also be given.
43
+ # [API] - Those calls are optional
44
+ module MyDSLExtension
45
+
46
+ attr_accessor :my_property
47
+
48
+ # Initialize the DSL
49
+ def init_my_dsl_extension
50
+ @my_property = 42
51
+ end
52
+
53
+ end
54
+ self.extend_config_dsl_with MyDSLExtension, :init_my_dsl_extension
55
+
56
+ # Run test
57
+ def test
58
+ # If this method is defined, it will be simply run as is.
59
+ # This is useful to code global tests, that are not specific to 1 node or 1 platform.
60
+ assert_equal 2 + 2, 4, 'If this is displayed, it\'s serious!'
61
+ end
62
+
63
+ # Run test for each platform
64
+ # [API] - @platform can be used to adapt the code with the platform handling this node.
65
+ def test_for_platform
66
+ # If this method is defined, it will be used to execute once per platform to be tested.
67
+ assert_match @platform.repository_path, /my_platform_.+/, 'Platform name does not follow naming convention'
68
+ end
69
+
70
+ # Run test for each node
71
+ # [API] - @node can be used to adapt the code with the node.
72
+ def test_for_node
73
+ # If this method is defined, it will be used to execute once per node to be tested.
74
+ assert_match @node, /my_node_.+/, 'Node name does not follow naming convention'
75
+ end
76
+
77
+ # Run test using SSH commands on the node.
78
+ # Instead of executing the SSH commands directly on each node for each test, this method returns the list of commands to run and the test framework then groups them in 1 SSH connection.
79
+ # [API] - @node can be used to adapt the command with the node.
80
+ #
81
+ # Result::
82
+ # * Hash<String,Object>: For each command to execute, information regarding the assertion.
83
+ # * Values can be:
84
+ # * Proc: The code block making the test given the stdout of the command. Here is the Proc description:
85
+ # * Parameters::
86
+ # * *stdout* (Array<String>): List of lines of the stdout of the command.
87
+ # * *stderr* (Array<String>): List of lines of the stderr of the command.
88
+ # * *return_code* (Integer): The return code of the command.
89
+ # * Hash<Symbol,Object>: More complete information, that can contain the following keys:
90
+ # * *validator* (Proc): The proc containing the assertions to perform (as described above). This key is mandatory.
91
+ # * *timeout* (Integer): Timeout to wait for this command to execute.
92
+ def test_on_node
93
+ # If this method is defined, it will be used to execute SSH commands on each node that is being tested.
94
+ # For each SSH command, a validator code block will be called with the stdout of the command run remotely on the node.
95
+ # In place of a simple validator code block, a more complex structure can be used to give more info (for example timeout).
96
+ {
97
+ 'echo 1' => proc do |stdout|
98
+ assert_equal stdout.first, '1', 'Echo did not return 1 on the node!!!'
99
+ end,
100
+ "./longer_test_that_should_return_success.sh --hostname #{@node}" => {
101
+ validator: proc do |stdout|
102
+ error 'Test run but failed' if stdout.first == 'Start test' && !(stdout.last =~ /Success/)
103
+ end,
104
+ timeout: 30 # If the SSH session does not return in less than 30 seconds, we consider the test failed.
105
+ }
106
+ }
107
+ end
108
+
109
+ # Perform some testing on the check-node output.
110
+ # [API] - @node can be used to know for which node the test is being run.
111
+ #
112
+ # Parameters::
113
+ # * *stdout* (String): The check-node output
114
+ # * *stderr* (String): The check-node standard error
115
+ # * *exit_status* (Integer): The check-node exit status
116
+ def test_on_check_node(stdout, stderr, exit_status)
117
+ # If this method is defined, the tests runner will execute a why-run deploy on the node and call this method to have assertions on the stdout of the why-run deploy.
118
+ assert_match stdout.split("\n").last, /Success/, 'check-node did not end correctly'
119
+ end
120
+
121
+ # Limit the list of platform types for these tests.
122
+ #
123
+ # Result::
124
+ # * Array<Symbol> or nil: List of platform types allowed for this test, or nil for all
125
+ def self.only_on_platforms
126
+ [:chef]
127
+ end
128
+
129
+ # Limit the list of nodes for these tests.
130
+ #
131
+ # Result::
132
+ # * Array<String or Regex> or nil: List of nodes allowed for this test, or nil for all. Regular expressions matching node names can also be used.
133
+ def self.only_on_nodes
134
+ [/^xaehpc.+/, 'project-pinger']
135
+ end
136
+
137
+ end
138
+
139
+ end
140
+
141
+ end
142
+
143
+ end
@@ -0,0 +1,74 @@
1
+ module HybridPlatformsConductor
2
+
3
+ module HpcPlugins
4
+
5
+ module Test
6
+
7
+ # Test that the node has no orphan files
8
+ class OrphanFiles < HybridPlatformsConductor::Test
9
+
10
+ # Config DSL extension for this test plugin
11
+ module ConfigDslExtension
12
+
13
+ # List of paths to ignore info. Each info has the following properties:
14
+ # * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
15
+ # * *ignored_paths* (Array<String>): List of paths to ignore.
16
+ # Array< Hash<Symbol, Object> >
17
+ attr_reader :ignored_orphan_files_paths
18
+
19
+ # Initialize the DSL
20
+ def init_orphan_files_test
21
+ # List of paths to ignore info. Each info has the following properties:
22
+ # * *nodes_selectors_stack* (Array<Object>): Stack of nodes selectors impacted by this rule
23
+ # * *ignored_paths* (Array<String>): List of paths to ignore.
24
+ # Array< Hash<Symbol, Object> >
25
+ @ignored_orphan_files_paths = []
26
+ end
27
+
28
+ # Ignore a list of paths for orphan files testing
29
+ #
30
+ # Parameters::
31
+ # * *paths_to_ignore* (String or Array<String>): List of paths to ignore
32
+ def ignore_orphan_files_from(paths_to_ignore)
33
+ @ignored_orphan_files_paths << {
34
+ ignored_paths: paths_to_ignore.is_a?(Array) ? paths_to_ignore : [paths_to_ignore],
35
+ nodes_selectors_stack: current_nodes_selectors_stack,
36
+ }
37
+ end
38
+
39
+ end
40
+
41
+ self.extend_config_dsl_with ConfigDslExtension, :init_orphan_files_test
42
+
43
+ # List of directories to always ignore
44
+ DIRECTORIES_TO_ALWAYS_IGNORE = [
45
+ '/proc',
46
+ '/sys/kernel/debug',
47
+ '/sys/kernel/slab'
48
+ ]
49
+
50
+ # Check my_test_plugin.rb.sample documentation for signature details.
51
+ def test_on_node
52
+ {
53
+ "sudo /usr/bin/find / \\( #{@nodes_handler.
54
+ select_confs_for_node(@node, @config.ignored_orphan_files_paths).
55
+ inject(DIRECTORIES_TO_ALWAYS_IGNORE) { |merged_paths, paths_to_ignore_info| merged_paths + paths_to_ignore_info[:ignored_paths] }.
56
+ uniq.
57
+ map { |dir| "-path #{dir}" }.
58
+ join(' -o ')
59
+ } \\) -prune -o -nogroup -nouser -print" => {
60
+ validator: proc do |stdout|
61
+ assert_equal stdout, [], "#{stdout.size} orphan files found.", stdout.join("\n")
62
+ end,
63
+ timeout: 300
64
+ }
65
+ }
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+
72
+ end
73
+
74
+ end