hybrid_platforms_conductor 33.9.2 → 33.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/bin/last_deploys +3 -4
  4. data/docs/gen/mermaid/README.md-0.png +0 -0
  5. data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
  6. data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
  7. data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
  8. data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
  9. data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
  10. data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
  11. data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
  12. data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
  13. data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
  14. data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
  15. data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
  16. data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
  17. data/lib/hybrid_platforms_conductor/actions_executor.rb +2 -2
  18. data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +2 -2
  19. data/lib/hybrid_platforms_conductor/config.rb +1 -0
  20. data/lib/hybrid_platforms_conductor/deployer.rb +12 -12
  21. data/lib/hybrid_platforms_conductor/executable.rb +1 -1
  22. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +21 -7
  23. data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +2 -2
  24. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +1 -1
  25. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +1 -2
  26. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +6 -6
  27. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +2 -2
  28. data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +1 -1
  29. data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/keepass.rb +6 -6
  30. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +2 -2
  31. data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +2 -2
  32. data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
  33. data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +1 -1
  34. data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +1 -2
  35. data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +1 -2
  36. data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +1 -2
  37. data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +2 -2
  38. data/lib/hybrid_platforms_conductor/plugins.rb +4 -3
  39. data/lib/hybrid_platforms_conductor/tests_runner.rb +2 -2
  40. data/lib/hybrid_platforms_conductor/topographer.rb +5 -6
  41. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  42. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +1 -1
  43. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +8 -8
  44. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +3 -3
  45. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +8 -8
  46. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +1 -1
  47. data/spec/hybrid_platforms_conductor_test/api/actions_executor/helpers_spec.rb +4 -4
  48. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +1 -1
  49. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +4 -4
  50. data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +12 -12
  51. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +8 -8
  52. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +1 -1
  53. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +27 -27
  54. data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +1 -1
  55. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +25 -0
  56. data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +5 -5
  57. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +1 -1
  58. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +9 -9
  59. data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +1 -1
  60. data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +1 -1
  61. data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +30 -2
  62. data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +7 -7
  63. data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +18 -18
  64. data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +30 -30
  65. data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +5 -5
  66. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +6 -6
  67. data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +6 -6
  68. data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +4 -4
  69. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +8 -8
  70. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_2.rb +5 -5
  71. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
  72. data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others_2.rb +3 -3
  73. data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
  74. data/spec/hybrid_platforms_conductor_test/executables/check_node_spec.rb +1 -1
  75. data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +1 -1
  76. data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +1 -1
  77. data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +2 -2
  78. data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +1 -0
  79. data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +1 -1
  80. data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +1 -0
  81. data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +2 -2
  82. data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +1 -1
  83. data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
  84. data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +1 -1
  85. data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +7 -7
  86. data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +3 -3
  87. data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +11 -12
  88. data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +2 -2
  89. data/spec/hybrid_platforms_conductor_test/mocked_lib/my_test_gem_with_lib/sub1/lib/sub2/hpc_plugins/test_plugin_type_3/test_plugin_id_5.rb +34 -0
  90. data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +1 -1
  91. data/spec/hybrid_platforms_conductor_test/test_connector.rb +1 -1
  92. data/spec/hybrid_platforms_conductor_test.rb +1 -0
  93. metadata +152 -136
@@ -140,7 +140,7 @@ describe HybridPlatformsConductor::TestsRunner do
140
140
  register_test_plugins(test_tests_runner, several_tests: HybridPlatformsConductorTest::TestPlugins::SeveralChecks)
141
141
  # Mock the Actions Executor and Deployer expected calls
142
142
  expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
143
- expect(test_deployer.use_why_run).to eq true
143
+ expect(test_deployer.use_why_run).to be true
144
144
  {
145
145
  'node11' => [0, 'node11 check ok', 'node11 stderr'],
146
146
  'node12' => [0, 'node12 check ok', 'node12 stderr'],
@@ -153,7 +153,7 @@ describe HybridPlatformsConductor::TestsRunner do
153
153
  expect(actions.size).to eq node_suffixes.size
154
154
  node_suffixes.each do |node_suffix|
155
155
  node = "node#{node_suffix}"
156
- expect(actions.key?(node)).to eq true
156
+ expect(actions.key?(node)).to be true
157
157
  expect(actions[node].size).to eq 1
158
158
  expect(actions[node][:remote_bash]).to eq [
159
159
  'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
@@ -162,7 +162,7 @@ describe HybridPlatformsConductor::TestsRunner do
162
162
  'echo "$?"'
163
163
  ]
164
164
  end
165
- node_suffixes.map do |node_suffix|
165
+ node_suffixes.to_h do |node_suffix|
166
166
  [
167
167
  "node#{node_suffix}",
168
168
  [
@@ -178,7 +178,7 @@ describe HybridPlatformsConductor::TestsRunner do
178
178
  EO_STDERR
179
179
  ]
180
180
  ]
181
- end.to_h
181
+ end
182
182
  end])
