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,256 @@
1
+ describe HybridPlatformsConductor::ActionsExecutor do
2
+
3
+ context 'checking logging facilities' do
4
+
5
+ # Instantiate a test platform, with the test action registered in Actions Executor.
6
+ #
7
+ # Parameters::
8
+ # * Proc: Code called with the environment ready
9
+ # * Parameters::
10
+ # * *repository* (String): Path to the repository
11
+ def with_test_platform_for_logging
12
+ with_test_platform_for_executor(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} }) do |repository|
13
+ yield repository
14
+ end
15
+ end
16
+
17
+ it 'captures stdout and stderr from action correctly' do
18
+ with_test_platform_for_logging do
19
+ expect(
20
+ test_actions_executor.execute_actions('node1' => { test_action: {
21
+ code: proc do |stdout, stderr|
22
+ stdout << 'action_stdout'
23
+ stderr << 'action_stderr'
24
+ end
25
+ } })
26
+ ).to eq('node1' => [0, 'action_stdout', 'action_stderr'])
27
+ end
28
+ end
29
+
30
+ it 'captures stdout and stderr from action correctly even when the action is failing' do
31
+ with_test_platform_for_logging do
32
+ expect(
33
+ test_actions_executor.execute_actions('node1' => { test_action: {
34
+ code: proc do |stdout, stderr|
35
+ stdout << "action_stdout\n"
36
+ stderr << "action_stderr\n"
37
+ raise 'Failing action'
38
+ end
39
+ } })
40
+ ).to eq('node1' => [:failed_action, "action_stdout\n", "action_stderr\nFailing action\n"])
41
+ end
42
+ end
43
+
44
+ it 'captures stdout and stderr from action correctly and logs in a file' do
45
+ with_repository('logs') do |logs_repository|
46
+ with_test_platform_for_logging do
47
+ expect(
48
+ test_actions_executor.execute_actions(
49
+ {
50
+ 'node1' => { test_action: {
51
+ code: proc do |stdout, stderr|
52
+ stdout << 'action_stdout'
53
+ stderr << 'action_stderr'
54
+ end
55
+ } }
56
+ },
57
+ log_to_dir: logs_repository
58
+ )
59
+ ).to eq('node1' => [0, 'action_stdout', 'action_stderr'])
60
+ expect(File.read("#{logs_repository}/node1.stdout")).to eq 'action_stdoutaction_stderr'
61
+ end
62
+ end
63
+ end
64
+
65
+ it 'captures stdout and stderr from action correctly when using run_cmd' do
66
+ with_test_platform_for_logging do
67
+ expect(
68
+ test_actions_executor.execute_actions('node1' => { test_action: { run_cmd: 'echo action_stdout && >&2 echo action_stderr' } })
69
+ ).to eq('node1' => [0, "action_stdout\n", "action_stderr\n"])
70
+ end
71
+ end
72
+
73
+ it 'captures stdout and stderr from action correctly when using run_cmd but with a failing command' do
74
+ with_test_platform_for_logging do
75
+ expect(
76
+ test_actions_executor.execute_actions('node1' => { test_action: { run_cmd: 'echo action_stdout && >&2 echo action_stderr && exit 1' } })
77
+ ).to eq('node1' => [
78
+ :failed_command,
79
+ "action_stdout\n",
80
+ "action_stderr\nCommand 'echo action_stdout && >&2 echo action_stderr && exit 1' returned error code 1 (expected 0).\n"
81
+ ])
82
+ end
83
+ end
84
+
85
+ it 'captures stdout and stderr sequentially from several actions' do
86
+ with_test_platform_for_logging do
87
+ expect(
88
+ test_actions_executor.execute_actions('node1' => [
89
+ { test_action: {
90
+ code: proc do |stdout, stderr|
91
+ stdout << 'action1_stdout '
92
+ stderr << 'action1_stderr '
93
+ end
94
+ } },
95
+ { test_action: {
96
+ run_cmd: 'echo action2_stdout && >&2 echo action2_stderr'
97
+ } },
98
+ { test_action: {
99
+ code: proc do |stdout, stderr|
100
+ stdout << 'action3_stdout'
101
+ stderr << 'action3_stderr'
102
+ end
103
+ } }
104
+ ])
105
+ ).to eq('node1' => [0, "action1_stdout action2_stdout\naction3_stdout", "action1_stderr action2_stderr\naction3_stderr"])
106
+ end
107
+ end
108
+
109
+ it 'dispatches stdout and stderr correctly among several nodes' do
110
+ with_test_platform_for_logging do
111
+ expect(
112
+ test_actions_executor.execute_actions(
113
+ 'node1' => { test_action: {
114
+ code: proc do |stdout, stderr|
115
+ stdout << 'action1_stdout'
116
+ stderr << 'action1_stderr'
117
+ end
118
+ } },
119
+ 'node2' => { test_action: {
120
+ code: proc do |stdout, stderr|
121
+ stdout << 'action2_stdout'
122
+ stderr << 'action2_stderr'
123
+ end
124
+ } },
125
+ 'node3' => { test_action: {
126
+ code: proc do |stdout, stderr|
127
+ stdout << 'action3_stdout'
128
+ stderr << 'action3_stderr'
129
+ end
130
+ } }
131
+ )
132
+ ).to eq(
133
+ 'node1' => [0, 'action1_stdout', 'action1_stderr'],
134
+ 'node2' => [0, 'action2_stdout', 'action2_stderr'],
135
+ 'node3' => [0, 'action3_stdout', 'action3_stderr']
136
+ )
137
+ end
138
+ end
139
+
140
+ it 'dispatches stdout and stderr correctly among several nodes with several actions' do
141
+ with_test_platform_for_logging do
142
+ expect(
143
+ test_actions_executor.execute_actions(
144
+ 'node1' => { test_action: {
145
+ code: proc do |stdout, stderr|
146
+ stdout << 'action1_stdout '
147
+ stderr << 'action1_stderr '
148
+ end
149
+ } },
150
+ %w[node1 node2] => [
151
+ { test_action: {
152
+ code: proc do |stdout, stderr|
153
+ stdout << 'action2_stdout '
154
+ stderr << 'action2_stderr '
155
+ end
156
+ } },
157
+ { test_action: {
158
+ code: proc do |stdout, stderr|
159
+ stdout << 'action3_stdout '
160
+ stderr << 'action3_stderr '
161
+ end
162
+ } }
163
+ ],
164
+ %w[node2 node3] => [
165
+ { test_action: {
166
+ code: proc do |stdout, stderr|
167
+ stdout << 'action4_stdout '
168
+ stderr << 'action4_stderr '
169
+ end
170
+ } },
171
+ { test_action: {
172
+ code: proc do |stdout, stderr|
173
+ stdout << 'action5_stdout '
174
+ stderr << 'action5_stderr '
175
+ end
176
+ } }
177
+ ]
178
+ )
179
+ ).to eq(
180
+ 'node1' => [0, 'action1_stdout action2_stdout action3_stdout ', 'action1_stderr action2_stderr action3_stderr '],
181
+ 'node2' => [0, 'action2_stdout action3_stdout action4_stdout action5_stdout ', 'action2_stderr action3_stderr action4_stderr action5_stderr '],
182
+ 'node3' => [0, 'action4_stdout action5_stdout ', 'action4_stderr action5_stderr ']
183
+ )
184
+ end
185
+ end
186
+
187
+ it 'executes several actions on several nodes and returns the corresponding stdout and stderr correctly in files' do
188
+ with_repository('logs') do |logs_repository|
189
+ with_test_platform_for_logging do
190
+ expect(test_actions_executor.execute_actions({
191
+ 'node1' => [
192
+ { test_action: { code: proc do |stdout, stderr|
193
+ stdout << 'node1_action1_stdout '
194
+ stderr << 'node1_action1_stderr '
195
+ sleep 1
196
+ end } },
197
+ { test_action: { code: proc do |stdout, stderr|
198
+ stdout << 'node1_action2_stdout '
199
+ stderr << 'node1_action2_stderr '
200
+ sleep 1
201
+ end } },
202
+ { test_action: { code: proc do |stdout, stderr|
203
+ stdout << 'node1_action3_stdout'
204
+ stderr << 'node1_action3_stderr'
205
+ end } }
206
+ ],
207
+ 'node2' => [
208
+ { test_action: { code: proc do |stdout, stderr|
209
+ stdout << 'node2_action1_stdout '
210
+ stderr << 'node2_action1_stderr '
211
+ sleep 1
212
+ end } },
213
+ { test_action: { code: proc do |stdout, stderr|
214
+ stdout << 'node2_action2_stdout '
215
+ stderr << 'node2_action2_stderr '
216
+ sleep 1
217
+ end } },
218
+ { test_action: { code: proc do |stdout, stderr|
219
+ stdout << 'node2_action3_stdout'
220
+ stderr << 'node2_action3_stderr'
221
+ end } }
222
+ ],
223
+ 'node3' => [
224
+ { test_action: { code: proc do |stdout, stderr|
225
+ stdout << 'node3_action1_stdout '
226
+ stderr << 'node3_action1_stderr '
227
+ sleep 1
228
+ end } },
229
+ { test_action: { code: proc do |stdout, stderr|
230
+ stdout << 'node3_action2_stdout '
231
+ stderr << 'node3_action2_stderr '
232
+ sleep 1
233
+ end } },
234
+ { test_action: { code: proc do |stdout, stderr|
235
+ stdout << 'node3_action3_stdout'
236
+ stderr << 'node3_action3_stderr'
237
+ end } }
238
+ ]
239
+ }, log_to_dir: logs_repository)).to eq(
240
+ 'node1' => [0, 'node1_action1_stdout node1_action2_stdout node1_action3_stdout', 'node1_action1_stderr node1_action2_stderr node1_action3_stderr'],
241
+ 'node2' => [0, 'node2_action1_stdout node2_action2_stdout node2_action3_stdout', 'node2_action1_stderr node2_action2_stderr node2_action3_stderr'],
242
+ 'node3' => [0, 'node3_action1_stdout node3_action2_stdout node3_action3_stdout', 'node3_action1_stderr node3_action2_stderr node3_action3_stderr']
243
+ )
244
+ # Check logs
245
+ log_files = Dir.glob("#{logs_repository}/*").map { |file| File.basename(file) }
246
+ expect(log_files.sort).to eq %w[node1.stdout node2.stdout node3.stdout].sort
247
+ expect(File.read("#{logs_repository}/node1.stdout")).to eq 'node1_action1_stdout node1_action1_stderr node1_action2_stdout node1_action2_stderr node1_action3_stdoutnode1_action3_stderr'
248
+ expect(File.read("#{logs_repository}/node2.stdout")).to eq 'node2_action1_stdout node2_action1_stderr node2_action2_stdout node2_action2_stderr node2_action3_stdoutnode2_action3_stderr'
249
+ expect(File.read("#{logs_repository}/node3.stdout")).to eq 'node3_action1_stdout node3_action1_stderr node3_action2_stdout node3_action2_stderr node3_action3_stdoutnode3_action3_stderr'
250
+ end
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end
@@ -0,0 +1,338 @@
1
+ describe HybridPlatformsConductor::ActionsExecutor do
2
+
3
+ context 'checking parallel runs' do
4
+
5
+ # Get a test platform to test parallel runs
6
+ #
7
+ # Parameters::
8
+ # * Proc: Code called with platform setup
9
+ def with_test_platform_for_parallel_tests
10
+ with_test_platform_for_executor(nodes: {
11
+ 'node1' => {},
12
+ 'node2' => {},
13
+ 'node3' => {},
14
+ 'node4' => {}
15
+ }) do
16
+ yield
17
+ end
18
+ end
19
+
20
+ it 'executes a simple command on several nodes in parallel' do
21
+ with_test_platform_for_parallel_tests do
22
+ nodes_executed = []
23
+ test_actions_executor.execute_actions({
24
+ 'node1' => { test_action: { code: proc do
25
+ sleep 2
26
+ nodes_executed << 'node1'
27
+ end } },
28
+ 'node2' => { test_action: { code: proc do
29
+ sleep 3
30
+ nodes_executed << 'node2'
31
+ end } },
32
+ 'node3' => { test_action: { code: proc do
33
+ sleep 1
34
+ nodes_executed << 'node3'
35
+ end } }
36
+ }, concurrent: true)
37
+ expect(nodes_executed).to eq %w[node3 node1 node2]
38
+ end
39
+ end
40
+
41
+ it 'executes several actions sequentially per node, but with nodes in parallel' do
42
+ with_test_platform_for_parallel_tests do
43
+ actions_executed = []
44
+ # Here is the sequence:
45
+ # * node1: --1---------2---3
46
+ # * node2: 1---2-----3
47
+ # * node3: ------1-2-----3
48
+ # * Time : 0 1 2 3 4 5 6 7 8
49
+ expect(test_actions_executor.execute_actions({
50
+ 'node1' => [
51
+ {
52
+ test_action: { code: proc do |stdout, stderr|
53
+ sleep 1
54
+ stdout << 'node1_action1 '
55
+ actions_executed << 'node1_action1'
56
+ end }
57
+ },
58
+ {
59
+ test_action: { code: proc do |stdout, stderr|
60
+ sleep 5
61
+ stdout << 'node1_action2 '
62
+ actions_executed << 'node1_action2'
63
+ end }
64
+ },
65
+ {
66
+ test_action: { code: proc do |stdout, stderr|
67
+ sleep 2
68
+ stdout << 'node1_action3'
69
+ actions_executed << 'node1_action3'
70
+ end }
71
+ }
72
+ ],
73
+ 'node2' => [
74
+ {
75
+ test_action: { code: proc do |stdout, stderr|
76
+ stdout << 'node2_action1 '
77
+ actions_executed << 'node2_action1'
78
+ end }
79
+ },
80
+ {
81
+ test_action: { code: proc do |stdout, stderr|
82
+ sleep 2
83
+ stdout << 'node2_action2 '
84
+ actions_executed << 'node2_action2'
85
+ end }
86
+ },
87
+ {
88
+ test_action: { code: proc do |stdout, stderr|
89
+ sleep 3
90
+ stdout << 'node2_action3'
91
+ actions_executed << 'node2_action3'
92
+ end }
93
+ }
94
+ ],
95
+ 'node3' => [
96
+ {
97
+ test_action: { code: proc do |stdout, stderr|
98
+ sleep 3
99
+ stdout << 'node3_action1 '
100
+ actions_executed << 'node3_action1'
101
+ end }
102
+ },
103
+ {
104
+ test_action: { code: proc do |stdout, stderr|
105
+ sleep 1
106
+ stdout << 'node3_action2 '
107
+ actions_executed << 'node3_action2'
108
+ end }
109
+ },
110
+ {
111
+ test_action: { code: proc do |stdout, stderr|
112
+ sleep 3
113
+ stdout << 'node3_action3'
114
+ actions_executed << 'node3_action3'
115
+ end }
116
+ }
117
+ ]
118
+ }, concurrent: true)).to eq(
119
+ 'node1' => [0, 'node1_action1 node1_action2 node1_action3', ''],
120
+ 'node2' => [0, 'node2_action1 node2_action2 node2_action3', ''],
121
+ 'node3' => [0, 'node3_action1 node3_action2 node3_action3', '']
122
+ )
123
+ expect(actions_executed).to eq %w[
124
+ node2_action1
125
+ node1_action1
126
+ node2_action2
127
+ node3_action1
128
+ node3_action2
129
+ node2_action3
130
+ node1_action2
131
+ node3_action3
132
+ node1_action3
133
+ ]
134
+ end
135
+ end
136
+
137
+ it 'executes several commands on several nodes with timeout on different actions depending on the node, in parallel' do
138
+ with_test_platform_for_parallel_tests do
139
+ expect(test_actions_executor.execute_actions(
140
+ {
141
+ 'node1' => [
142
+ { bash: 'sleep 1 && echo Node11' },
143
+ { bash: 'sleep 5 && echo Node12' }
144
+ ],
145
+ 'node2' => [
146
+ { bash: 'echo Node21' },
147
+ { bash: 'sleep 1 && echo Node22' }
148
+ ],
149
+ 'node3' => [
150
+ { bash: 'sleep 1 && echo Node31' },
151
+ { bash: 'sleep 1 && echo Node32' },
152
+ { bash: 'sleep 5 && echo Node33' }
153
+ ],
154
+ 'node4' => [
155
+ { bash: 'sleep 5 && echo Node41' }
156
+ ]
157
+ },
158
+ timeout: 3,
159
+ concurrent: true
160
+ )).to eq(
161
+ 'node1' => [:timeout, "Node11\n", ''],
162
+ 'node2' => [0, "Node21\nNode22\n", ''],
163
+ 'node3' => [:timeout, "Node31\nNode32\n", ''],
164
+ 'node4' => [:timeout, '', '']
165
+ )
166
+ end
167
+ end
168
+
169
+ it 'executes several actions on several nodes and returns the corresponding stdout and stderr correctly in parallel' do
170
+ with_test_platform_for_parallel_tests do
171
+ expect(test_actions_executor.execute_actions({
172
+ 'node1' => [
173
+ { test_action: { code: proc do |stdout, stderr|
174
+ stdout << 'node1_action1_stdout '
175
+ stderr << 'node1_action1_stderr '
176
+ end } },
177
+ { test_action: { code: proc do |stdout, stderr|
178
+ stdout << 'node1_action2_stdout '
179
+ stderr << 'node1_action2_stderr '
180
+ end } },
181
+ { test_action: { code: proc do |stdout, stderr|
182
+ stdout << 'node1_action3_stdout'
183
+ stderr << 'node1_action3_stderr'
184
+ end } }
185
+ ],
186
+ 'node2' => [
187
+ { test_action: { code: proc do |stdout, stderr|
188
+ stdout << 'node2_action1_stdout '
189
+ stderr << 'node2_action1_stderr '
190
+ end } },
191
+ { test_action: { code: proc do |stdout, stderr|
192
+ stdout << 'node2_action2_stdout '
193
+ stderr << 'node2_action2_stderr '
194
+ end } },
195
+ { test_action: { code: proc do |stdout, stderr|
196
+ stdout << 'node2_action3_stdout'
197
+ stderr << 'node2_action3_stderr'
198
+ end } }
199
+ ],
200
+ 'node3' => [
201
+ { test_action: { code: proc do |stdout, stderr|
202
+ stdout << 'node3_action1_stdout '
203
+ stderr << 'node3_action1_stderr '
204
+ end } },
205
+ { test_action: { code: proc do |stdout, stderr|
206
+ stdout << 'node3_action2_stdout '
207
+ stderr << 'node3_action2_stderr '
208
+ end } },
209
+ { test_action: { code: proc do |stdout, stderr|
210
+ stdout << 'node3_action3_stdout'
211
+ stderr << 'node3_action3_stderr'
212
+ end } }
213
+ ]
214
+ }, concurrent: true)).to eq(
215
+ 'node1' => [0, 'node1_action1_stdout node1_action2_stdout node1_action3_stdout', 'node1_action1_stderr node1_action2_stderr node1_action3_stderr'],
216
+ 'node2' => [0, 'node2_action1_stdout node2_action2_stdout node2_action3_stdout', 'node2_action1_stderr node2_action2_stderr node2_action3_stderr'],
217
+ 'node3' => [0, 'node3_action1_stdout node3_action2_stdout node3_action3_stdout', 'node3_action1_stderr node3_action2_stderr node3_action3_stderr']
218
+ )
219
+ end
220
+ end
221
+
222
+ it 'executes several actions on several nodes and returns the corresponding stdout and stderr correctly in parallel and in files' do
223
+ with_repository do |logs_repository|
224
+ with_test_platform_for_parallel_tests do
225
+ expect(test_actions_executor.execute_actions({
226
+ 'node1' => [
227
+ { test_action: { code: proc do |stdout, stderr|
228
+ stdout << 'node1_action1_stdout '
229
+ sleep 1
230
+ stderr << 'node1_action1_stderr '
231
+ sleep 1
232
+ end } },
233
+ { test_action: { code: proc do |stdout, stderr|
234
+ stdout << 'node1_action2_stdout '
235
+ sleep 1
236
+ stderr << 'node1_action2_stderr '
237
+ sleep 1
238
+ end } },
239
+ { test_action: { code: proc do |stdout, stderr|
240
+ stdout << 'node1_action3_stdout'
241
+ sleep 1
242
+ stderr << 'node1_action3_stderr'
243
+ end } }
244
+ ],
245
+ 'node2' => [
246
+ { test_action: { code: proc do |stdout, stderr|
247
+ stdout << 'node2_action1_stdout '
248
+ sleep 1
249
+ stderr << 'node2_action1_stderr '
250
+ sleep 1
251
+ end } },
252
+ { test_action: { code: proc do |stdout, stderr|
253
+ stdout << 'node2_action2_stdout '
254
+ sleep 1
255
+ stderr << 'node2_action2_stderr '
256
+ sleep 1
257
+ end } },
258
+ { test_action: { code: proc do |stdout, stderr|
259
+ stdout << 'node2_action3_stdout'
260
+ sleep 1
261
+ stderr << 'node2_action3_stderr'
262
+ end } }
263
+ ],
264
+ 'node3' => [
265
+ { test_action: { code: proc do |stdout, stderr|
266
+ stdout << 'node3_action1_stdout '
267
+ sleep 1
268
+ stderr << 'node3_action1_stderr '
269
+ sleep 1
270
+ end } },
271
+ { test_action: { code: proc do |stdout, stderr|
272
+ stdout << 'node3_action2_stdout '
273
+ sleep 1
274
+ stderr << 'node3_action2_stderr '
275
+ sleep 1
276
+ end } },
277
+ { test_action: { code: proc do |stdout, stderr|
278
+ stdout << 'node3_action3_stdout'
279
+ sleep 1
280
+ stderr << 'node3_action3_stderr'
281
+ end } }
282
+ ]
283
+ }, concurrent: true, log_to_dir: logs_repository)).to eq(
284
+ 'node1' => [0, 'node1_action1_stdout node1_action2_stdout node1_action3_stdout', 'node1_action1_stderr node1_action2_stderr node1_action3_stderr'],
285
+ 'node2' => [0, 'node2_action1_stdout node2_action2_stdout node2_action3_stdout', 'node2_action1_stderr node2_action2_stderr node2_action3_stderr'],
286
+ 'node3' => [0, 'node3_action1_stdout node3_action2_stdout node3_action3_stdout', 'node3_action1_stderr node3_action2_stderr node3_action3_stderr']
287
+ )
288
+ # Check logs
289
+ log_files = Dir.glob("#{logs_repository}/*").map { |file| File.basename(file) }
290
+ expect(log_files.sort).to eq %w[node1.stdout node2.stdout node3.stdout].sort
291
+ expect(File.read("#{logs_repository}/node1.stdout")).to eq 'node1_action1_stdout node1_action1_stderr node1_action2_stdout node1_action2_stderr node1_action3_stdoutnode1_action3_stderr'
292
+ expect(File.read("#{logs_repository}/node2.stdout")).to eq 'node2_action1_stdout node2_action1_stderr node2_action2_stdout node2_action2_stderr node2_action3_stdoutnode2_action3_stderr'
293
+ expect(File.read("#{logs_repository}/node3.stdout")).to eq 'node3_action1_stdout node3_action1_stderr node3_action2_stdout node3_action2_stderr node3_action3_stdoutnode3_action3_stderr'
294
+ end
295
+ end
296
+ end
297
+
298
+ it 'executes the same actions on several nodes and returns the corresponding stdout and stderr correctly in parallel and in files' do
299
+ with_repository do |logs_repository|
300
+ with_test_platform(nodes: { 'node1' => {}, 'node2' => {}, 'node3' => {} }) do
301
+ expect(test_actions_executor.execute_actions({
302
+ %w[node1 node2 node3] => [
303
+ { ruby: proc do |stdout, stderr, action|
304
+ stdout << "#{action.node}_action1_stdout "
305
+ sleep 1
306
+ stderr << "#{action.node}_action1_stderr "
307
+ sleep 1
308
+ end },
309
+ { ruby: proc do |stdout, stderr, action|
310
+ stdout << "#{action.node}_action2_stdout "
311
+ sleep 1
312
+ stderr << "#{action.node}_action2_stderr "
313
+ sleep 1
314
+ end },
315
+ { ruby: proc do |stdout, stderr, action|
316
+ stdout << "#{action.node}_action3_stdout"
317
+ sleep 1
318
+ stderr << "#{action.node}_action3_stderr"
319
+ end }
320
+ ]
321
+ }, concurrent: true, log_to_dir: logs_repository)).to eq(
322
+ 'node1' => [0, 'node1_action1_stdout node1_action2_stdout node1_action3_stdout', 'node1_action1_stderr node1_action2_stderr node1_action3_stderr'],
323
+ 'node2' => [0, 'node2_action1_stdout node2_action2_stdout node2_action3_stdout', 'node2_action1_stderr node2_action2_stderr node2_action3_stderr'],
324
+ 'node3' => [0, 'node3_action1_stdout node3_action2_stdout node3_action3_stdout', 'node3_action1_stderr node3_action2_stderr node3_action3_stderr']
325
+ )
326
+ # Check logs
327
+ log_files = Dir.glob("#{logs_repository}/*").map { |file| File.basename(file) }
328
+ expect(log_files.sort).to eq %w[node1.stdout node2.stdout node3.stdout].sort
329
+ expect(File.read("#{logs_repository}/node1.stdout")).to eq 'node1_action1_stdout node1_action1_stderr node1_action2_stdout node1_action2_stderr node1_action3_stdoutnode1_action3_stderr'
330
+ expect(File.read("#{logs_repository}/node2.stdout")).to eq 'node2_action1_stdout node2_action1_stderr node2_action2_stdout node2_action2_stderr node2_action3_stdoutnode2_action3_stderr'
331
+ expect(File.read("#{logs_repository}/node3.stdout")).to eq 'node3_action1_stdout node3_action1_stderr node3_action2_stdout node3_action2_stderr node3_action3_stdoutnode3_action3_stderr'
332
+ end
333
+ end
334
+ end
335
+
336
+ end
337
+
338
+ end