hybrid_platforms_conductor 33.0.0 → 33.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bin/check-node +0 -1
  4. data/bin/deploy +0 -1
  5. data/bin/get_impacted_nodes +0 -1
  6. data/bin/last_deploys +8 -7
  7. data/bin/nodes_to_deploy +2 -2
  8. data/bin/setup +6 -6
  9. data/bin/topograph +1 -1
  10. data/lib/hybrid_platforms_conductor/action.rb +4 -4
  11. data/lib/hybrid_platforms_conductor/actions_executor.rb +37 -42
  12. data/lib/hybrid_platforms_conductor/bitbucket.rb +5 -4
  13. data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -12
  14. data/lib/hybrid_platforms_conductor/cmdb.rb +2 -2
  15. data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +2 -1
  16. data/lib/hybrid_platforms_conductor/common_config_dsl/confluence.rb +2 -1
  17. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +5 -4
  18. data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +4 -3
  19. data/lib/hybrid_platforms_conductor/common_config_dsl/idempotence_tests.rb +2 -2
  20. data/lib/hybrid_platforms_conductor/config.rb +7 -4
  21. data/lib/hybrid_platforms_conductor/confluence.rb +1 -1
  22. data/lib/hybrid_platforms_conductor/connector.rb +5 -2
  23. data/lib/hybrid_platforms_conductor/core_extensions/symbol/zero.rb +24 -0
  24. data/lib/hybrid_platforms_conductor/credentials.rb +39 -36
  25. data/lib/hybrid_platforms_conductor/current_dir_monitor.rb +4 -1
  26. data/lib/hybrid_platforms_conductor/deployer.rb +95 -96
  27. data/lib/hybrid_platforms_conductor/executable.rb +20 -15
  28. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/config.rb +10 -7
  29. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +1 -1
  30. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_keys.rb +2 -2
  31. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +4 -4
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +2 -0
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +45 -49
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +6 -5
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +68 -66
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +13 -0
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +39 -38
  38. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +5 -4
  39. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/docker.rb +43 -45
  40. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/podman.rb +18 -20
  41. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +118 -117
  42. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +39 -43
  43. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/reserve_proxmox_container +9 -13
  44. data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +2 -2
  45. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +28 -21
  46. data/lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb +26 -22
  47. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/cli.rb +8 -6
  48. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +7 -4
  49. data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +3 -3
  50. data/lib/hybrid_platforms_conductor/hpc_plugins/test/check_deploy_and_idempotence.rb +4 -2
  51. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +0 -1
  52. data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +21 -19
  53. data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +2 -2
  54. data/lib/hybrid_platforms_conductor/hpc_plugins/test/executables.rb +2 -2
  55. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +19 -21
  56. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +19 -21
  57. data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +2 -3
  58. data/lib/hybrid_platforms_conductor/hpc_plugins/test/idempotence.rb +2 -2
  59. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
  60. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +21 -22
  61. data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +10 -12
  62. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +9 -9
  63. data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -2
  64. data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +2 -2
  65. data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +10 -9
  66. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ports.rb +2 -2
  67. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +5 -5
  68. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +5 -5
  69. data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +4 -6
  70. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +3 -3
  71. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +25 -24
  72. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +2 -2
  73. data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/stdout.rb +8 -6
  74. data/lib/hybrid_platforms_conductor/io_router.rb +14 -13
  75. data/lib/hybrid_platforms_conductor/json_dumper.rb +2 -2
  76. data/lib/hybrid_platforms_conductor/log.rb +2 -2
  77. data/lib/hybrid_platforms_conductor/logger_helpers.rb +19 -16
  78. data/lib/hybrid_platforms_conductor/nodes_handler.rb +89 -71
  79. data/lib/hybrid_platforms_conductor/parallel_threads.rb +7 -11
  80. data/lib/hybrid_platforms_conductor/platform_handler.rb +7 -7
  81. data/lib/hybrid_platforms_conductor/platforms_handler.rb +5 -3
  82. data/lib/hybrid_platforms_conductor/plugin.rb +2 -2
  83. data/lib/hybrid_platforms_conductor/plugins.rb +13 -8
  84. data/lib/hybrid_platforms_conductor/provisioner.rb +4 -4
  85. data/lib/hybrid_platforms_conductor/report.rb +2 -2
  86. data/lib/hybrid_platforms_conductor/reports_handler.rb +3 -2
  87. data/lib/hybrid_platforms_conductor/secrets_reader.rb +2 -2
  88. data/lib/hybrid_platforms_conductor/services_handler.rb +32 -29
  89. data/lib/hybrid_platforms_conductor/test_only_remote_node.rb +1 -1
  90. data/lib/hybrid_platforms_conductor/test_report.rb +15 -18
  91. data/lib/hybrid_platforms_conductor/tests_runner.rb +116 -118
  92. data/lib/hybrid_platforms_conductor/thycotic.rb +28 -19
  93. data/lib/hybrid_platforms_conductor/topographer.rb +200 -190
  94. data/lib/hybrid_platforms_conductor/topographer/plugins/graphviz.rb +8 -8
  95. data/lib/hybrid_platforms_conductor/topographer/plugins/json.rb +4 -4
  96. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  97. data/spec/hybrid_platforms_conductor_test.rb +6 -6
  98. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +16 -11
  99. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
  100. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +23 -18
  101. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +67 -49
  102. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
  103. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +63 -50
  104. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +35 -35
  105. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +12 -8
  106. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +4 -7
  107. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +21 -22
  108. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/config_dsl_spec.rb +23 -24
  109. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connectable_nodes_spec.rb +10 -6
  110. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +73 -54
  111. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +145 -126
  112. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/node_helpers_spec.rb +3 -3
  113. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +29 -25
  114. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +106 -91
  115. data/spec/hybrid_platforms_conductor_test/api/actions_executor/parallel_spec.rb +272 -244
  116. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +10 -12
  117. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +36 -36
  118. data/spec/hybrid_platforms_conductor_test/api/config_spec.rb +24 -22
  119. data/spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb +4 -2
  120. data/spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb +7 -11
  121. data/spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb +34 -26
  122. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +21 -21
  123. data/spec/hybrid_platforms_conductor_test/api/deployer/parse_deploy_output_spec.rb +55 -59
  124. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +36 -62
  125. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/podman_spec.rb +17 -17
  126. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/config_dsl_spec.rb +4 -4
  127. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/create_spec.rb +44 -51
  128. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/destroy_spec.rb +3 -3
  129. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb +12 -16
  130. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/destroy_vm_spec.rb +31 -19
  131. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +324 -266
  132. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/ips_assignment_spec.rb +89 -61
  133. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/other_lxc_containers_resources_spec.rb +117 -93
  134. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/pve_node_resources_spec.rb +71 -54
  135. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +10 -8
  136. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/vm_ids_assignment_spec.rb +80 -60
  137. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/start_spec.rb +1 -1
  138. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb +1 -1
  139. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/stop_spec.rb +1 -1
  140. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/cli_spec.rb +21 -20
  141. data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +70 -55
  142. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/config_spec.rb +8 -10
  143. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +33 -24
  144. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_keys_spec.rb +64 -51
  145. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/platform_handlers_spec.rb +3 -3
  146. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +50 -51
  147. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/common_spec.rb +91 -81
  148. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/config_dsl_spec.rb +14 -16
  149. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/git_diff_impacts_spec.rb +51 -75
  150. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/nodes_selectors_spec.rb +35 -26
  151. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/platform_handlers_plugins_api_spec.rb +24 -16
  152. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb +29 -19
  153. data/spec/hybrid_platforms_conductor_test/api/platform_handler_spec.rb +4 -4
  154. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +2 -2
  155. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +6 -6
  156. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +57 -99
  157. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +4 -4
  158. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +32 -35
  159. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +10 -10
  160. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +38 -27
  161. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +46 -52
  162. data/spec/hybrid_platforms_conductor_test/api/reports_handler_spec.rb +2 -2
  163. data/spec/hybrid_platforms_conductor_test/api/services_handler/actions_to_deploy_spec.rb +90 -58
  164. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +38 -34
  165. data/spec/hybrid_platforms_conductor_test/api/services_handler/log_info_spec.rb +11 -9
  166. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +193 -171
  167. data/spec/hybrid_platforms_conductor_test/api/services_handler/parse_deploy_output_spec.rb +66 -54
  168. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +147 -133
  169. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +69 -49
  170. data/spec/hybrid_platforms_conductor_test/api/tests_runner/global_spec.rb +4 -3
  171. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +8 -5
  172. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_spec.rb +8 -5
  173. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +30 -27
  174. data/spec/hybrid_platforms_conductor_test/api/tests_runner/platform_spec.rb +12 -9
  175. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +48 -47
  176. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +5 -5
  177. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +5 -5
  178. data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb +5 -5
  179. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +9 -9
  180. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb2.rb → test_cmdb_2.rb} +6 -6
  181. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
  182. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/{test_cmdb_others2.rb → test_cmdb_others_2.rb} +2 -2
  183. data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
  184. data/spec/hybrid_platforms_conductor_test/executables/{check-node_spec.rb → check_node_spec.rb} +4 -6
  185. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +4 -6
  186. data/spec/hybrid_platforms_conductor_test/executables/get_impacted_nodes_spec.rb +76 -77
  187. data/spec/hybrid_platforms_conductor_test/executables/last_deploys_spec.rb +13 -15
  188. data/spec/hybrid_platforms_conductor_test/executables/nodes_to_deploy_spec.rb +289 -307
  189. data/spec/hybrid_platforms_conductor_test/executables/options/actions_executor_spec.rb +4 -6
  190. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +3 -5
  191. data/spec/hybrid_platforms_conductor_test/executables/options/common_spec.rb +8 -9
  192. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +12 -14
  193. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +9 -10
  194. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_selectors_spec.rb +9 -10
  195. data/spec/hybrid_platforms_conductor_test/executables/options/reports_handler_spec.rb +1 -1
  196. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +22 -22
  197. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +22 -16
  198. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +32 -32
  199. data/spec/hybrid_platforms_conductor_test/executables/ssh_config_spec.rb +7 -9
  200. data/spec/hybrid_platforms_conductor_test/executables/test_spec.rb +3 -5
  201. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +2 -2
  202. data/spec/hybrid_platforms_conductor_test/helpers/cmd_runner_helpers.rb +4 -3
  203. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
  204. data/spec/hybrid_platforms_conductor_test/helpers/config_helpers.rb +1 -1
  205. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +12 -13
  206. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +216 -14
  207. data/spec/hybrid_platforms_conductor_test/helpers/executables_helpers.rb +11 -11
  208. data/spec/hybrid_platforms_conductor_test/helpers/nodes_handler_helpers.rb +1 -1
  209. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +39 -28
  210. data/spec/hybrid_platforms_conductor_test/helpers/plugins_helpers.rb +1 -1
  211. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +86 -111
  212. data/spec/hybrid_platforms_conductor_test/helpers/reports_handler_helpers.rb +1 -1
  213. data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +3 -3
  214. data/spec/hybrid_platforms_conductor_test/helpers/services_handler_helpers.rb +1 -1
  215. data/spec/hybrid_platforms_conductor_test/helpers/tests_runner_helpers.rb +1 -1
  216. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id1.rb → test_plugin_id_1.rb} +0 -0
  217. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem/hpc_plugins/test_plugin_type/{test_plugin_id2.rb → test_plugin_id_2.rb} +0 -0
  218. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/test_plugin_type/{test_plugin_id3.rb → test_plugin_id_3.rb} +0 -0
  219. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem2/sub_dir/hpc_plugins/{test_plugin_type2/test_plugin_id4.rb → test_plugin_type_2/test_plugin_id_4.rb} +0 -0
  220. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/test.rb +1 -1
  221. data/spec/hybrid_platforms_conductor_test/platform_handler_plugins/{test2.rb → test_2.rb} +0 -0
  222. data/spec/hybrid_platforms_conductor_test/rubocop_spec.rb +31 -0
  223. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +3 -3
  224. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +3 -3
  225. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  226. data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +1 -0
  227. data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +952 -0
  228. data/spec/hybrid_platforms_conductor_test/test_connector.rb +3 -3
  229. data/spec/hybrid_platforms_conductor_test/test_log_no_read_plugin.rb +3 -1
  230. data/spec/hybrid_platforms_conductor_test/test_log_plugin.rb +3 -1
  231. data/spec/hybrid_platforms_conductor_test/test_plugins/global.rb +1 -0
  232. data/spec/hybrid_platforms_conductor_test/test_plugins/node.rb +1 -0
  233. data/spec/hybrid_platforms_conductor_test/test_plugins/node_check.rb +1 -0
  234. data/spec/hybrid_platforms_conductor_test/test_plugins/platform.rb +1 -0
  235. data/spec/hybrid_platforms_conductor_test/test_plugins/several_checks.rb +2 -2
  236. data/spec/hybrid_platforms_conductor_test/test_secrets_reader_plugin.rb +4 -4
  237. data/spec/hybrid_platforms_conductor_test/tests_report_plugin.rb +5 -6
  238. data/spec/spec_helper.rb +17 -18
  239. data/tools/check_md +16 -20
  240. data/tools/generate_mermaid +1 -1
  241. metadata +43 -13
  242. data/spec/hybrid_platforms_conductor_test/helpers/deployer_test_helpers.rb +0 -1152
