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,257 @@
1
+ describe HybridPlatformsConductor::TestsRunner do
2
+
3
+ context 'checking connection node tests execution' do
4
+
5
+ # Prepare the test platform with test plugins
6
+ #
7
+ # Parameters::
8
+ # * Proc: Code called with the platform setup
9
+ def with_test_platform_for_node_connection_tests
10
+ with_test_platforms(
11
+ 'platform1' => { nodes: { 'node11' => {}, 'node12' => {} } },
12
+ 'platform2' => { nodes: { 'node21' => {}, 'node22' => {} }, platform_type: :test2 }
13
+ ) do
14
+ register_test_plugins(test_tests_runner,
15
+ node_ssh_test: HybridPlatformsConductorTest::TestPlugins::NodeSsh,
16
+ node_ssh_test_2: HybridPlatformsConductorTest::TestPlugins::NodeSsh
17
+ )
18
+ yield
19
+ end
20
+ end
21
+
22
+ # Expect a given set of actions to execute test commands on a given set of nodes
23
+ #
24
+ # Parameters::
25
+ # * *actions* (Object): Actions
26
+ # * *node_suffixes* (Array<String>): The node suffixes
27
+ # * *fails_on* (Array<String>): The node suffixes on which we expect to fail [default: []]
28
+ # Result::
29
+ # * Hash<String, [Integer or Symbol, String, String] >: Expected result of those expected actions
30
+ def expect_actions_to_test_nodes(actions, node_suffixes, fails_on: [])
31
+ expect(actions.size).to eq node_suffixes.size
32
+ node_suffixes.each do |node_suffix|
33
+ node = "node#{node_suffix}"
34
+ expect(actions.key?(node)).to eq true
35
+ expect(actions[node].size).to eq 1
36
+ expect(actions[node][:remote_bash]).to eq [
37
+ 'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
38
+ '>&2 echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
39
+ "test_node#{node_suffix}.sh",
40
+ 'echo "$?"'
41
+ ]
42
+ end
43
+ Hash[node_suffixes.map do |node_suffix|
44
+ [
45
+ "node#{node_suffix}",
46
+ [
47
+ 0,
48
+ <<~EOS,
49
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
50
+ stdout#{node_suffix}
51
+ #{fails_on.include?(node_suffix) ? 1 : 0}
52
+ EOS
53
+ <<~EOS,
54
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
55
+ stderr#{node_suffix}
56
+ EOS
57
+ ]
58
+ ]
59
+ end]
60
+ end
61
+
62
+ it 'executes SSH node tests once per node with the correct command' do
63
+ with_test_platform_for_node_connection_tests do
64
+ expect_actions_executor_runs([proc { |actions| expect_actions_to_test_nodes(actions, %w[11 12 21 22]) }])
65
+ test_tests_runner.tests = [:node_ssh_test]
66
+ ssh_executions = []
67
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
68
+ 'node11' => { 'test_node11.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node11', stdout, stderr, exit_code] } },
69
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
70
+ 'node21' => { 'test_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
71
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
72
+ }}
73
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
74
+ expect(ssh_executions.sort).to eq [
75
+ ['node11', ['stdout11'], ['stderr11'], 0],
76
+ ['node12', ['stdout12'], ['stderr12'], 0],
77
+ ['node21', ['stdout21'], ['stderr21'], 0],
78
+ ['node22', ['stdout22'], ['stderr22'], 0]
79
+ ].sort
80
+ end
81
+ end
82
+
83
+ it 'executes SSH node tests only on specified nodes' do
84
+ with_test_platform_for_node_connection_tests do
85
+ expect_actions_executor_runs([proc { |actions| expect_actions_to_test_nodes(actions, %w[12 22]) }])
86
+ test_tests_runner.tests = [:node_ssh_test]
87
+ ssh_executions = []
88
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
89
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
90
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
91
+ }}
92
+ expect(test_tests_runner.run_tests(%w[node12 node22])).to eq 0
93
+ expect(ssh_executions.sort).to eq [
94
+ ['node12', ['stdout12'], ['stderr12'], 0],
95
+ ['node22', ['stdout22'], ['stderr22'], 0]
96
+ ].sort
97
+ end
98
+ end
99
+
100
+ it 'executes several SSH node tests once per node with the correct command, grouping commands' do
101
+ with_test_platform_for_node_connection_tests do
102
+ expect_actions_executor_runs([proc do |actions|
103
+ node_suffixes = %w[11 12 21 22]
104
+ expect(actions.size).to eq node_suffixes.size
105
+ node_suffixes.each do |node_suffix|
106
+ node = "node#{node_suffix}"
107
+ expect(actions.key?(node)).to eq true
108
+ expect(actions[node].size).to eq 1
109
+ expect(actions[node][:remote_bash]).to eq [
110
+ 'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
111
+ '>&2 echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
112
+ "test_node#{node_suffix}.sh",
113
+ 'echo "$?"',
114
+ 'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
115
+ '>&2 echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
116
+ "test2_node#{node_suffix}.sh",
117
+ 'echo "$?"'
118
+ ]
119
+ end
120
+ Hash[node_suffixes.map do |node_suffix|
121
+ [
122
+ "node#{node_suffix}",
123
+ [
124
+ 0,
125
+ <<~EOS,
126
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
127
+ stdout#{node_suffix}
128
+ 0
129
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
130
+ stdout#{node_suffix}_2
131
+ 0
132
+ EOS
133
+ <<~EOS
134
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
135
+ stderr#{node_suffix}
136
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
137
+ stderr#{node_suffix}_2
138
+ EOS
139
+ ]
140
+ ]
141
+ end]
142
+ end])
143
+ test_tests_runner.tests = [:node_ssh_test, :node_ssh_test_2]
144
+ ssh_executions = []
145
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = {
146
+ node_ssh_test: {
147
+ 'node11' => { 'test_node11.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node11', stdout, stderr, exit_code] } },
148
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
149
+ 'node21' => { 'test_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
150
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
151
+ },
152
+ node_ssh_test_2: {
153
+ 'node11' => { 'test2_node11.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node11', stdout, stderr, exit_code] } },
154
+ 'node12' => { 'test2_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
155
+ 'node21' => { 'test2_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
156
+ 'node22' => { 'test2_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
157
+ }
158
+ }
159
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
160
+ expect(ssh_executions.sort).to eq [
161
+ ['node11', ['stdout11'], ['stderr11'], 0],
162
+ ['node12', ['stdout12'], ['stderr12'], 0],
163
+ ['node21', ['stdout21'], ['stderr21'], 0],
164
+ ['node22', ['stdout22'], ['stderr22'], 0],
165
+ ['node11', ['stdout11_2'], ['stderr11_2'], 0],
166
+ ['node12', ['stdout12_2'], ['stderr12_2'], 0],
167
+ ['node21', ['stdout21_2'], ['stderr21_2'], 0],
168
+ ['node22', ['stdout22_2'], ['stderr22_2'], 0]
169
+ ].sort
170
+ end
171
+ end
172
+
173
+ it 'fails an SSH node test when the SSH command returns non zero exit code' do
174
+ with_test_platform_for_node_connection_tests do
175
+ expect_actions_executor_runs([proc { |actions| expect_actions_to_test_nodes(actions, %w[11 12 21 22], fails_on: ['12']) }])
176
+ test_tests_runner.tests = [:node_ssh_test]
177
+ ssh_executions = []
178
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
179
+ 'node11' => { 'test_node11.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node11', stdout, stderr, exit_code] } },
180
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
181
+ 'node21' => { 'test_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
182
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
183
+ }}
184
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 1
185
+ expect(ssh_executions.sort).to eq [
186
+ ['node11', ['stdout11'], ['stderr11'], 0],
187
+ ['node12', ['stdout12'], ['stderr12'], 1],
188
+ ['node21', ['stdout21'], ['stderr21'], 0],
189
+ ['node22', ['stdout22'], ['stderr22'], 0]
190
+ ].sort
191
+ end
192
+ end
193
+
194
+ it 'fails an SSH node test when the command test code raises an error' do
195
+ with_test_platform_for_node_connection_tests do
196
+ expect_actions_executor_runs([proc { |actions| expect_actions_to_test_nodes(actions, %w[11 12 21 22], fails_on: ['12']) }])
197
+ test_tests_runner.tests = [:node_ssh_test]
198
+ ssh_executions = []
199
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
200
+ 'node11' => { 'test_node11.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node11', stdout, stderr, exit_code] } },
201
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| raise 'Failure on this node' } },
202
+ 'node21' => { 'test_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
203
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
204
+ }}
205
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 1
206
+ expect(ssh_executions.sort).to eq [
207
+ ['node11', ['stdout11'], ['stderr11'], 0],
208
+ ['node21', ['stdout21'], ['stderr21'], 0],
209
+ ['node22', ['stdout22'], ['stderr22'], 0]
210
+ ].sort
211
+ end
212
+ end
213
+
214
+ it 'executes SSH node tests only on valid nodes' do
215
+ with_test_platform_for_node_connection_tests do
216
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.only_on_nodes = %w[node12 node22]
217
+ expect_actions_executor_runs([proc { |actions| expect_actions_to_test_nodes(actions, %w[12 22]) }])
218
+ test_tests_runner.tests = [:node_ssh_test]
219
+ ssh_executions = []
220
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
221
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
222
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
223
+ }}
224
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
225
+ expect(ssh_executions.sort).to eq [
226
+ ['node12', ['stdout12'], ['stderr12'], 0],
227
+ ['node22', ['stdout22'], ['stderr22'], 0]
228
+ ].sort
229
+ end
230
+ end
231
+
232
+ it 'executes SSH node tests in parallel' do
233
+ with_test_platform_for_node_connection_tests do
234
+ expect_actions_executor_runs([proc { |actions| expect_actions_to_test_nodes(actions, %w[11 12 21 22]) }])
235
+ test_tests_runner.tests = [:node_ssh_test]
236
+ test_tests_runner.max_threads_connection_on_nodes = 43
237
+ ssh_executions = []
238
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
239
+ 'node11' => { 'test_node11.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node11', stdout, stderr, exit_code] } },
240
+ 'node12' => { 'test_node12.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node12', stdout, stderr, exit_code] } },
241
+ 'node21' => { 'test_node21.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node21', stdout, stderr, exit_code] } },
242
+ 'node22' => { 'test_node22.sh' => proc { |stdout, stderr, exit_code| ssh_executions << ['node22', stdout, stderr, exit_code] } }
243
+ }}
244
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
245
+ expect(test_tests_runner.max_threads_connection_on_nodes).to eq 43
246
+ expect(ssh_executions.sort).to eq [
247
+ ['node11', ['stdout11'], ['stderr11'], 0],
248
+ ['node12', ['stdout12'], ['stderr12'], 0],
249
+ ['node21', ['stdout21'], ['stderr21'], 0],
250
+ ['node22', ['stdout22'], ['stderr22'], 0]
251
+ ].sort
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -0,0 +1,110 @@
1
+ describe HybridPlatformsConductor::TestsRunner do
2
+
3
+ context 'checking platform tests execution' do
4
+
5
+ # Prepare the test platform with test plugins
6
+ #
7
+ # Parameters::
8
+ # * Proc: Code called with the platform setup
9
+ def with_test_platform_for_platform_tests
10
+ with_test_platforms(
11
+ 'platform1' => { nodes: { 'node11' => {}, 'node12' => {}, 'node13' => {} } },
12
+ 'platform2' => { nodes: { 'node21' => {}, 'node22' => {}, 'node23' => {} }, platform_type: :test2 }
13
+ ) do
14
+ register_test_plugins(test_tests_runner,
15
+ platform_test: HybridPlatformsConductorTest::TestPlugins::Platform,
16
+ platform_test_2: HybridPlatformsConductorTest::TestPlugins::Platform
17
+ )
18
+ yield
19
+ end
20
+ end
21
+
22
+ it 'executes platform tests once per platform' do
23
+ with_test_platform_for_platform_tests do
24
+ test_tests_runner.tests = [:platform_test]
25
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
26
+ expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs.sort).to eq [[:platform_test, 'platform1'], [:platform_test, 'platform2']].sort
27
+ end
28
+ end
29
+
30
+ it 'executes several platform tests' do
31
+ with_test_platform_for_platform_tests do
32
+ test_tests_runner.tests = [:platform_test, :platform_test_2]
33
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
34
+ expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs.sort).to eq [
35
+ [:platform_test, 'platform1'],
36
+ [:platform_test, 'platform2'],
37
+ [:platform_test_2, 'platform1'],
38
+ [:platform_test_2, 'platform2']
39
+ ].sort
40
+ end
41
+ end
42
+
43
+ it 'executes platform tests only on valid platform types' do
44
+ with_test_platform_for_platform_tests do
45
+ test_tests_runner.tests = [:platform_test, :platform_test_2]
46
+ HybridPlatformsConductorTest::TestPlugins::Platform.only_on_platform_types = %i[test2]
47
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
48
+ expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs.sort).to eq [
49
+ [:platform_test, 'platform2'],
50
+ [:platform_test_2, 'platform2']
51
+ ].sort
52
+ end
53
+ end
54
+
55
+ it 'executes several platform tests in parallel' do
56
+ with_test_platform_for_platform_tests do
57
+ test_tests_runner.tests = [:platform_test, :platform_test_2]
58
+ test_tests_runner.max_threads_platforms = 4
59
+ HybridPlatformsConductorTest::TestPlugins::Platform.sleeps = {
60
+ platform_test: {
61
+ 'platform1' => 0.8,
62
+ 'platform2' => 0.4
63
+ },
64
+ platform_test_2: {
65
+ 'platform1' => 0.6,
66
+ 'platform2' => 0.2
67
+ }
68
+ }
69
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
70
+ expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs).to eq [
71
+ [:platform_test_2, 'platform2'],
72
+ [:platform_test, 'platform2'],
73
+ [:platform_test_2, 'platform1'],
74
+ [:platform_test, 'platform1']
75
+ ]
76
+ end
77
+ end
78
+
79
+ it 'executes several platform tests in parallel with a limited number of threads' do
80
+ with_test_platform_for_platform_tests do
81
+ test_tests_runner.tests = [:platform_test, :platform_test_2]
82
+ test_tests_runner.max_threads_platforms = 2
83
+ HybridPlatformsConductorTest::TestPlugins::Platform.sleeps = {
84
+ platform_test: {
85
+ 'platform1' => 0.8,
86
+ 'platform2' => 0.4
87
+ },
88
+ platform_test_2: {
89
+ 'platform1' => 0.6,
90
+ 'platform2' => 0.3
91
+ }
92
+ }
93
+ # Here is the sequence:
94
+ # Thread 1: +-t1p1 0.8------------+-t2p2 0.3 ----+
95
+ # Thread 2: +-t1p2 0.4-+-t2p1 0.6-|----------+ |
96
+ # | | | | |
97
+ # Time : 0 0.4 0.8 1.0 1.1
98
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
99
+ expect(HybridPlatformsConductorTest::TestPlugins::Platform.runs).to eq [
100
+ [:platform_test, 'platform2'],
101
+ [:platform_test, 'platform1'],
102
+ [:platform_test_2, 'platform1'],
103
+ [:platform_test_2, 'platform2']
104
+ ]
105
+ end
106
+ end
107
+
108
+ end
109
+
110
+ end
@@ -0,0 +1,367 @@
1
+ describe HybridPlatformsConductor::TestsRunner do
2
+
3
+ context 'checking reporting results of tests execution' do
4
+
5
+ # Setup a tests platform for the reports testing
6
+ #
7
+ # Parameters::
8
+ # * Proc: Code called with the platform setup
9
+ def with_test_platforms_for_reports_test
10
+ with_test_platforms(
11
+ 'platform1' => { nodes: { 'node11' => {}, 'node12' => {} } },
12
+ 'platform2' => { nodes: { 'node21' => {}, 'node22' => {} } }
13
+ ) do
14
+ register_tests_report_plugins(test_tests_runner, report: HybridPlatformsConductorTest::TestsReportPlugin)
15
+ register_test_plugins(test_tests_runner, {
16
+ global_test: HybridPlatformsConductorTest::TestPlugins::Global,
17
+ platform_test: HybridPlatformsConductorTest::TestPlugins::Platform,
18
+ node_test: HybridPlatformsConductorTest::TestPlugins::Node,
19
+ node_test_2: HybridPlatformsConductorTest::TestPlugins::Node,
20
+ node_ssh_test: HybridPlatformsConductorTest::TestPlugins::NodeSsh,
21
+ node_check_test: HybridPlatformsConductorTest::TestPlugins::NodeCheck,
22
+ several_tests: HybridPlatformsConductorTest::TestPlugins::SeveralChecks
23
+ })
24
+ test_tests_runner.reports = [:report]
25
+ yield
26
+ end
27
+ end
28
+
29
+ it 'reports correctly a global test' do
30
+ with_test_platforms_for_reports_test do
31
+ test_tests_runner.tests = [:global_test]
32
+ test_tests_runner.run_tests [{ all: true }]
33
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
34
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:global_tests].sort).to eq [
35
+ [:global_test, true]
36
+ ].sort
37
+ end
38
+ end
39
+
40
+ it 'reports correctly a global test that is failing' do
41
+ with_test_platforms_for_reports_test do
42
+ HybridPlatformsConductorTest::TestPlugins::Global.fail = true
43
+ test_tests_runner.tests = [:global_test]
44
+ test_tests_runner.run_tests [{ all: true }]
45
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
46
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:global_tests].sort).to eq [
47
+ [:global_test, true, ['Uncaught exception during test: Failing test']]
48
+ ].sort
49
+ end
50
+ end
51
+
52
+ it 'reports correctly a platform test' do
53
+ with_test_platforms_for_reports_test do
54
+ test_tests_runner.tests = [:platform_test]
55
+ test_tests_runner.run_tests [{ all: true }]
56
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
57
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:platform_tests].sort).to eq [
58
+ [:platform_test, true, 'platform1'],
59
+ [:platform_test, true, 'platform2']
60
+ ].sort
61
+ end
62
+ end
63
+
64
+ it 'reports correctly a platform test that is failing' do
65
+ with_test_platforms_for_reports_test do
66
+ HybridPlatformsConductorTest::TestPlugins::Platform.fail_for = ['platform1']
67
+ test_tests_runner.tests = [:platform_test]
68
+ test_tests_runner.run_tests [{ all: true }]
69
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
70
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:platform_tests].sort).to eq [
71
+ [:platform_test, true, 'platform1', ['Uncaught exception during test: Failing test']],
72
+ [:platform_test, true, 'platform2']
73
+ ].sort
74
+ end
75
+ end
76
+
77
+ it 'reports correctly a node test' do
78
+ with_test_platforms_for_reports_test do
79
+ test_tests_runner.tests = [:node_test]
80
+ test_tests_runner.run_tests [{ all: true }]
81
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
82
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:node_tests].sort).to eq [
83
+ [:node_test, true, 'node11'],
84
+ [:node_test, true, 'node12'],
85
+ [:node_test, true, 'node21'],
86
+ [:node_test, true, 'node22']
87
+ ].sort
88
+ end
89
+ end
90
+
91
+ it 'reports correctly a node test that is failing' do
92
+ with_test_platforms_for_reports_test do
93
+ HybridPlatformsConductorTest::TestPlugins::Node.fail_for = { node_test: %w[node12 node22] }
94
+ test_tests_runner.tests = [:node_test]
95
+ test_tests_runner.run_tests [{ all: true }]
96
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
97
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:node_tests].sort).to eq [
98
+ [:node_test, true, 'node11'],
99
+ [:node_test, true, 'node12', ['Uncaught exception during test: Failing test node_test for node12']],
100
+ [:node_test, true, 'node21'],
101
+ [:node_test, true, 'node22', ['Uncaught exception during test: Failing test node_test for node22']]
102
+ ].sort
103
+ end
104
+ end
105
+
106
+ it 'reports correctly a node SSH test' do
107
+ with_test_platforms_for_reports_test do
108
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
109
+ 'node11' => { 'test_node11.sh' => proc {} },
110
+ 'node12' => { 'test_node12.sh' => proc {} },
111
+ 'node21' => { 'test_node21.sh' => proc {} },
112
+ 'node22' => { 'test_node22.sh' => proc {} }
113
+ }}
114
+ expect_actions_executor_runs([proc do
115
+ {
116
+ 'node11' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n0\n", ''],
117
+ 'node12' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n0\n", ''],
118
+ 'node21' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n0\n", ''],
119
+ 'node22' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n0\n", '']
120
+ }
121
+ end])
122
+ test_tests_runner.tests = [:node_ssh_test]
123
+ test_tests_runner.run_tests [{ all: true }]
124
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
125
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:node_tests].sort).to eq [
126
+ [:node_ssh_test, true, 'node11'],
127
+ [:node_ssh_test, true, 'node12'],
128
+ [:node_ssh_test, true, 'node21'],
129
+ [:node_ssh_test, true, 'node22']
130
+ ].sort
131
+ end
132
+ end
133
+
134
+ it 'reports correctly a node SSH test that is failing' do
135
+ with_test_platforms_for_reports_test do
136
+ HybridPlatformsConductorTest::TestPlugins::NodeSsh.node_tests = { node_ssh_test: {
137
+ 'node11' => { 'test_node11.sh' => proc {} },
138
+ 'node12' => { 'test_node12.sh' => proc {} },
139
+ 'node21' => { 'test_node21.sh' => proc {} },
140
+ 'node22' => { 'test_node22.sh' => proc {} }
141
+ }}
142
+ expect_actions_executor_runs([proc do
143
+ {
144
+ 'node11' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n0\n", ''],
145
+ 'node12' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n1\n", 'Failing node12'],
146
+ 'node21' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n0\n", ''],
147
+ 'node22' => [0, "===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\n2\n", 'Failing node22']
148
+ }
149
+ end])
150
+ test_tests_runner.tests = [:node_ssh_test]
151
+ test_tests_runner.run_tests [{ all: true }]
152
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
153
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:node_tests].sort).to eq [
154
+ [:node_ssh_test, true, 'node11'],
155
+ [:node_ssh_test, true, 'node12', ['Command \'test_node12.sh\' returned error code 1']],
156
+ [:node_ssh_test, true, 'node21'],
157
+ [:node_ssh_test, true, 'node22', ['Command \'test_node22.sh\' returned error code 2']]
158
+ ].sort
159
+ end
160
+ end
161
+
162
+ it 'reports correctly a node check test' do
163
+ with_test_platforms_for_reports_test do
164
+ expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
165
+ {
166
+ 'node11' => [0, 'node11 check ok', ''],
167
+ 'node12' => [0, 'node12 check ok', ''],
168
+ 'node21' => [0, 'node21 check ok', ''],
169
+ 'node22' => [0, 'node22 check ok', '']
170
+ }
171
+ end
172
+ test_tests_runner.tests = [:node_check_test]
173
+ test_tests_runner.run_tests [{ all: true }]
174
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
175
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:node_tests].sort).to eq [
176
+ [:node_check_test, true, 'node11'],
177
+ [:node_check_test, true, 'node12'],
178
+ [:node_check_test, true, 'node21'],
179
+ [:node_check_test, true, 'node22']
180
+ ].sort
181
+ end
182
+ end
183
+
184
+ it 'reports correctly a node check test that is failing' do
185
+ with_test_platforms_for_reports_test do
186
+ expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
187
+ {
188
+ 'node11' => [0, 'node11 check ok', ''],
189
+ 'node12' => [1, 'node12 check ok', 'Error for node12'],
190
+ 'node21' => [2, 'node21 check ok', 'Error for node21'],
191
+ 'node22' => [0, 'node22 check ok', '']
192
+ }
193
+ end
194
+ test_tests_runner.tests = [:node_check_test]
195
+ test_tests_runner.run_tests [{ all: true }]
196
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
197
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:node_tests].sort).to eq [
198
+ [:node_check_test, true, 'node11'],
199
+ [:node_check_test, true, 'node12', ['Check-node returned error code 1']],
200
+ [:node_check_test, true, 'node21', ['Check-node returned error code 2']],
201
+ [:node_check_test, true, 'node22']
202
+ ].sort
203
+ end
204
+ end
205
+
206
+ it 'receives information about all levels being tested' do
207
+ with_test_platforms_for_reports_test do
208
+ # Mock the Actions Executor and Deployer expected calls
209
+ expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
210
+ expect(test_deployer.use_why_run).to eq true
211
+ {
212
+ 'node11' => [0, 'node11 check ok', 'node11 stderr'],
213
+ 'node12' => [0, 'node12 check ok', 'node12 stderr'],
214
+ 'node21' => [0, 'node21 check ok', 'node21 stderr'],
215
+ 'node22' => [0, 'node22 check ok', 'node22 stderr']
216
+ }
217
+ end
218
+ expect_actions_executor_runs([proc do |actions|
219
+ node_suffixes = %w[11 12 21 22]
220
+ expect(actions.size).to eq node_suffixes.size
221
+ node_suffixes.each do |node_suffix|
222
+ node = "node#{node_suffix}"
223
+ expect(actions.key?(node)).to eq true
224
+ expect(actions[node].size).to eq 1
225
+ expect(actions[node][:remote_bash]).to eq [
226
+ 'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
227
+ '>&2 echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
228
+ "test_node#{node_suffix}.sh",
229
+ 'echo "$?"'
230
+ ]
231
+ end
232
+ Hash[node_suffixes.map do |node_suffix|
233
+ [
234
+ "node#{node_suffix}",
235
+ [
236
+ 0,
237
+ <<~EOS,
238
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
239
+ stdout#{node_suffix}
240
+ 0
241
+ EOS
242
+ <<~EOS
243
+ ===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====
244
+ stderr#{node_suffix}
245
+ EOS
246
+ ]
247
+ ]
248
+ end]
249
+ end])
250
+ # Run everything
251
+ test_tests_runner.tests = [:several_tests]
252
+ expect(test_tests_runner.run_tests([{ all: true }])).to eq 0
253
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
254
+ first_report = HybridPlatformsConductorTest::TestsReportPlugin.reports.first
255
+ expect(first_report[:global_tests].sort).to eq [
256
+ [:several_tests, true]
257
+ ].sort
258
+ expect(first_report[:platform_tests].sort).to eq [
259
+ [:several_tests, true, 'platform1'],
260
+ [:several_tests, true, 'platform2']
261
+ ].sort
262
+ # There are 3 node tests for each node: 1 for SSH, 1 for check-node and 1 normal
263
+ expect(first_report[:node_tests].sort).to eq [
264
+ [:several_tests, true, 'node11'],
265
+ [:several_tests, true, 'node12'],
266
+ [:several_tests, true, 'node21'],
267
+ [:several_tests, true, 'node22'],
268
+ [:several_tests, true, 'node11'],
269
+ [:several_tests, true, 'node12'],
270
+ [:several_tests, true, 'node21'],
271
+ [:several_tests, true, 'node22'],
272
+ [:several_tests, true, 'node11'],
273
+ [:several_tests, true, 'node12'],
274
+ [:several_tests, true, 'node21'],
275
+ [:several_tests, true, 'node22']
276
+ ].sort
277
+ end
278
+ end
279
+
280
+ it 'groups errors correctly by their attributes' do
281
+ with_test_platforms_for_reports_test do
282
+ test_tests_runner.tests = [:node_test, :node_test_2]
283
+ HybridPlatformsConductorTest::TestPlugins::Node.fail_for = {
284
+ node_test: %w[node12 node22],
285
+ node_test_2: %w[node21 node22]
286
+ }
287
+ test_tests_runner.run_tests [{ all: true }]
288
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
289
+ errors_per_test = HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:errors_per_test]
290
+ expect(errors_per_test.size).to eq 2
291
+ expect(errors_per_test[:node_test].sort).to eq [
292
+ 'Uncaught exception during test: Failing test node_test for node12',
293
+ 'Uncaught exception during test: Failing test node_test for node22'
294
+ ].sort
295
+ expect(errors_per_test[:node_test_2].sort).to eq [
296
+ 'Uncaught exception during test: Failing test node_test_2 for node21',
297
+ 'Uncaught exception during test: Failing test node_test_2 for node22'
298
+ ].sort
299
+ end
300
+ end
301
+
302
+ it 'returns correctly nodes by nodes lists' do
303
+ with_test_platform(
304
+ {
305
+ nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {}, 'node4' => {}, 'node5' => {} },
306
+ nodes_lists: {
307
+ 'nodes_list1' => %w[node1 node3],
308
+ 'nodes_list2' => %w[node2 node3 node4]
309
+ }
310
+ },
311
+ false,
312
+ '
313
+ for_nodes(\'node1\') do
314
+ expect_tests_to_fail(:node_test, \'Expected failure\')
315
+ end
316
+ '
317
+ ) do
318
+ register_tests_report_plugins(test_tests_runner, report: HybridPlatformsConductorTest::TestsReportPlugin)
319
+ register_test_plugins(test_tests_runner, node_test: HybridPlatformsConductorTest::TestPlugins::Node)
320
+ HybridPlatformsConductorTest::TestPlugins::Node.fail_for = { node_test: %w[node1 node5] }
321
+ test_tests_runner.reports = [:report]
322
+ test_tests_runner.tests = [:node_test]
323
+ test_tests_runner.run_tests %w[node1 node2 node3 node5]
324
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
325
+ nodes_by_nodes_list = HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:nodes_by_nodes_list]
326
+ expect(nodes_by_nodes_list.size).to eq 4
327
+ expect(nodes_by_nodes_list['nodes_list1'][:nodes].sort).to eq %w[node1 node3].sort
328
+ expect(nodes_by_nodes_list['nodes_list1'][:tested_nodes].sort).to eq %w[node1 node3].sort
329
+ expect(nodes_by_nodes_list['nodes_list1'][:tested_nodes_in_error].sort).to eq %w[node1].sort
330
+ expect(nodes_by_nodes_list['nodes_list1'][:tested_nodes_in_error_as_expected].sort).to eq %w[node1].sort
331
+ expect(nodes_by_nodes_list['nodes_list2'][:nodes].sort).to eq %w[node2 node3 node4].sort
332
+ expect(nodes_by_nodes_list['nodes_list2'][:tested_nodes].sort).to eq %w[node2 node3].sort
333
+ expect(nodes_by_nodes_list['nodes_list2'][:tested_nodes_in_error].sort).to eq %w[].sort
334
+ expect(nodes_by_nodes_list['nodes_list2'][:tested_nodes_in_error_as_expected].sort).to eq %w[].sort
335
+ expect(nodes_by_nodes_list['No list'][:nodes].sort).to eq %w[node5].sort
336
+ expect(nodes_by_nodes_list['No list'][:tested_nodes].sort).to eq %w[node5].sort
337
+ expect(nodes_by_nodes_list['No list'][:tested_nodes_in_error].sort).to eq %w[node5].sort
338
+ expect(nodes_by_nodes_list['No list'][:tested_nodes_in_error_as_expected].sort).to eq %w[].sort
339
+ expect(nodes_by_nodes_list['All'][:nodes].sort).to eq %w[node1 node2 node3 node4 node5].sort
340
+ expect(nodes_by_nodes_list['All'][:tested_nodes].sort).to eq %w[node1 node2 node3 node5].sort
341
+ expect(nodes_by_nodes_list['All'][:tested_nodes_in_error].sort).to eq %w[node1 node5].sort
342
+ expect(nodes_by_nodes_list['All'][:tested_nodes_in_error_as_expected].sort).to eq %w[node1].sort
343
+ end
344
+ end
345
+
346
+ it 'can report on several reports' do
347
+ with_test_platforms_for_reports_test do
348
+ register_tests_report_plugins(test_tests_runner,
349
+ report1: HybridPlatformsConductorTest::TestsReportPlugin,
350
+ report2: HybridPlatformsConductorTest::TestsReportPlugin
351
+ )
352
+ test_tests_runner.reports = %i[report1 report2]
353
+ test_tests_runner.tests = [:global_test]
354
+ test_tests_runner.run_tests [{ all: true }]
355
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 2
356
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports[0][:global_tests].sort).to eq [
357
+ [:global_test, true]
358
+ ].sort
359
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports[1][:global_tests].sort).to eq [
360
+ [:global_test, true]
361
+ ].sort
362
+ end
363
+ end
364
+
365
+ end
366
+
367
+ end