183
183
  # Run everything
184
184
  test_tests_runner.tests = [:several_tests]
@@ -207,7 +207,7 @@ describe HybridPlatformsConductor::TestsRunner do
207
207
  with_test_platform({ tests: { specific_platform_handler_test: SpecificPlatformHandlerTest } }) do
208
208
  test_tests_runner.tests = [:specific_platform_handler_test]
209
209
  expect(test_tests_runner.run_tests([])).to eq 0
210
- expect(SpecificPlatformHandlerTest.run).to eq true
210
+ expect(SpecificPlatformHandlerTest.run).to be true
211
211
  end
212
212
  end
213
213
 
@@ -26,7 +26,7 @@ describe HybridPlatformsConductor::TestsRunner do
26
26
  with_test_platform_for_node_check_tests do
27
27
  test_tests_runner.tests = [:node_check_test]
28
28
  expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
29
- expect(test_deployer.use_why_run).to eq true
29
+ expect(test_deployer.use_why_run).to be true
30
30
  {
31
31
  'node11' => [0, 'node11 check ok', 'node11 stderr'],
32
32
  'node12' => [0, 'node12 check ok', 'node12 stderr'],
@@ -48,7 +48,7 @@ describe HybridPlatformsConductor::TestsRunner do
48
48
  with_test_platform_for_node_check_tests do
49
49
  test_tests_runner.tests = [:node_check_test]
50
50
  expect(test_deployer).to receive(:deploy_on).with(%w[node12 node22]).once do
51
- expect(test_deployer.use_why_run).to eq true
51
+ expect(test_deployer.use_why_run).to be true
52
52
  {
53
53
  'node12' => [0, 'node12 check ok', 'node12 stderr'],
54
54
  'node22' => [0, 'node22 check ok', 'node22 stderr']
@@ -66,7 +66,7 @@ describe HybridPlatformsConductor::TestsRunner do
66
66
  with_test_platform_for_node_check_tests do
67
67
  test_tests_runner.tests = %i[node_check_test node_check_test_2]
68
68
  expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
69
- expect(test_deployer.use_why_run).to eq true
69
+ expect(test_deployer.use_why_run).to be true
70
70
  {
71
71
  'node11' => [0, 'node11 check ok', 'node11 stderr'],
72
72
  'node12' => [0, 'node12 check ok', 'node12 stderr'],
@@ -92,7 +92,7 @@ describe HybridPlatformsConductor::TestsRunner do
92
92
  with_test_platform_for_node_check_tests do
93
93
  test_tests_runner.tests = [:node_check_test]
94
94
  expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
95
- expect(test_deployer.use_why_run).to eq true
95
+ expect(test_deployer.use_why_run).to be true
96
96
  {
97
97
  'node11' => [0, 'node11 check ok', 'node11 stderr'],
98
98
  'node12' => [1, 'node12 check ok', 'node12 stderr'],
@@ -114,7 +114,7 @@ describe HybridPlatformsConductor::TestsRunner do
114
114
  with_test_platform_for_node_check_tests do
115
115
  test_tests_runner.tests = [:node_check_test]
116
116
  expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
117
- expect(test_deployer.use_why_run).to eq true
117
+ expect(test_deployer.use_why_run).to be true
118
118
  {
119
119
  'node11' => [0, 'node11 check ok', 'node11 stderr'],
120
120
  'node12' => [1, 'node12 check ok', 'node12 stderr'],
@@ -178,7 +178,7 @@ describe HybridPlatformsConductor::TestsRunner do
178
178
  HybridPlatformsConductorTest::TestPlugins::NodeCheck.only_on_nodes = %w[node12 node22]
179
179
  test_tests_runner.tests = [:node_check_test]
180
180
  expect(test_deployer).to receive(:deploy_on).with(%w[node12 node22]).once do
181
- expect(test_deployer.use_why_run).to eq true
181
+ expect(test_deployer.use_why_run).to be true
182
182
  {
183
183
  'node12' => [0, 'node12 check ok', 'node12 stderr'],
184
184
  'node22' => [0, 'node22 check ok', 'node22 stderr']
@@ -34,7 +34,7 @@ describe HybridPlatformsConductor::TestsRunner do
34
34
  expect(actions.size).to eq node_suffixes.size
35
35
  node_suffixes.each do |node_suffix|
36
36
  node = "node#{node_suffix}"
37
- expect(actions.key?(node)).to eq true
37
+ expect(actions.key?(node)).to be true
38
38
  expect(actions[node].size).to eq 1
39
39
  expect(actions[node][:remote_bash]).to eq [
40
40
  'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
@@ -43,7 +43,7 @@ describe HybridPlatformsConductor::TestsRunner do
43
43
  'echo "$?"'
44
44
  ]
45
45
  end
46
- node_suffixes.map do |node_suffix|
46
+ node_suffixes.to_h do |node_suffix|
47
47
  [
48
48
  "node#{node_suffix}",
49
49
  [
@@ -59,7 +59,7 @@ describe HybridPlatformsConductor::TestsRunner do
59
59
  EO_STDERR
60
60
  ]
61
61
  ]
62
- end.to_h
62
+ end
63
63
  end
64
64
 
65
65
  it 'executes SSH node tests once per node with the correct command' do
@@ -120,7 +120,7 @@ describe HybridPlatformsConductor::TestsRunner do
120
120
  expect(actions.size).to eq node_suffixes.size
121
121
  node_suffixes.each do |node_suffix|
122
122
  node = "node#{node_suffix}"
123
- expect(actions.key?(node)).to eq true
123
+ expect(actions.key?(node)).to be true
124
124
  expect(actions[node].size).to eq 1
125
125
  expect(actions[node][:remote_bash]).to eq [
126
126
  'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
@@ -133,7 +133,7 @@ describe HybridPlatformsConductor::TestsRunner do
133
133
  'echo "$?"'
134
134
  ]
135
135
  end
136
- node_suffixes.map do |node_suffix|
136
+ node_suffixes.to_h do |node_suffix|
137
137
  [
138
138
  "node#{node_suffix}",
139
139
  [
@@ -154,7 +154,7 @@ describe HybridPlatformsConductor::TestsRunner do
154
154
  EO_STDERR
155
155
  ]
156
156
  ]
157
- end.to_h
157
+ end
158
158
  end])
159
159
  test_tests_runner.tests = %i[node_ssh_test node_ssh_test_2]
160
160
  ssh_executions = []
@@ -208,7 +208,7 @@ describe HybridPlatformsConductor::TestsRunner do
208
208
  with_test_platforms_for_reports_test do
209
209
  # Mock the Actions Executor and Deployer expected calls
210
210
  expect(test_deployer).to receive(:deploy_on).with(%w[node11 node12 node21 node22]).once do
211
- expect(test_deployer.use_why_run).to eq true
211
+ expect(test_deployer.use_why_run).to be true
212
212
  {
213
213
  'node11' => [0, 'node11 check ok', 'node11 stderr'],
214
214
  'node12' => [0, 'node12 check ok', 'node12 stderr'],
@@ -221,7 +221,7 @@ describe HybridPlatformsConductor::TestsRunner do
221
221
  expect(actions.size).to eq node_suffixes.size
222
222
  node_suffixes.each do |node_suffix|
223
223
  node = "node#{node_suffix}"
224
- expect(actions.key?(node)).to eq true
224
+ expect(actions.key?(node)).to be true
225
225
  expect(actions[node].size).to eq 1
226
226
  expect(actions[node][:remote_bash]).to eq [
227
227
  'echo \'===== TEST COMMAND EXECUTION ===== Separator generated by Hybrid Platforms Conductor test framework =====\'',
@@ -230,7 +230,7 @@ describe HybridPlatformsConductor::TestsRunner do
230
230
  'echo "$?"'
231
231
  ]
232
232
  end
233
- node_suffixes.map do |node_suffix|
233
+ node_suffixes.to_h do |node_suffix|
234
234
  [
235
235
  "node#{node_suffix}",
236
236
  [
@@ -246,7 +246,7 @@ describe HybridPlatformsConductor::TestsRunner do
246
246
  EO_STDERR
247
247
  ]
248
248
  ]
249
- end.to_h
249
+ end
250
250
  end])
251
251
  # Run everything
252
252
  test_tests_runner.tests = [:several_tests]
@@ -40,7 +40,7 @@ module HybridPlatformsConductorTest
40
40
  # Nodes for which the property can't be fetched can be ommitted.
41
41
  def get_upcase(nodes, metadata)
42
42
  record_call(:get_upcase, nodes, metadata)
43
- nodes.map { |node| [node, node.upcase] }.to_h
43
+ nodes.to_h { |node| [node, node.upcase] }
44
44
  end
45
45
 
46
46
  # Get a specific property for a given set of nodes.
@@ -55,7 +55,7 @@ module HybridPlatformsConductorTest
55
55
  # Nodes for which the property can't be fetched can be ommitted.
56
56
  def get_double(nodes, metadata)
57
57
  record_call(:get_double, nodes, metadata)
58
- nodes.map { |node| [node, node * 2] }.to_h
58
+ nodes.to_h { |node| [node, node * 2] }
59
59
  end
60
60
 
61
61
  # Get a specific property for a given set of nodes.
@@ -70,7 +70,7 @@ module HybridPlatformsConductorTest
70
70
  # Nodes for which the property can't be fetched can be ommitted.
71
71
  def get_reversed_double(nodes, metadata)
72
72
  record_call(:get_reversed_double, nodes, metadata)
73
- nodes.map { |node| [node, metadata[node][:double].reverse] }.to_h
73
+ nodes.to_h { |node| [node, metadata[node][:double].reverse] }
74
74
  end
75
75
 
76
76
  # Get a specific property for a given set of nodes.
@@ -85,7 +85,7 @@ module HybridPlatformsConductorTest
85
85
  # Nodes for which the property can't be fetched can be ommitted.
86
86
  def get_reversed_downcase(nodes, metadata)
87
87
  record_call(:get_reversed_downcase, nodes, metadata)
88
- nodes.map { |node| [node, metadata[node][:downcase] ? metadata[node][:downcase].reverse : 'UNKNOWN'] }.to_h
88
+ nodes.to_h { |node| [node, metadata[node][:downcase] ? metadata[node][:downcase].reverse : 'UNKNOWN'] }
89
89
  end
90
90
 
91
91
  # Get a specific property for a given set of nodes.
@@ -115,7 +115,7 @@ module HybridPlatformsConductorTest
115
115
  # Nodes for which the property can't be fetched can be ommitted.
116
116
  def get_same_comment(nodes, metadata)
117
117
  record_call(:get_same_comment, nodes, metadata)
118
- nodes.map { |node| [node, "Comment for #{node}"] }.to_h
118
+ nodes.to_h { |node| [node, "Comment for #{node}"] }
119
119
  end
120
120
 
121
121
  # Get a specific property for a given set of nodes.
@@ -130,7 +130,7 @@ module HybridPlatformsConductorTest
130
130
  # Nodes for which the property can't be fetched can be ommitted.
131
131
  def get_different_comment(nodes, metadata)
132
132
  record_call(:get_different_comment, nodes, metadata)
133
- nodes.map { |node| [node, 'Comment from test_cmdb'] }.to_h
133
+ nodes.to_h { |node| [node, 'Comment from test_cmdb'] }
134
134
  end
135
135
 
136
136
  # Get a specific property for a given set of nodes.
@@ -145,7 +145,7 @@ module HybridPlatformsConductorTest
145
145
  # Nodes for which the property can't be fetched can be ommitted.
146
146
  def get_different_comment_2(nodes, metadata)
147
147
  record_call(:get_different_comment_2, nodes, metadata)
148
- nodes.map { |node| [node, 'Comment2 from test_cmdb'] }.to_h
148
+ nodes.to_h { |node| [node, 'Comment2 from test_cmdb'] }
149
149
  end
150
150
 
151
151
  # Register a call to be checked by the tests later
@@ -156,7 +156,7 @@ module HybridPlatformsConductorTest
156
156
  def record_call(method, *args)
157
157
  @calls = [] unless defined?(@calls)
158
158
  # Create a shallow copy of the args, just to make sure they won't get changed by later code
159
- @calls << [method] + Marshal.load(Marshal.dump(args))
159
+ @calls << ([method] + Marshal.load(Marshal.dump(args)))
160
160
  end
161
161
 
162
162
  end
@@ -27,7 +27,7 @@ module HybridPlatformsConductorTest
27
27
  def get_nothing(nodes, metadata)
28
28
  record_call(:get_nothing, nodes, metadata)
29
29
  # Here we return something to test that if the first one fails we have the second CMDB
30
- nodes.map { |node| [node, "#{node} has nothing"] }.to_h
30
+ nodes.to_h { |node| [node, "#{node} has nothing"] }
31
31
  end
32
32
 
33
33
  # Get a specific property for a given set of nodes.
@@ -42,7 +42,7 @@ module HybridPlatformsConductorTest
42
42
  # Nodes for which the property can't be fetched can be ommitted.
43
43
  def get_same_comment(nodes, metadata)
44
44
  record_call(:get_same_comment, nodes, metadata)
45
- nodes.map { |node| [node, "Comment for #{node}"] }.to_h
45
+ nodes.to_h { |node| [node, "Comment for #{node}"] }
46
46
  end
47
47
 
48
48
  # Get a specific property for a given set of nodes.
@@ -57,7 +57,7 @@ module HybridPlatformsConductorTest
57
57
  # Nodes for which the property can't be fetched can be ommitted.
58
58
  def get_different_comment(nodes, metadata)
59
59
  record_call(:get_different_comment, nodes, metadata)
60
- nodes.map { |node| [node, 'Comment from test_cmdb_2'] }.to_h
60
+ nodes.to_h { |node| [node, 'Comment from test_cmdb_2'] }
61
61
  end
62
62
 
63
63
  # Get a specific property for a given set of nodes.
@@ -72,7 +72,7 @@ module HybridPlatformsConductorTest
72
72
  # Nodes for which the property can't be fetched can be ommitted.
73
73
  def get_different_comment_2(nodes, metadata)
74
74
  record_call(:get_different_comment_2, nodes, metadata)
75
- nodes.map { |node| [node, 'Comment2 from test_cmdb_2'] }.to_h
75
+ nodes.to_h { |node| [node, 'Comment2 from test_cmdb_2'] }
76
76
  end
77
77
 
78
78
  # Register a call to be checked by the tests later
@@ -83,7 +83,7 @@ module HybridPlatformsConductorTest
83
83
  def record_call(method, *args)
84
84
  @calls = [] unless defined?(@calls)
85
85
  # Create a shallow copy of the args, just to make sure they won't get changed by later code
86
- @calls << [method] + Marshal.load(Marshal.dump(args))
86
+ @calls << ([method] + Marshal.load(Marshal.dump(args)))
87
87
  end
88
88
 
89
89
  end
@@ -30,7 +30,7 @@ module HybridPlatformsConductorTest
30
30
  # Nodes for which the property can't be fetched can be ommitted.
31
31
  def get_others(nodes, metadata)
32
32
  record_call(:get_others, nodes, metadata)
33
- nodes.map do |node|
33
+ nodes.to_h do |node|
34
34
  [
35
35
  node,
36
36
  {
@@ -39,7 +39,7 @@ module HybridPlatformsConductorTest
39
39
  nothing: "#{node} has another nothing"
40
40
  }
41
41
  ]
42
- end.to_h
42
+ end
43
43
  end
44
44
 
45
45
  # Register a call to be checked by the tests later
@@ -50,7 +50,7 @@ module HybridPlatformsConductorTest
50
50
  def record_call(method, *args)
51
51
  @calls = [] unless defined?(@calls)
52
52
  # Create a shallow copy of the args, just to make sure they won't get changed by later code
53
- @calls << [method] + Marshal.load(Marshal.dump(args))
53
+ @calls << ([method] + Marshal.load(Marshal.dump(args)))
54
54
  end
55
55
 
56
56
  end
@@ -30,14 +30,14 @@ module HybridPlatformsConductorTest
30
30
  # Nodes for which the property can't be fetched can be ommitted.
31
31
  def get_others(nodes, metadata)
32
32
  record_call(:get_others, nodes, metadata)
33
- nodes.map do |node|
33
+ nodes.to_h do |node|
34
34
  [
35
35
  node,
36
36
  {
37
37
  downcase: "__#{node}__"
38
38
  }
39
39
  ]
40
- end.to_h
40
+ end
41
41
  end
42
42
 
43
43
  # Register a call to be checked by the tests later
@@ -48,7 +48,7 @@ module HybridPlatformsConductorTest
48
48
  def record_call(method, *args)
49
49
  @calls = [] unless defined?(@calls)
50
50
  # Create a shallow copy of the args, just to make sure they won't get changed by later code
51
- @calls << [method] + Marshal.load(Marshal.dump(args))
51
+ @calls << ([method] + Marshal.load(Marshal.dump(args)))
52
52
  end
53
53
 
54
54
  end
@@ -3,7 +3,7 @@ describe 'Documentation' do
3
3
  it 'makes sure all Markdown links are valid' do
4
4
  check_stdout = `bundle exec tools/check_md README.md #{Dir.glob('docs/**/*.md').join(' ')}`.split("\n")
5
5
  summary_idx = check_stdout.index { |line| line =~ /^\d+ errors:$/ }
6
- expect(summary_idx).not_to eq(nil), "Could not parse check output: #{check_stdout.join("\n")}"
6
+ expect(summary_idx).not_to be_nil, "Could not parse check output: #{check_stdout.join("\n")}"
7
7
  expect(check_stdout[summary_idx]).to eq('0 errors:'), "Invalid links found: #{check_stdout[summary_idx..].join("\n")}"
8
8
  end
9
9
 
@@ -13,7 +13,7 @@ describe 'check-node executable' do
13
13
  it 'checks a given node' do
14
14
  with_test_platform_for_check_node do
15
15
  expect(test_deployer).to receive(:deploy_on).with('node') do
16
- expect(test_deployer.use_why_run).to eq true
16
+ expect(test_deployer.use_why_run).to be true
17
17
  test_deployer.stdout_device << "Check ok\n"
18
18
  { 'node' => [0, "Check ok\n", ''] }
19
19
  end
@@ -13,7 +13,7 @@ describe 'deploy executable' do
13
13
  it 'deploys a given node' do
14
14
  with_test_platform_for_deploy do
15
15
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
16
- expect(test_deployer.use_why_run).to eq false
16
+ expect(test_deployer.use_why_run).to be false
17
17
  test_deployer.stdout_device << "Deploy ok\n"
18
18
  { 'node' => [0, "Deploy ok\n", ''] }
19
19
  end
@@ -13,7 +13,7 @@ describe 'executables\' Cmd Runner options' do
13
13
  it 'displays commands instead of running them' do
14
14
  with_test_platform_for_cmd_runner_options do
15
15
  expect_actions_executor_runs([proc do
16
- expect(test_cmd_runner.dry_run).to eq true
16
+ expect(test_cmd_runner.dry_run).to be true
17
17
  {}
18
18
  end])
19
19
  exit_code, stdout, stderr = run 'run', '--node', 'node', '--command', 'echo Hello', '--show-commands'
@@ -13,7 +13,7 @@ describe 'executables\' Deployer options' do
13
13
  it 'uses parallel mode' do
14
14
  with_test_platform_for_deployer_options do
15
15
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
16
- expect(test_deployer.concurrent_execution).to eq true
16
+ expect(test_deployer.concurrent_execution).to be true
17
17
  {}
18
18
  end
19
19
  exit_code, _stdout, stderr = run 'deploy', '--node', 'node', '--parallel'
@@ -25,7 +25,7 @@ describe 'executables\' Deployer options' do
25
25
  it 'uses why-run' do
26
26
  with_test_platform_for_deployer_options do
27
27
  expect(test_deployer).to receive(:deploy_on).with(['node']) do
28
- expect(test_deployer.use_why_run).to eq true
28
+ expect(test_deployer.use_why_run).to be true
29
29
  {}
30
30
  end
31
31
  exit_code, _stdout, stderr = run 'deploy', '--node', 'node', '--why-run'
@@ -63,6 +63,7 @@ describe 'executables\' Nodes Handler options' do
63
63
  it 'displays info about nodes' do
64
64
  with_test_platform_for_nodes_handler_options do
65
65
  with_cmd_runner_mocked [
66
+ ['command -v getent', proc { [0, '', ''] }],
66
67
  ['getent hosts my_host15.my_domain', proc { [0, '192.168.42.15 my_host16.my_domain', ''] }],
67
68
  ['getent hosts my_host16.my_domain', proc { [0, '192.168.42.16 my_host16.my_domain', ''] }]
68
69
  ] do
@@ -61,7 +61,7 @@ describe 'executables\' Tests Runner options' do
61
61
  it 'uses current run_logs instead of executing new check-nodes' do
62
62
  with_test_platform({}) do
63
63
  expect(test_tests_runner).to receive(:run_tests).with([]) do
64
- expect(test_tests_runner.skip_run).to eq true
64
+ expect(test_tests_runner.skip_run).to be true
65
65
  0
66
66
  end
67
67
  exit_code, stdout, stderr = run 'test', '--test', 'my_test', '--skip-run'
@@ -47,6 +47,7 @@ describe 'report executable' do
47
47
  }
48
48
  ) do
49
49
  with_cmd_runner_mocked [
50
+ ['command -v getent', proc { [0, '', ''] }],
50
51
  ['getent hosts node.domain.com', proc { [0, '192.168.0.1 node.domain.com', ''] }]
51
52
  ] do
52
53
  exit_code, stdout, stderr = run 'report', '--node', 'node'
@@ -73,7 +73,7 @@ describe 'run executable' do
73
73
  it 'executes a single command on several nodes' do
74
74
  with_test_platform_for_run do
75
75
  expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
76
- expect(concurrent).to eq false
76
+ expect(concurrent).to be false
77
77
  expect(actions).to eq(%w[node1 node2] => [{ remote_bash: ['echo Hello'] }])
78
78
  test_actions_executor.stdout_device << "Hello\nHello\n"
79
79
  { 'node1' => [0, "Hello\nHello\n", ''] }
@@ -133,7 +133,7 @@ describe 'run executable' do
133
133
  it 'executes in parallel' do
134
134
  with_test_platform_for_run do
135
135
  expect_actions_executor_runs([proc do |actions, timeout: nil, concurrent: false, log_to_dir: 'run_logs', log_to_stdout: true|
136
- expect(concurrent).to eq true
136
+ expect(concurrent).to be true
137
137
  expect(actions).to eq(%w[node1 node2] => [{ remote_bash: ['echo Hello'] }])
138
138
  test_actions_executor.stdout_device << "Hello\nHello\n"
139
139
  { 'node1' => [0, "Hello\nHello\n", ''] }
@@ -58,7 +58,7 @@ module HybridPlatformsConductorTest
58
58
  def with_connections_mocked_on(expected_nodes)
59
59
  expect(test_actions_executor).to receive(:with_connections_prepared_to) do |nodes, no_exception: false, &client_code|
60
60
  expect(nodes.sort).to eq expected_nodes.sort
61
- client_code.call nodes.map { |node| [node, test_actions_executor.connector(:test_connector)] }.to_h
61
+ client_code.call(nodes.to_h { |node| [node, test_actions_executor.connector(:test_connector)] })
62
62
  end
63
63
  yield
64
64
  end
@@ -21,12 +21,12 @@ module HybridPlatformsConductorTest
21
21
  def register_test_cmdb(cmdb_names = [:test_cmdb])
22
22
  register_plugins(
23
23
  :cmdb,
24
- cmdb_names.map do |plugin_id|
24
+ cmdb_names.to_h do |plugin_id|
25
25
  [
26
26
  plugin_id,
27
27
  HybridPlatformsConductorTest::CmdbPlugins.const_get(plugin_id.to_s.split('_').collect(&:capitalize).join.to_sym)
28
28
  ]
29
- end.to_h
29
+ end
30
30
  )
31
31
  end
32
32
 
@@ -105,7 +105,7 @@ module HybridPlatformsConductorTest
105
105
  { optional: with_control_master_destroy_optional }
106
106
  ]
107
107
  end
108
- ssh_commands_once + ssh_commands_per_connection * node_connection_info[:times]
108
+ ssh_commands_once + (ssh_commands_per_connection * node_connection_info[:times])
109
109
  end.flatten(1)
110
110
  end
111
111
 
@@ -40,10 +40,10 @@ module HybridPlatformsConductorTest
40
40
  # * Hash<String, [Integer or Symbol, String, String] >: Expected result of those expected actions
41
41
  def expect_actions_to_deploy_on(actions, nodes, check: false, sudo: 'sudo -u root', expected_actions: [], mocked_result: nil)
42
42
  nodes = [nodes] if nodes.is_a?(String)
43
- mocked_result = nodes.map { |node| [node, [0, "#{check ? 'Check' : 'Deploy'} successful", '']] }.to_h if mocked_result.nil?
43
+ mocked_result = nodes.to_h { |node| [node, [0, "#{check ? 'Check' : 'Deploy'} successful", '']] } if mocked_result.nil?
44
44
  expect(actions.size).to eq nodes.size
45
45
  nodes.each do |node|
46
- expect(actions.key?(node)).to eq true
46
+ expect(actions.key?(node)).to be true
47
47
  expect(actions[node].size).to eq(2 + expected_actions.size)
48
48
  expect_action_to_lock_node(actions[node][0], node, sudo: sudo)
49
49
  expect(actions[node][1..-2]).to eq expected_actions
@@ -62,10 +62,10 @@ module HybridPlatformsConductorTest
62
62
  nodes = [nodes] if nodes.is_a?(String)
63
63
  expect(actions.size).to eq nodes.size
64
64
  nodes.each do |node|
65
- expect(actions.key?(node)).to eq true
65
+ expect(actions.key?(node)).to be true
66
66
  expect_action_to_unlock_node(actions[node], node, sudo: sudo)
67
67
  end
68
- nodes.map { |node| [node, [0, 'Release mutex successful', '']] }.to_h
68
+ nodes.to_h { |node| [node, [0, 'Release mutex successful', '']] }
69
69
  end
70
70
 
71
71
  # Expect a given set of actions to upload log files on a list of nodes (using the test_log log plugin)
@@ -77,10 +77,10 @@ module HybridPlatformsConductorTest
77
77
  nodes = [nodes] if nodes.is_a?(String)
78
78
  expect(actions.size).to eq nodes.size
79
79
  nodes.each do |node|
80
- expect(actions.key?(node)).to eq true
80
+ expect(actions.key?(node)).to be true
81
81
  expect(actions[node]).to eq [{ bash: "echo Save test logs to #{node}" }]
82
82
  end
83
- nodes.map { |node| [node, [0, 'Logs uploaded', '']] }.to_h
83
+ nodes.to_h { |node| [node, [0, 'Logs uploaded', '']] }
84
84
  end
85
85
 
86
86
  # Get a test Deployer
@@ -325,7 +325,7 @@ module HybridPlatformsConductorTest
325
325
  expect_actions_executor_runs(statuses.map do |status|
326
326
  status = { 'node' => status } if status.is_a?(Array)
327
327
  expected_actions_for_deploy_on(
328
- services: status.keys.map { |node| [node, %w[service]] }.to_h,
328
+ services: status.keys.to_h { |node| [node, %w[service]] },
329
329
  mocked_deploy_result: status
330
330
  )
331
331
  end.flatten)
@@ -14,7 +14,7 @@ module HybridPlatformsConductorTest
14
14
  # * Parameters::
15
15
  # * *repositories* (Hash<String,String>): Path to the repositories, per repository name
16
16
  def with_repositories(names = [], as_git: false)
17
- repositories = names.map { |name| [name, "#{Dir.tmpdir}/hpc_test/#{name}"] }.to_h
17
+ repositories = names.to_h { |name| [name, "#{Dir.tmpdir}/hpc_test/#{name}"] }
18
18
  repositories.each_value do |dir|
19
19
  FileUtils.rm_rf dir
20
20
  FileUtils.mkdir_p dir
@@ -91,12 +91,12 @@ module HybridPlatformsConductorTest
91
91
  "#{platform_type}_platform path: '#{dir}'#{platforms_info[platform].key?(:name) ? ", name: '#{platforms_info[platform][:name]}'" : ''}"
92
92
  end.join("\n") + "\n#{additional_config}"
93
93
  ) do
94
- register_platform_handlers(platform_types.map do |platform_type|
94
+ register_platform_handlers(platform_types.to_h do |platform_type|
95
95
  [
96
96
  platform_type,
97
97
  HybridPlatformsConductorTest::PlatformHandlerPlugins.const_get(platform_type.to_s.split('_').collect(&:capitalize).join.to_sym)
98
98
  ]
99
- end.to_h)
99
+ end)
100
100
  self.test_platforms_info = platforms_info
101
101
  yield repositories
102
102
  end