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,58 @@
1
+ module HybridPlatformsConductorTest
2
+
3
+ module CmdbPlugins
4
+
5
+ # CMDB plugin that can be piloted by test cases to test how NodesHandler is using such plugins
6
+ class TestCmdbOthers2 < HybridPlatformsConductor::Cmdb
7
+
8
+ # Return the calls made to this plugin
9
+ # Array< [String, Object, Object...] >
10
+ # Array< [method_name, arg1, arg2... ] >
11
+ attr_accessor :calls
12
+
13
+ # get_* methods are automatically detected as possible metadata properties this plugin can fill.
14
+ # The property name filled by such method is given by the method's name: get_my_property will fill the :my_property metadata.
15
+ # The method get_others is used specifically to return properties whose name is unknown before fetching them.
16
+
17
+ # Get other properties for a given set of nodes.
18
+ # It's better to not use this method and prefer using methods naming the property being returned.
19
+ # As the nodes_handler can't know in advance which properties will be returned, it will call it every time there is a missing property.
20
+ # If this method always returns the same values, it would be clever to cache it here.
21
+ # [API] - This method is optional.
22
+ # [API] - @nodes_handler can be used.
23
+ # [API] - @cmd_runner can be used.
24
+ #
25
+ # Parameters::
26
+ # * *nodes* (Array<String>): The nodes to lookup the property for.
27
+ # * *metadata* (Hash<String, Hash<Symbol,Object> >): Existing metadata for each node. Dependent properties should be present here.
28
+ # Result::
29
+ # * Hash<String, Hash<Symbol,Object> >: The corresponding properties, per required node.
30
+ # Nodes for which the property can't be fetched can be ommitted.
31
+ def get_others(nodes, metadata)
32
+ record_call(:get_others, nodes, metadata)
33
+ Hash[nodes.map do |node|
34
+ [
35
+ node,
36
+ {
37
+ downcase: "__#{node}__"
38
+ }
39
+ ]
40
+ end]
41
+ end
42
+
43
+ # Register a call to be checked by the tests later
44
+ #
45
+ # Parameters::
46
+ # * *method* (Symbol): Method being called
47
+ # * *args* (Array<Object>): Arguments given to the call
48
+ def record_call(method, *args)
49
+ @calls = [] unless defined?(@calls)
50
+ # Create a shallow copy of the args, just to make sure they won't get changed by later code
51
+ @calls << [method] + Marshal.load(Marshal.dump(args))
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -0,0 +1,35 @@
1
+ describe 'check-node executable' do
2
+
3
+ # Setup a platform for check-node tests
4
+ #
5
+ # Parameters::
6
+ # * Proc: Code called when the platform is setup
7
+ # * Parameters::
8
+ # * *repository* (String): Platform's repository
9
+ def with_test_platform_for_check_node
10
+ with_test_platform({ nodes: { 'node' => {} } }) do |repository|
11
+ yield repository
12
+ end
13
+ end
14
+
15
+ it 'checks a given node' do
16
+ with_test_platform_for_check_node do
17
+ expect(test_deployer).to receive(:deploy_on).with('node') do
18
+ expect(test_deployer.use_why_run).to eq true
19
+ test_deployer.stdout_device << "Check ok\n"
20
+ { 'node' => [0, "Check ok\n", ''] }
21
+ end
22
+ exit_code, stdout, stderr = run 'check-node', '--node', 'node'
23
+ expect(exit_code).to eq 0
24
+ expect(stdout).to match /Check ok/
25
+ expect(stderr).to eq ''
26
+ end
27
+ end
28
+
29
+ it 'fails if no node is given' do
30
+ with_test_platform_for_check_node do
31
+ expect { run 'check-node' }.to raise_error(RuntimeError, 'No node selected. Please use --node option to set at least one.')
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,35 @@
1
+ describe 'deploy executable' do
2
+
3
+ # Setup a platform for deploy tests
4
+ #
5
+ # Parameters::
6
+ # * Proc: Code called when the platform is setup
7
+ # * Parameters::
8
+ # * *repository* (String): Platform's repository
9
+ def with_test_platform_for_deploy
10
+ with_test_platform({ nodes: { 'node' => {} } }) do |repository|
11
+ yield repository
12
+ end
13
+ end
14
+
15
+ it 'deploys a given node' do
16
+ with_test_platform_for_deploy do
17
+ expect(test_deployer).to receive(:deploy_on).with(['node']) do
18
+ expect(test_deployer.use_why_run).to eq false
19
+ test_deployer.stdout_device << "Deploy ok\n"
20
+ { 'node' => [0, "Deploy ok\n", ''] }
21
+ end
22
+ exit_code, stdout, stderr = run 'deploy', '--node', 'node'
23
+ expect(exit_code).to eq 0
24
+ expect(stdout).to match /Deploy ok/
25
+ expect(stderr).to eq ''
26
+ end
27
+ end
28
+
29
+ it 'fails if no node is given' do
30
+ with_test_platform_for_deploy do
31
+ expect { run 'deploy' }.to raise_error(RuntimeError, 'No node selected. Please use --node option to set at least one.')
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,158 @@
1
+ describe 'get_impacted_nodes executable' do
2
+
3
+ # Setup a platform for get_impacted_nodes tests
4
+ #
5
+ # Parameters::
6
+ # * Proc: Code called when the platform is setup
7
+ # * Parameters::
8
+ # * *repository* (String): Platform's repository
9
+ def with_test_platform_for_get_impacted_nodes
10
+ with_test_platform(
11
+ {
12
+ nodes: {
13
+ 'node1' => { services: %w[service1] },
14
+ 'node2' => { services: %w[service2] }
15
+ }
16
+ }
17
+ ) do |repository|
18
+ yield repository
19
+ end
20
+ end
21
+
22
+ it 'returns nodes impacted by a git diff' do
23
+ with_test_platform_for_get_impacted_nodes do
24
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
25
+ 'platform',
26
+ from_commit: 'master',
27
+ to_commit: nil,
28
+ smallest_set: false
29
+ ) { [%w[node1 node2], %w[node1], %w[service2], false] }
30
+ exit_code, stdout, stderr = run 'get_impacted_nodes', '--platform', 'platform'
31
+ expect(exit_code).to eq 0
32
+ expect(stdout).to eq <<~EOS
33
+
34
+ * 1 impacted services:
35
+ service2
36
+
37
+ * 1 impacted nodes (directly):
38
+ node1
39
+
40
+ * 2 impacted nodes (total):
41
+ node1
42
+ node2
43
+
44
+ EOS
45
+ expect(stderr).to eq ''
46
+ end
47
+ end
48
+
49
+ it 'returns nodes impacted by a git diff changing all nodes' do
50
+ with_test_platform_for_get_impacted_nodes do
51
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
52
+ 'platform',
53
+ from_commit: 'master',
54
+ to_commit: nil,
55
+ smallest_set: false
56
+ ) { [%w[node1 node2], %w[node1], %w[service2], true] }
57
+ exit_code, stdout, stderr = run 'get_impacted_nodes', '--platform', 'platform'
58
+ expect(exit_code).to eq 0
59
+ expect(stdout).to eq <<~EOS
60
+ * Potentially all nodes of this platform are impacted.
61
+
62
+ * 1 impacted services:
63
+ service2
64
+
65
+ * 1 impacted nodes (directly):
66
+ node1
67
+
68
+ * 2 impacted nodes (total):
69
+ node1
70
+ node2
71
+
72
+ EOS
73
+ expect(stderr).to eq ''
74
+ end
75
+ end
76
+
77
+ it 'returns nodes impacted by a git diff with from commit' do
78
+ with_test_platform_for_get_impacted_nodes do
79
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
80
+ 'platform',
81
+ from_commit: 'from_commit',
82
+ to_commit: nil,
83
+ smallest_set: false
84
+ ) { [%w[node1 node2], %w[node1], %w[service2], false] }
85
+ exit_code, stdout, stderr = run 'get_impacted_nodes', '--platform', 'platform', '--from-commit', 'from_commit'
86
+ expect(exit_code).to eq 0
87
+ expect(stdout).to eq <<~EOS
88
+
89
+ * 1 impacted services:
90
+ service2
91
+
92
+ * 1 impacted nodes (directly):
93
+ node1
94
+
95
+ * 2 impacted nodes (total):
96
+ node1
97
+ node2
98
+
99
+ EOS
100
+ expect(stderr).to eq ''
101
+ end
102
+ end
103
+
104
+ it 'returns nodes impacted by a git diff with to commit' do
105
+ with_test_platform_for_get_impacted_nodes do
106
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
107
+ 'platform',
108
+ from_commit: 'master',
109
+ to_commit: 'to_commit',
110
+ smallest_set: false
111
+ ) { [%w[node1 node2], %w[node1], %w[service2], false] }
112
+ exit_code, stdout, stderr = run 'get_impacted_nodes', '--platform', 'platform', '--to-commit', 'to_commit'
113
+ expect(exit_code).to eq 0
114
+ expect(stdout).to eq <<~EOS
115
+
116
+ * 1 impacted services:
117
+ service2
118
+
119
+ * 1 impacted nodes (directly):
120
+ node1
121
+
122
+ * 2 impacted nodes (total):
123
+ node1
124
+ node2
125
+
126
+ EOS
127
+ expect(stderr).to eq ''
128
+ end
129
+ end
130
+
131
+ it 'returns nodes impacted by a git diff with smallest test sample' do
132
+ with_test_platform_for_get_impacted_nodes do
133
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with(
134
+ 'platform',
135
+ from_commit: 'master',
136
+ to_commit: nil,
137
+ smallest_set: true
138
+ ) { [%w[node1 node2], %w[node1], %w[service2], false] }
139
+ exit_code, stdout, stderr = run 'get_impacted_nodes', '--platform', 'platform', '--smallest-test-sample'
140
+ expect(exit_code).to eq 0
141
+ expect(stdout).to eq <<~EOS
142
+
143
+ * 1 impacted services:
144
+ service2
145
+
146
+ * 1 impacted nodes (directly):
147
+ node1
148
+
149
+ * 2 impacted nodes (total smallest set):
150
+ node1
151
+ node2
152
+
153
+ EOS
154
+ expect(stderr).to eq ''
155
+ end
156
+ end
157
+
158
+ end
@@ -0,0 +1,173 @@
1
+ describe 'last_deploys executable' do
2
+
3
+ # Setup a platform for last_deploys tests
4
+ #
5
+ # Parameters::
6
+ # * Proc: Code called when the platform is setup
7
+ # * Parameters::
8
+ # * *repository* (String): Platform's repository
9
+ def with_test_platform_for_last_deploys
10
+ with_test_platform({ nodes: { 'node1' => {}, 'node2' => {} } }) do |repository|
11
+ yield repository
12
+ end
13
+ end
14
+
15
+ it 'checks all nodes by default' do
16
+ with_test_platform_for_last_deploys do
17
+ expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
18
+ expect(actions).to eq(
19
+ 'node1' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" },
20
+ 'node2' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" }
21
+ )
22
+ {
23
+ 'node1' => [0, <<~EOS, ''],
24
+ date: 2019-08-21 10:12:15
25
+ user: admin_user1
26
+ services: service1
27
+ EOS
28
+ 'node2' => [0, <<~EOS, '']
29
+ date: 2019-08-22 10:12:15
30
+ user: admin_user2
31
+ services: service1, service2
32
+ EOS
33
+ }
34
+ end])
35
+ exit_code, stdout, stderr = run 'last_deploys'
36
+ expect(exit_code).to eq 0
37
+ expect(stdout).to eq(<<~EOS)
38
+ +-------+---------------------+-------------+--------------------+-------+
39
+ | Node | Date | Admin | Services | Error |
40
+ +-------+---------------------+-------------+--------------------+-------+
41
+ | node1 | 2019-08-21 10:12:15 | admin_user1 | service1 | |
42
+ | node2 | 2019-08-22 10:12:15 | admin_user2 | service1, service2 | |
43
+ +-------+---------------------+-------------+--------------------+-------+
44
+ EOS
45
+ expect(stderr).to eq ''
46
+ end
47
+ end
48
+
49
+ it 'sorts results by user' do
50
+ with_test_platform_for_last_deploys do
51
+ expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
52
+ expect(actions).to eq(
53
+ 'node1' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" },
54
+ 'node2' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" }
55
+ )
56
+ {
57
+ 'node1' => [0, <<~EOS, ''],
58
+ date: 2019-08-21 10:12:15
59
+ user: admin_user2
60
+ services: service1
61
+ EOS
62
+ 'node2' => [0, <<~EOS, '']
63
+ date: 2019-08-22 10:12:15
64
+ user: admin_user1
65
+ services: service1, service2
66
+ EOS
67
+ }
68
+ end])
69
+ exit_code, stdout, stderr = run 'last_deploys', '--sort-by', 'user'
70
+ expect(exit_code).to eq 0
71
+ expect(stdout).to eq(<<~EOS)
72
+ +-------+---------------------+-------------+--------------------+-------+
73
+ | Node | Date | Admin | Services | Error |
74
+ +-------+---------------------+-------------+--------------------+-------+
75
+ | node2 | 2019-08-22 10:12:15 | admin_user1 | service1, service2 | |
76
+ | node1 | 2019-08-21 10:12:15 | admin_user2 | service1 | |
77
+ +-------+---------------------+-------------+--------------------+-------+
78
+ EOS
79
+ expect(stderr).to eq ''
80
+ end
81
+ end
82
+
83
+ it 'sorts results by user descending' do
84
+ with_test_platform_for_last_deploys do
85
+ expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
86
+ expect(actions).to eq(
87
+ 'node1' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" },
88
+ 'node2' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" }
89
+ )
90
+ {
91
+ 'node1' => [0, <<~EOS, ''],
92
+ date: 2019-08-21 10:12:15
93
+ user: admin_user2
94
+ services: service1
95
+ EOS
96
+ 'node2' => [0, <<~EOS, '']
97
+ date: 2019-08-22 10:12:15
98
+ user: admin_user1
99
+ services: service1, service2
100
+ EOS
101
+ }
102
+ end])
103
+ exit_code, stdout, stderr = run 'last_deploys', '--sort-by', 'user_desc'
104
+ expect(exit_code).to eq 0
105
+ expect(stdout).to eq(<<~EOS)
106
+ +-------+---------------------+-------------+--------------------+-------+
107
+ | Node | Date | Admin | Services | Error |
108
+ +-------+---------------------+-------------+--------------------+-------+
109
+ | node1 | 2019-08-21 10:12:15 | admin_user2 | service1 | |
110
+ | node2 | 2019-08-22 10:12:15 | admin_user1 | service1, service2 | |
111
+ +-------+---------------------+-------------+--------------------+-------+
112
+ EOS
113
+ expect(stderr).to eq ''
114
+ end
115
+ end
116
+
117
+ it 'displays only the selected nodes' do
118
+ with_test_platform_for_last_deploys do
119
+ expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
120
+ expect(actions).to eq('node1' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" })
121
+ {
122
+ 'node1' => [0, <<~EOS, ''],
123
+ date: 2019-08-21 10:12:15
124
+ user: admin_user1
125
+ services: service1
126
+ EOS
127
+ }
128
+ end])
129
+ exit_code, stdout, stderr = run 'last_deploys', '--node', 'node1'
130
+ expect(exit_code).to eq 0
131
+ expect(stdout).to eq(<<~EOS)
132
+ +-------+---------------------+-------------+----------+-------+
133
+ | Node | Date | Admin | Services | Error |
134
+ +-------+---------------------+-------------+----------+-------+
135
+ | node1 | 2019-08-21 10:12:15 | admin_user1 | service1 | |
136
+ +-------+---------------------+-------------+----------+-------+
137
+ EOS
138
+ expect(stderr).to eq ''
139
+ end
140
+ end
141
+
142
+ it 'displays errors when we can\'t get info from some nodes' do
143
+ with_test_platform_for_last_deploys do
144
+ expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
145
+ expect(actions).to eq(
146
+ 'node1' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" },
147
+ 'node2' => { remote_bash: "cd /var/log/deployments && ls -t | head -1 | xargs sed '/===== STDOUT =====/q'" }
148
+ )
149
+ {
150
+ 'node1' => [:connection_error, 'Error on stdout', 'Error on stderr'],
151
+ 'node2' => [0, <<~EOS, '']
152
+ date: 2019-08-22 10:12:15
153
+ user: admin_user1
154
+ services: service1, service2
155
+ EOS
156
+ }
157
+ end])
158
+ exit_code, stdout, stderr = run 'last_deploys', '--sort-by', 'user_desc'
159
+ expect(exit_code).to eq 0
160
+ expect(stdout).to eq(<<~EOS)
161
+ +-------+---------------------+-------------+--------------------+-------------------------+
162
+ | Node | Date | Admin | Services | Error |
163
+ +-------+---------------------+-------------+--------------------+-------------------------+
164
+ | node2 | 2019-08-22 10:12:15 | admin_user1 | service1, service2 | |
165
+ | node1 | | | | Error: connection_error |
166
+ | | | | | Error on stderr |
167
+ +-------+---------------------+-------------+--------------------+-------------------------+
168
+ EOS
169
+ expect(stderr).to eq ''
170
+ end
171
+ end
172
+
173
+ end