@@ -2,9 +2,9 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
2
 
3
3
  describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
4
 
5
- context 'checking the reserve_proxmox_container sync tool' do
5
+ context 'when checking the reserve_proxmox_container sync tool' do
6
6
 
7
- context 'checking resources limits at the PVE node level' do
7
+ context 'when checking resources limits at the PVE node level' do
8
8
 
9
9
  it 'reserves a resource on an empty PVE node having enough resources' do
10
10
  with_sync_node do
@@ -86,12 +86,14 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
86
86
 
87
87
  it 'chooses among several PVE nodes the one having enough resources' do
88
88
  with_sync_node do
89
- mock_proxmox(mocked_pve_nodes: {
90
- 'pve_node_1' => { loadavg: [0.1, 11, 0.1] },
91
- 'pve_node_2' => { memory_total: 1126 * 1024 * 1024 },
92
- 'pve_node_3' => {},
93
- 'pve_node_4' => { storage_total: 512 * 1024 * 1024 }
94
- })
89
+ mock_proxmox(
90
+ mocked_pve_nodes: {
91
+ 'pve_node_1' => { loadavg: [0.1, 11, 0.1] },
92
+ 'pve_node_2' => { memory_total: 1126 * 1024 * 1024 },
93
+ 'pve_node_3' => {},
94
+ 'pve_node_4' => { storage_total: 512 * 1024 * 1024 }
95
+ }
96
+ )
95
97
  expect(call_reserve_proxmox_container(2, 1024, 4, config: { pve_nodes: %w[pve_node_1 pve_node_2 pve_node_3 pve_node_4] })).to eq(
96
98
  pve_node: 'pve_node_3',
97
99
  vm_id: 1000,
@@ -102,12 +104,14 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
102
104
 
103
105
  it 'chooses among several PVE nodes by discovering them instead of limiting them in the config' do
104
106
  with_sync_node do
105
- mock_proxmox(mocked_pve_nodes: {
106
- 'pve_node_1' => { loadavg: [0.1, 11, 0.1] },
107
- 'pve_node_2' => { memory_total: 1126 * 1024 * 1024 },
108
- 'pve_node_3' => {},
109
- 'pve_node_4' => { storage_total: 512 * 1024 * 1024 }
110
- })
107
+ mock_proxmox(
108
+ mocked_pve_nodes: {
109
+ 'pve_node_1' => { loadavg: [0.1, 11, 0.1] },
110
+ 'pve_node_2' => { memory_total: 1126 * 1024 * 1024 },
111
+ 'pve_node_3' => {},
112
+ 'pve_node_4' => { storage_total: 512 * 1024 * 1024 }
113
+ }
114
+ )
111
115
  expect(call_reserve_proxmox_container(2, 1024, 4, config: { pve_nodes: nil })).to eq(
112
116
  pve_node: 'pve_node_3',
113
117
  vm_id: 1000,
@@ -118,13 +122,15 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
118
122
 
119
123
  it 'chooses among several PVE nodes the one having the most free resources' do
120
124
  with_sync_node do
121
- mock_proxmox(mocked_pve_nodes: {
122
- 'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
123
- 'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
124
- 'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
125
- 'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
126
- 'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
127
- })
125
+ mock_proxmox(
126
+ mocked_pve_nodes: {
127
+ 'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
128
+ 'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
129
+ 'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
130
+ 'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
131
+ 'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
132
+ }
133
+ )
128
134
  expect(call_reserve_proxmox_container(2, 4096, 4, config: { pve_nodes: %w[pve_node_1gb pve_node_4.5gb pve_node_5gb pve_node_10gb pve_node_7gb] })).to eq(
129
135
  pve_node: 'pve_node_10gb',
130
136
  vm_id: 1000,
@@ -135,13 +141,15 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
135
141
 
136
142
  it 'chooses among several PVE nodes the one having the most free resources and that are part of the authorized PVE nodes' do
137
143
  with_sync_node do
138
- mock_proxmox(mocked_pve_nodes: {
139
- 'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
140
- 'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
141
- 'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
142
- 'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
143
- 'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
144
- })
144
+ mock_proxmox(
145
+ mocked_pve_nodes: {
146
+ 'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
147
+ 'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
148
+ 'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
149
+ 'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
150
+ 'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
151
+ }
152
+ )
145
153
  expect(call_reserve_proxmox_container(2, 4096, 4, config: { pve_nodes: %w[pve_node_1gb pve_node_5gb pve_node_7gb] })).to eq(
146
154
  pve_node: 'pve_node_7gb',
147
155
  vm_id: 1000,
@@ -152,13 +160,15 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
152
160
 
153
161
  it 'does not reserve a resource if the only PVE nodes having resources are not in the list of authorized PVE nodes' do
154
162
  with_sync_node do
155
- mock_proxmox(mocked_pve_nodes: {
156
- 'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
157
- 'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
158
- 'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
159
- 'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
160
- 'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
161
- })
163
+ mock_proxmox(
164
+ mocked_pve_nodes: {
165
+ 'pve_node_1gb' => { memory_total: 1 * 1024 * 1024 * 1024 },
166
+ 'pve_node_4.5gb' => { memory_total: 4608 * 1024 * 1024 },
167
+ 'pve_node_5gb' => { memory_total: 5 * 1024 * 1024 * 1024 },
168
+ 'pve_node_10gb' => { memory_total: 10 * 1024 * 1024 * 1024 },
169
+ 'pve_node_7gb' => { memory_total: 7 * 1024 * 1024 * 1024 }
170
+ }
171
+ )
162
172
  expect(call_reserve_proxmox_container(2, 4096, 4, config: { pve_nodes: %w[pve_node_1gb pve_node_4.5gb] })).to eq(error: 'not_enough_resources')
163
173
  end
164
174
  end
@@ -167,25 +177,32 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
167
177
  with_sync_node do
168
178
  # We ask to reserve 1GB of RAM and 1GB of disk.
169
179
  # Commented are the % of those resources' usage when having such a container in each PVE node, with the resulting score considering RAM 3 times as important than disk.
170
- mock_proxmox(mocked_pve_nodes: {
171
- # 100% RAM 25% disk => 325
172
- 'pve_node_1gb_4gb' => { memory_total: 1 * 1024 * 1024 * 1024, storage_total: 4 * 1024 * 1024 * 1024 },
173
- # 50% RAM 25% disk => 175
174
- 'pve_node_2gb_4gb' => { memory_total: 2 * 1024 * 1024 * 1024, storage_total: 4 * 1024 * 1024 * 1024 },
175
- # 50% RAM 50% disk => 200
176
- 'pve_node_2gb_2gb' => { memory_total: 2 * 1024 * 1024 * 1024, storage_total: 2 * 1024 * 1024 * 1024 },
177
- # 40% RAM 10% disk => 130
178
- 'pve_node_2.5gb_10gb' => { memory_total: 2560 * 1024 * 1024, storage_total: 10 * 1024 * 1024 * 1024 },
179
- # 25% RAM 50% disk => 125
180
- 'pve_node_4gb_2gb' => { memory_total: 4 * 1024 * 1024 * 1024, storage_total: 2 * 1024 * 1024 * 1024 },
181
- # 25% RAM 100% disk => 175
182
- 'pve_node_4gb_1gb' => { memory_total: 4 * 1024 * 1024 * 1024, storage_total: 1 * 1024 * 1024 * 1024 }
183
- })
184
- expect(call_reserve_proxmox_container(2, 1024, 1, config: {
185
- coeff_ram_consumption: 3,
186
- coeff_disk_consumption: 1,
187
- pve_nodes: nil
188
- })).to eq(
180
+ mock_proxmox(
181
+ mocked_pve_nodes: {
182
+ # 100% RAM 25% disk => 325
183
+ 'pve_node_1gb_4gb' => { memory_total: 1 * 1024 * 1024 * 1024, storage_total: 4 * 1024 * 1024 * 1024 },
184
+ # 50% RAM 25% disk => 175
185
+ 'pve_node_2gb_4gb' => { memory_total: 2 * 1024 * 1024 * 1024, storage_total: 4 * 1024 * 1024 * 1024 },
186
+ # 50% RAM 50% disk => 200
187
+ 'pve_node_2gb_2gb' => { memory_total: 2 * 1024 * 1024 * 1024, storage_total: 2 * 1024 * 1024 * 1024 },
188
+ # 40% RAM 10% disk => 130
189
+ 'pve_node_2.5gb_10gb' => { memory_total: 2560 * 1024 * 1024, storage_total: 10 * 1024 * 1024 * 1024 },
190
+ # 25% RAM 50% disk => 125
191
+ 'pve_node_4gb_2gb' => { memory_total: 4 * 1024 * 1024 * 1024, storage_total: 2 * 1024 * 1024 * 1024 },
192
+ # 25% RAM 100% disk => 175
193
+ 'pve_node_4gb_1gb' => { memory_total: 4 * 1024 * 1024 * 1024, storage_total: 1 * 1024 * 1024 * 1024 }
194
+ }
195
+ )
196
+ expect(
197
+ call_reserve_proxmox_container(
198
+ 2, 1024, 1,
199
+ config: {
200
+ coeff_ram_consumption: 3,
201
+ coeff_disk_consumption: 1,
202
+ pve_nodes: nil
203
+ }
204
+ )
205
+ ).to eq(
189
206
  pve_node: 'pve_node_4gb_2gb',
190
207
  vm_id: 1000,
191
208
  vm_ip: '192.168.0.100'
@@ -2,9 +2,9 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
2
 
3
3
  describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
4
 
5
- context 'checking the reserve_proxmox_container sync tool' do
5
+ context 'when checking the reserve_proxmox_container sync tool' do
6
6
 
7
- context 'checking retries mechanism' do
7
+ context 'when checking retries mechanism' do
8
8
 
9
9
  it 'retries a few times before ending in error' do
10
10
  with_sync_node do
@@ -16,11 +16,13 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
16
16
 
17
17
  it 'retries errors a few times until it gets resolved' do
18
18
  with_sync_node do
19
- mock_proxmox(mocked_pve_nodes: [
20
- { 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } },
21
- { 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } },
22
- { 'pve_node_name' => { loadavg: [0.1, 9, 0.1] } }
23
- ])
19
+ mock_proxmox(
20
+ mocked_pve_nodes: [
21
+ { 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } },
22
+ { 'pve_node_name' => { loadavg: [0.1, 11, 0.1] } },
23
+ { 'pve_node_name' => { loadavg: [0.1, 9, 0.1] } }
24
+ ]
25
+ )
24
26
  expect(call_reserve_proxmox_container(2, 1024, 4, max_retries: 5)).to eq(
25
27
  pve_node: 'pve_node_name',
26
28
  vm_id: 1000,
@@ -51,7 +53,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
51
53
  mock_proxmox(mocked_pve_nodes: [{ 'pve_node_name' => { error_strings: ['NOK: error code = 500'] * 5 } }])
52
54
  result = call_reserve_proxmox_container(2, 1024, 4, config: { api_max_retries: 4 })
53
55
  expect(result[:error]).not_to eq nil
54
- expect(result[:error]).to match /Unhandled exception from reserve_proxmox_container: Proxmox API get nodes\/pve_node_name\/lxc returns NOK: error code = 500 continuously \(tried 5 times\)/
56
+ expect(result[:error]).to match(%r{Unhandled exception from reserve_proxmox_container: Proxmox API get nodes/pve_node_name/lxc returns NOK: error code = 500 continuously \(tried 5 times\)})
55
57
  expect_proxmox_actions_to_be [
56
58
  [:create_ticket],
57
59
  [:create_ticket],
@@ -2,20 +2,22 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
2
 
3
3
  describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
4
 
5
- context 'checking the reserve_proxmox_container sync tool' do
5
+ context 'when checking the reserve_proxmox_container sync tool' do
6
6
 
7
- context 'checking how VM IDs are being assigned to containers' do
7
+ context 'when checking how VM IDs are being assigned to containers' do
8
8
 
9
9
  it 'makes sure to not use a VM ID already assigned to another container' do
10
10
  with_sync_node do
11
- mock_proxmox(mocked_pve_nodes: {
12
- 'pve_node_name' => {
13
- lxc_containers: {
14
- 1000 => { ip: '192.168.1.100' },
15
- 1001 => { ip: '192.168.1.101' }
11
+ mock_proxmox(
12
+ mocked_pve_nodes: {
13
+ 'pve_node_name' => {
14
+ lxc_containers: {
15
+ 1000 => { ip: '192.168.1.100' },
16
+ 1001 => { ip: '192.168.1.101' }
17
+ }
16
18
  }
17
19
  }
18
- })
20
+ )
19
21
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
20
22
  pve_node: 'pve_node_name',
21
23
  vm_id: 1002,
@@ -26,15 +28,17 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
26
28
 
27
29
  it 'makes sure to not use a VM ID already assigned to another container even on another PVE node' do
28
30
  with_sync_node do
29
- mock_proxmox(mocked_pve_nodes: {
30
- 'pve_node_name' => {},
31
- 'pve_other_node_name' => {
32
- lxc_containers: {
33
- 1000 => { ip: '192.168.1.100' },
34
- 1001 => { ip: '192.168.1.101' }
31
+ mock_proxmox(
32
+ mocked_pve_nodes: {
33
+ 'pve_node_name' => {},
34
+ 'pve_other_node_name' => {
35
+ lxc_containers: {
36
+ 1000 => { ip: '192.168.1.100' },
37
+ 1001 => { ip: '192.168.1.101' }
38
+ }
35
39
  }
36
40
  }
37
- })
41
+ )
38
42
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
39
43
  pve_node: 'pve_node_name',
40
44
  vm_id: 1002,
@@ -45,33 +49,39 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
45
49
 
46
50
  it 'does not reserve when no VM ID is available' do
47
51
  with_sync_node do
48
- mock_proxmox(mocked_pve_nodes: {
49
- 'pve_node_name' => {},
50
- 'pve_other_node_name' => {
51
- lxc_containers: {
52
- 1000 => { ip: '192.168.1.100' },
53
- 1001 => { ip: '192.168.1.101' },
54
- 1002 => { ip: '192.168.1.102' },
55
- 1003 => { ip: '192.168.1.103' }
52
+ mock_proxmox(
53
+ mocked_pve_nodes: {
54
+ 'pve_node_name' => {},
55
+ 'pve_other_node_name' => {
56
+ lxc_containers: {
57
+ 1000 => { ip: '192.168.1.100' },
58
+ 1001 => { ip: '192.168.1.101' },
59
+ 1002 => { ip: '192.168.1.102' },
60
+ 1003 => { ip: '192.168.1.103' }
61
+ }
56
62
  }
57
63
  }
58
- })
64
+ )
59
65
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1002] })).to eq(error: 'no_available_vm_id')
60
66
  end
61
67
  end
62
68
 
63
69
  it 'makes sure to remove cgroup files that are leftovers of removed containers' do
64
- with_sync_node(leftovers: [
65
- '/sys/fs/cgroup/memory/lxc/1003'
66
- ]) do
67
- mock_proxmox(mocked_pve_nodes: {
68
- 'pve_node_name' => {
69
- lxc_containers: {
70
- 1000 => { ip: '192.168.1.100' },
71
- 1001 => { ip: '192.168.1.101' }
70
+ with_sync_node(
71
+ leftovers: [
72
+ '/sys/fs/cgroup/memory/lxc/1003'
73
+ ]
74
+ ) do
75
+ mock_proxmox(
76
+ mocked_pve_nodes: {
77
+ 'pve_node_name' => {
78
+ lxc_containers: {
79
+ 1000 => { ip: '192.168.1.100' },
80
+ 1001 => { ip: '192.168.1.101' }
81
+ }
72
82
  }
73
83
  }
74
- })
84
+ )
75
85
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
76
86
  pve_node: 'pve_node_name',
77
87
  vm_id: 1002,
@@ -81,17 +91,21 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
81
91
  end
82
92
 
83
93
  it 'makes sure to remove cgroup files that are leftovers of removed containers even when they are reusing the VM ID' do
84
- with_sync_node(leftovers: [
85
- '/sys/fs/cgroup/memory/lxc/1002'
86
- ]) do
87
- mock_proxmox(mocked_pve_nodes: {
88
- 'pve_node_name' => {
89
- lxc_containers: {
90
- 1000 => { ip: '192.168.1.100' },
91
- 1001 => { ip: '192.168.1.101' }
94
+ with_sync_node(
95
+ leftovers: [
96
+ '/sys/fs/cgroup/memory/lxc/1002'
97
+ ]
98
+ ) do
99
+ mock_proxmox(
100
+ mocked_pve_nodes: {
101
+ 'pve_node_name' => {
102
+ lxc_containers: {
103
+ 1000 => { ip: '192.168.1.100' },
104
+ 1001 => { ip: '192.168.1.101' }
105
+ }
92
106
  }
93
107
  }
94
- })
108
+ )
95
109
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
96
110
  pve_node: 'pve_node_name',
97
111
  vm_id: 1002,
@@ -101,19 +115,23 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
101
115
  end
102
116
 
103
117
  it 'makes sure to remove cgroup files that are leftovers of removed containers when several cgroups contain files' do
104
- with_sync_node(leftovers: [
105
- '/sys/fs/cgroup/memory/lxc/1003',
106
- '/sys/fs/cgroup/network/lxc/1003',
107
- '/sys/fs/cgroup/cpu/lxc/1003'
108
- ]) do
109
- mock_proxmox(mocked_pve_nodes: {
110
- 'pve_node_name' => {
111
- lxc_containers: {
112
- 1000 => { ip: '192.168.1.100' },
113
- 1001 => { ip: '192.168.1.101' }
118
+ with_sync_node(
119
+ leftovers: [
120
+ '/sys/fs/cgroup/memory/lxc/1003',
121
+ '/sys/fs/cgroup/network/lxc/1003',
122
+ '/sys/fs/cgroup/cpu/lxc/1003'
123
+ ]
124
+ ) do
125
+ mock_proxmox(
126
+ mocked_pve_nodes: {
127
+ 'pve_node_name' => {
128
+ lxc_containers: {
129
+ 1000 => { ip: '192.168.1.100' },
130
+ 1001 => { ip: '192.168.1.101' }
131
+ }
114
132
  }
115
133
  }
116
- })
134
+ )
117
135
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
118
136
  pve_node: 'pve_node_name',
119
137
  vm_id: 1002,
@@ -135,15 +153,17 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
135
153
  '/sys/fs/cgroup/memory/lxc/1001'
136
154
  ]
137
155
  ) do
138
- mock_proxmox(mocked_pve_nodes: {
139
- 'pve_node_name' => {
140
- lxc_containers: {
141
- 100 => { ip: '192.168.1.10' },
142
- 1000 => { ip: '192.168.1.100' },
143
- 1001 => { ip: '192.168.1.101' }
156
+ mock_proxmox(
157
+ mocked_pve_nodes: {
158
+ 'pve_node_name' => {
159
+ lxc_containers: {
160
+ 100 => { ip: '192.168.1.10' },
161
+ 1000 => { ip: '192.168.1.100' },
162
+ 1001 => { ip: '192.168.1.101' }
163
+ }
144
164
  }
145
165
  }
146
- })
166
+ )
147
167
  expect(call_reserve_proxmox_container(2, 1024, 1, config: { vm_ids_range: [1000, 1100] })).to eq(
148
168
  pve_node: 'pve_node_name',
149
169
  vm_id: 1002,
@@ -2,7 +2,7 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
2
 
3
3
  describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
4
 
5
- context 'checking containers start' do
5
+ context 'when checking containers start' do
6
6
 
7
7
  it 'starts an instance' do
8
8
  with_test_proxmox_platform do |instance|
@@ -2,7 +2,7 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
2
 
3
3
  describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
4
 
5
- context 'checking containers state' do
5
+ context 'when checking containers state' do
6
6
 
7
7
  it 'gets the status of a missing instance' do
8
8
  with_test_proxmox_platform do |instance|
@@ -2,7 +2,7 @@ require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'
2
2
 
3
3
  describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
4
4
 
5
- context 'checking containers stop' do
5
+ context 'when checking containers stop' do
6
6
 
7
7
  it 'stops an instance' do
8
8
  with_test_proxmox_platform do |instance|
@@ -1,50 +1,51 @@
1
1
  describe HybridPlatformsConductor::Deployer do
2
2
 
3
- context 'checking secrets_reader plugins' do
3
+ context 'when checking secrets_reader plugins' do
4
4
 
5
- context 'cli' do
5
+ context 'with cli' do
6
6
 
7
7
  # Setup a platform for tests
8
8
  #
9
9
  # Parameters::
10
- # * Proc: Code called when the platform is setup
10
+ # * *block* (Proc): Code called when the platform is setup
11
11
  # * Parameters::
12
12
  # * *repository* (String): Platform's repository
13
- def with_test_platform_for_cli_test
13
+ def with_test_platform_for_cli_test(&block)
14
14
  with_test_platform(
15
- { nodes: { 'node' => { services: %w[service] } } },
16
- false,
17
- 'read_secrets_from :cli'
18
- ) do |repository|
19
- yield repository
20
- end
15
+ {
16
+ nodes: { 'node' => { services: %w[service] } },
17
+ deployable_services: %w[service]
18
+ },
19
+ additional_config: 'read_secrets_from :cli',
20
+ &block
21
+ )
21
22
  end
22
23
 
23
24
  it 'gets secrets from a file' do
24
25
  with_test_platform_for_cli_test do |repository|
25
26
  secrets_file = "#{repository}/my_secrets.json"
26
27
  File.write(secrets_file, '{ "secret_name": "secret_value" }')
27
- expect(test_services_handler).to receive(:deploy_allowed?).with(
28
+ expect(test_services_handler).to receive(:package).with(
28
29
  services: { 'node' => %w[service] },
29
30
  secrets: { 'secret_name' => 'secret_value' },
30
31
  local_environment: false
31
- ) { 'Abort as testing secrets is enough' }
32
- expect { run 'deploy', '--node', 'node', '--secrets', secrets_file }.to raise_error 'Deployment not allowed: Abort as testing secrets is enough'
32
+ ) { raise 'Abort as testing secrets is enough' }
33
+ expect { run 'deploy', '--node', 'node', '--secrets', secrets_file }.to raise_error 'Abort as testing secrets is enough'
33
34
  end
34
35
  end
35
36
 
36
37
  it 'gets secrets from several files' do
37
38
  with_test_platform_for_cli_test do |repository|
38
- secrets_file1 = "#{repository}/my_secrets1.json"
39
- File.write(secrets_file1, '{ "secret1": "value1" }')
40
- secrets_file2 = "#{repository}/my_secrets2.json"
41
- File.write(secrets_file2, '{ "secret2": "value2" }')
42
- expect(test_services_handler).to receive(:deploy_allowed?).with(
39
+ secrets_file_1 = "#{repository}/my_secrets1.json"
40
+ File.write(secrets_file_1, '{ "secret1": "value1" }')
41
+ secrets_file_2 = "#{repository}/my_secrets2.json"
42
+ File.write(secrets_file_2, '{ "secret2": "value2" }')
43
+ expect(test_services_handler).to receive(:package).with(
43
44
  services: { 'node' => %w[service] },
44
45
  secrets: { 'secret1' => 'value1', 'secret2' => 'value2' },
45
46
  local_environment: false
46
- ) { 'Abort as testing secrets is enough' }
47
- expect { run 'deploy', '--node', 'node', '--secrets', secrets_file1, '--secrets', secrets_file2 }.to raise_error 'Deployment not allowed: Abort as testing secrets is enough'
47
+ ) { raise 'Abort as testing secrets is enough' }
48
+ expect { run 'deploy', '--node', 'node', '--secrets', secrets_file_1, '--secrets', secrets_file_2 }.to raise_error 'Abort as testing secrets is enough'
48
49
  end
49
50
  end
50
51