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,66 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ # Dummy action plugin that can be used to test interactions between Actions Executor and actions
4
+ class TestAction < HybridPlatformsConductor::Action
5
+
6
+ class << self
7
+
8
+ # List of executions info
9
+ # Array< Hash<Symbol,Object> >
10
+ # * *node* (String): Node on which the action has been executed
11
+ # * *message* (String): Message executed
12
+ attr_accessor :executions
13
+
14
+ # Reset variables, so that they don't interfere between tests
15
+ def reset
16
+ @executions = []
17
+ end
18
+
19
+ end
20
+
21
+ # Setup the action
22
+ #
23
+ # Parameters::
24
+ # * *input* (Hash<Symbol, Object>): The action input, as a set of properties:
25
+ # * *message* (String): The message to log in the executions. This is the default property that can be used in place of the Hash. [default = 'Action executed']
26
+ # * *run_cmd* (String or nil): A command to run with run_cmd, or nil if none [default = nil]
27
+ # * *need_connector* (Boolean): Does this action need a remote connection to the node? [default = false]
28
+ # * *code* (Proc or nil): Code to be called during action's execution, or nil if none [default = nil]
29
+ # * Parameters::
30
+ # * *stdout_io* (IO): stdout IO to be used for stdout logging
31
+ # * *stderr_io* (IO): stdout IO to be used for stderr logging
32
+ # * *action* (TestAction): The test action
33
+ def setup(input)
34
+ # Normalize input
35
+ input = { message: input } if input.is_a?(String)
36
+ # Set defaults
37
+ @input = {
38
+ message: 'Action executed',
39
+ need_connector: false
40
+ }.merge(input)
41
+ end
42
+
43
+ # Do we need a connector to execute this action on a node?
44
+ #
45
+ # Result::
46
+ # * Boolean: Do we need a connector to execute this action on a node?
47
+ def need_connector?
48
+ @input[:need_connector]
49
+ end
50
+
51
+ # Execute the action
52
+ def execute
53
+ run_cmd(@input[:run_cmd]) if @input.key?(:run_cmd)
54
+ @input[:code].call(@stdout_io, @stderr_io, self) if @input.key?(:code)
55
+ TestAction.executions << {
56
+ node: @node,
57
+ message: @input[:message]
58
+ }
59
+ end
60
+
61
+ # Integer: Timeout that the action should respect
62
+ attr_reader :timeout
63
+
64
+ end
65
+
66
+ end
@@ -0,0 +1,151 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ # Test connector
4
+ class TestConnector < HybridPlatformsConductor::Connector
5
+
6
+ # Array<Object<: Access calls made to the test connector
7
+ attr_reader :calls
8
+
9
+ # Array<String>: List of nodes accepted by this connector
10
+ attr_accessor :accept_nodes
11
+
12
+ # Array<String> or nil: List of nodes that will be connected, or nil for all
13
+ attr_accessor :connected_nodes
14
+
15
+ # Proc: Code executed when remote_bash is called
16
+ # Parameters::
17
+ # * *stdout* (IO): stdout to return
18
+ # * *stderr* (IO): stderr to return
19
+ # * *connector* (TestConnector): The current connector
20
+ attr_accessor :remote_bash_code
21
+
22
+ # Proc: Code executed when remote_copy is called
23
+ # Parameters::
24
+ # * *stdout* (IO): stdout to return
25
+ # * *stderr* (IO): stderr to return
26
+ # * *connector* (TestConnector): The current connector
27
+ attr_accessor :remote_copy_code
28
+
29
+ # Initialize the connector.
30
+ # This can be used to initialize global variables that are used for this connector
31
+ # [API] - This method is optional
32
+ # [API] - @cmd_runner can be used
33
+ # [API] - @nodes_handler can be used
34
+ def init
35
+ @calls = []
36
+ @accept_nodes = []
37
+ @connected_nodes = nil
38
+ @remote_bash_code = nil
39
+ end
40
+
41
+ # Complete an option parser with options meant to control this connector
42
+ # [API] - This method is optional
43
+ # [API] - @cmd_runner can be used
44
+ # [API] - @nodes_handler can be used
45
+ #
46
+ # Parameters::
47
+ # * *options_parser* (OptionParser): The option parser to complete
48
+ def options_parse(options_parser)
49
+ @calls << [:options_parse]
50
+ end
51
+
52
+ # Validate that parsed parameters are valid
53
+ # [API] - This method is optional
54
+ # [API] - @cmd_runner can be used
55
+ # [API] - @nodes_handler can be used
56
+ def validate_params
57
+ @calls << [:validate_params]
58
+ end
59
+
60
+ # Select nodes where this connector can connect.
61
+ # [API] - This method is mandatory
62
+ # [API] - @cmd_runner can be used
63
+ # [API] - @nodes_handler can be used
64
+ #
65
+ # Parameters::
66
+ # * *nodes* (Array<String>): List of candidate nodes
67
+ # Result::
68
+ # * Array<String>: List of nodes we can connect to from the candidates
69
+ def connectable_nodes_from(nodes)
70
+ @calls << [:connectable_nodes_from, nodes]
71
+ nodes & @accept_nodes
72
+ end
73
+
74
+ # Prepare connections to a given set of nodes.
75
+ # Useful to prefetch metadata or open bulk connections.
76
+ # [API] - This method is optional
77
+ # [API] - @cmd_runner can be used
78
+ # [API] - @nodes_handler can be used
79
+ #
80
+ # Parameters::
81
+ # * *nodes* (Array<String>): Nodes to prepare the connection to
82
+ # * *no_exception* (Boolean): Should we still continue if some nodes have connection errors? [default: false]
83
+ # * Proc: Code called with the connections prepared.
84
+ # * Parameters::
85
+ # * *connected_nodes* (Array<String>): The list of connected nodes (should be equal to nodes unless no_exception == true and some nodes failed to connect)
86
+ def with_connection_to(nodes, no_exception: false)
87
+ @calls << [:with_connection_to, nodes, { no_exception: no_exception }]
88
+ yield @connected_nodes.nil? ? nodes : @connected_nodes
89
+ end
90
+
91
+ # Run bash commands on a given node.
92
+ # [API] - This method is mandatory
93
+ # [API] - If defined, then with_connection_to has been called before this method.
94
+ # [API] - @cmd_runner can be used
95
+ # [API] - @nodes_handler can be used
96
+ # [API] - @node can be used to access the node on which we execute the remote bash
97
+ # [API] - @timeout can be used to know when the action should fail
98
+ # [API] - @stdout_io can be used to send stdout output
99
+ # [API] - @stderr_io can be used to send stderr output
100
+ #
101
+ # Parameters::
102
+ # * *bash_cmds* (String): Bash commands to execute
103
+ def remote_bash(bash_cmds)
104
+ @calls << [:remote_bash, bash_cmds]
105
+ @remote_bash_code.call(@stdout_io, @stderr_io, self) unless @remote_bash_code.nil?
106
+ end
107
+
108
+ # Execute an interactive shell on the remote node
109
+ # [API] - This method is mandatory
110
+ # [API] - If defined, then with_connection_to has been called before this method.
111
+ # [API] - @cmd_runner can be used
112
+ # [API] - @nodes_handler can be used
113
+ # [API] - @node can be used to access the node on which we execute the remote bash
114
+ # [API] - @timeout can be used to know when the action should fail
115
+ # [API] - @stdout_io can be used to send stdout output
116
+ # [API] - @stderr_io can be used to send stderr output
117
+ def remote_interactive
118
+ @calls << [:remote_interactive]
119
+ end
120
+
121
+ # Copy a file to the remote node in a directory
122
+ # [API] - This method is mandatory
123
+ # [API] - If defined, then with_connection_to has been called before this method.
124
+ # [API] - @cmd_runner can be used
125
+ # [API] - @nodes_handler can be used
126
+ # [API] - @node can be used to access the node on which we execute the remote bash
127
+ # [API] - @timeout can be used to know when the action should fail
128
+ # [API] - @stdout_io can be used to send stdout output
129
+ # [API] - @stderr_io can be used to send stderr output
130
+ #
131
+ # Parameters::
132
+ # * *from* (String): Local file to copy
133
+ # * *to* (String): Remote directory to copy to
134
+ # * *sudo* (Boolean): Do we use sudo to copy? [default: false]
135
+ # * *owner* (String or nil): Owner to be used when copying the files, or nil for current one [default: nil]
136
+ # * *group* (String or nil): Group to be used when copying the files, or nil for current one [default: nil]
137
+ def remote_copy(from, to, sudo: false, owner: nil, group: nil)
138
+ extra_opts = {}
139
+ extra_opts[:sudo] = sudo if sudo
140
+ extra_opts[:owner] = owner if owner
141
+ extra_opts[:group] = group if group
142
+ @calls << [:remote_copy, from, to] + (extra_opts.empty? ? [] : [extra_opts])
143
+ @remote_copy_code.call(@stdout_io, @stderr_io, self) unless @remote_copy_code.nil?
144
+ end
145
+
146
+ # Integer: The current desired timeout
147
+ attr_reader :timeout
148
+
149
+ end
150
+
151
+ end
@@ -0,0 +1,30 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module TestPlugins
4
+
5
+ # Test plugin at global level
6
+ class Global < HybridPlatformsConductor::Test
7
+
8
+ class << self
9
+
10
+ # Number of times our test has been run
11
+ # Integer
12
+ attr_accessor :nbr_runs
13
+
14
+ # Do we fail?
15
+ # Boolean
16
+ attr_accessor :fail
17
+
18
+ end
19
+
20
+ # Check my_test_plugin.rb.sample documentation for signature details.
21
+ def test
22
+ raise 'Failing test' if Global.fail
23
+ Global.nbr_runs += 1
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,53 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module TestPlugins
4
+
5
+ # Test plugin at node level
6
+ class Node < HybridPlatformsConductor::Test
7
+
8
+ class << self
9
+
10
+ # Sequences of nodes on which this test has been run
11
+ # Array< [ Symbol, String ] >
12
+ # Array< [ test_name, node ] >
13
+ attr_accessor :runs
14
+
15
+ # List of nodes for which we fail, per test name
16
+ # Hash<Symbol, Array<String> >
17
+ attr_accessor :fail_for
18
+
19
+ # List of platform types that should only be concerned by this test
20
+ # Array<Symbol>
21
+ attr_accessor :only_on_platform_types
22
+
23
+ # List of nodes that should only be concerned by this test
24
+ # Array<Symbol>
25
+ attr_accessor :only_on_nodes
26
+
27
+ # Eventual sleep time per node name, per test name
28
+ # Hash<Symbol, Hash<String, Integer> >
29
+ attr_accessor :sleeps
30
+
31
+ end
32
+
33
+ # Check my_test_plugin.rb.sample documentation for signature details.
34
+ def test_for_node
35
+ raise "Failing test #{@name} for #{@node}" if Node.fail_for.key?(@name) && Node.fail_for[@name].include?(@node)
36
+ sleep_time = Node.sleeps.dig(@name, @node)
37
+ sleep sleep_time unless sleep_time.nil?
38
+ Node.runs << [@name, @node]
39
+ end
40
+
41
+ # Limit the list of platform types for these tests.
42
+ #
43
+ # Result::
44
+ # * Array<Symbol> or nil: List of platform types allowed for this test, or nil for all
45
+ def self.only_on_platforms
46
+ Node.only_on_platform_types
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,47 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module TestPlugins
4
+
5
+ # Test plugin at node level using check-node results
6
+ class NodeCheck < HybridPlatformsConductor::Test
7
+
8
+ class << self
9
+
10
+ # Sequences of nodes on which this test has been run
11
+ # Array< [ Symbol, String, String, String, Integer ] >
12
+ # Array< [ test_name, node, stdout, stderr, exit_status ] >
13
+ attr_accessor :runs
14
+
15
+ # List of nodes for which we fail
16
+ # Array<String>
17
+ attr_accessor :fail_for
18
+
19
+ # List of platform types that should only be concerned by this test
20
+ # Array<Symbol>
21
+ attr_accessor :only_on_platform_types
22
+
23
+ # List of nodes that should only be concerned by this test
24
+ # Array<Symbol>
25
+ attr_accessor :only_on_nodes
26
+
27
+ end
28
+
29
+ # Check my_test_plugin.rb.sample documentation for signature details.
30
+ def test_on_check_node(stdout, stderr, exit_status)
31
+ raise 'Failing test' if NodeCheck.fail_for.include? @node
32
+ NodeCheck.runs << [@name, @node, stdout, stderr, exit_status]
33
+ end
34
+
35
+ # Limit the list of platform types for these tests.
36
+ #
37
+ # Result::
38
+ # * Array<Symbol> or nil: List of platform types allowed for this test, or nil for all
39
+ def self.only_on_platforms
40
+ NodeCheck.only_on_platform_types
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,42 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module TestPlugins
4
+
5
+ # Test plugin at node level using SSH
6
+ class NodeSsh < HybridPlatformsConductor::Test
7
+
8
+ class << self
9
+
10
+ # List of Bash commands and their corresponding testing code, per node name, per test name
11
+ # Hash< Symbol, Hash< String, Hash< String, Proc > > >
12
+ # Hash< test_name, Hash< node, Hash< bash_cmd, test_code > > >
13
+ attr_accessor :node_tests
14
+
15
+ # List of platform types that should only be concerned by this test
16
+ # Array<Symbol>
17
+ attr_accessor :only_on_platform_types
18
+
19
+ # List of nodes that should only be concerned by this test
20
+ # Array<Symbol>
21
+ attr_accessor :only_on_nodes
22
+
23
+ end
24
+
25
+ # Check my_test_plugin.rb.sample documentation for signature details.
26
+ def test_on_node
27
+ NodeSsh.node_tests[@name][@node]
28
+ end
29
+
30
+ # Limit the list of platform types for these tests.
31
+ #
32
+ # Result::
33
+ # * Array<Symbol> or nil: List of platform types allowed for this test, or nil for all
34
+ def self.only_on_platforms
35
+ NodeSsh.only_on_platform_types
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,50 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module TestPlugins
4
+
5
+ # Test plugin at platform level
6
+ class Platform < HybridPlatformsConductor::Test
7
+
8
+ class << self
9
+
10
+ # Sequences of platforms on which this test has been run
11
+ # Array< [ Symbol, String ] >
12
+ # Array< [ test_name, platform ] >
13
+ attr_accessor :runs
14
+
15
+ # List of platforms for which we fail
16
+ # Array<String>
17
+ attr_accessor :fail_for
18
+
19
+ # List of platform types that should only be concerned by this test
20
+ # Array<Symbol>
21
+ attr_accessor :only_on_platform_types
22
+
23
+ # Eventual sleep time per platform name, per test name
24
+ # Hash<Symbol, Hash<String, Integer> >
25
+ attr_accessor :sleeps
26
+
27
+ end
28
+
29
+ # Check my_test_plugin.rb.sample documentation for signature details.
30
+ def test_on_platform
31
+ platform_name = @platform.name
32
+ raise 'Failing test' if Platform.fail_for.include? platform_name
33
+ sleep_time = Platform.sleeps.dig(@name, platform_name)
34
+ sleep sleep_time unless sleep_time.nil?
35
+ Platform.runs << [@name, platform_name]
36
+ end
37
+
38
+ # Limit the list of platform types for these tests.
39
+ #
40
+ # Result::
41
+ # * Array<Symbol> or nil: List of platform types allowed for this test, or nil for all
42
+ def self.only_on_platforms
43
+ Platform.only_on_platform_types
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
50
+ end