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
@@ -17,6 +17,7 @@ describe HybridPlatformsConductor::NodesHandler do
17
17
  it 'returns a host IP when hostname is set' do
18
18
  with_test_platform({ nodes: { 'test_node' => {} } }) do
19
19
  with_cmd_runner_mocked [
20
+ ['command -v getent', proc { [0, '', ''] }],
20
21
  ['getent hosts my_domain.my_host', proc { [0, '192.168.42.42 my_domain.my_host', ''] }]
21
22
  ] do
22
23
  expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { hostname: 'my_domain.my_host' } })).to eq('test_node' => '192.168.42.42')
@@ -24,9 +25,21 @@ describe HybridPlatformsConductor::NodesHandler do
24
25
  end
25
26
  end
26
27
 
28
+ it 'returns a host IP when hostname is set without getenv' do
29
+ with_test_platform({ nodes: { 'test_node' => {} } }) do
30
+ with_cmd_runner_mocked [
31
+ ['command -v getent', proc { [1, '', ''] }],
32
+ ['host my_domain.my_host | grep \'has address\'', proc { [0, 'my_domain.my_host has address 192.168.42.42', ''] }]
33
+ ] do
34
+ expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { hostname: 'my_domain.my_host' } })).to eq('test_node' => '192.168.42.42')
35
+ end
36
+ end
37
+ end
38
+
27
39
  it 'does not return a host IP when getent can\'t retrieve it' do
28
40
  with_test_platform({ nodes: { 'test_node' => {} } }) do
29
41
  with_cmd_runner_mocked [
42
+ ['command -v getent', proc { [0, '', ''] }],
30
43
  ['getent hosts my_domain.my_host', proc { [0, '', ''] }]
31
44
  ] do
32
45
  expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { hostname: 'my_domain.my_host' } })).to eq({})
@@ -34,6 +47,17 @@ describe HybridPlatformsConductor::NodesHandler do
34
47
  end
35
48
  end
36
49
 
50
+ it 'does not return a host IP when getent can\'t retrieve it without getenv' do
51
+ with_test_platform({ nodes: { 'test_node' => {} } }) do
52
+ with_cmd_runner_mocked [
53
+ ['command -v getent', proc { [1, '', ''] }],
54
+ ['host my_domain.my_host | grep \'has address\'', proc { [1, '', ''] }]
55
+ ] do
56
+ expect(cmdb(:host_ip).get_host_ip(['test_node'], { 'test_node' => { hostname: 'my_domain.my_host' } })).to eq({})
57
+ end
58
+ end
59
+ end
60
+
37
61
  it 'returns a host IPs for the maximum hosts it can from the list' do
38
62
  with_test_platform(
39
63
  {
@@ -46,6 +70,7 @@ describe HybridPlatformsConductor::NodesHandler do
46
70
  }
47
71
  ) do
48
72
  with_cmd_runner_mocked [
73
+ ['command -v getent', proc { [0, '', ''] }],
49
74
  ['getent hosts my_domain.my_host1', proc { [0, '192.168.42.1 my_domain.my_host1', ''] }],
50
75
  ['getent hosts my_domain.my_host2', proc { [0, '', ''] }],
51
76
  ['getent hosts my_domain.my_host4', proc { [0, '192.168.42.4 my_domain.my_host4', ''] }]
@@ -56,7 +56,7 @@ describe HybridPlatformsConductor::NodesHandler do
56
56
 
57
57
  it 'returns nodes metadata using dynamic method even on non-existant properties' do
58
58
  with_cmdb_test_platform do
59
- expect(test_nodes_handler.get_downcase_of('node1')).to eq nil
59
+ expect(test_nodes_handler.get_downcase_of('node1')).to be_nil
60
60
  end
61
61
  end
62
62
 
@@ -245,7 +245,7 @@ describe HybridPlatformsConductor::NodesHandler do
245
245
  additional_config: 'master_cmdbs(test_cmdb_2: :different_comment)'
246
246
  ) do
247
247
  expect(test_nodes_handler.get_different_comment_of('node1')).to eq 'Comment from test_cmdb_2'
248
- expect(cmdb(:test_cmdb).calls).to eq nil
248
+ expect(cmdb(:test_cmdb).calls).to be_nil
249
249
  expect(cmdb(:test_cmdb_2).calls).to eq [
250
250
  [:get_different_comment, ['node1'], {}]
251
251
  ]
@@ -385,7 +385,7 @@ describe HybridPlatformsConductor::NodesHandler do
385
385
 
386
386
  it 'does not cache metadata from others method when they are not the required property' do
387
387
  with_cmdb_test_platform(cmdbs: %i[test_cmdb test_cmdb_others]) do
388
- expect(test_nodes_handler.get_unknown_of('node1')).to eq nil
388
+ expect(test_nodes_handler.get_unknown_of('node1')).to be_nil
389
389
  expect(cmdb(:test_cmdb_others).calls).to eq [
390
390
  [:get_others, ['node1'], {}]
391
391
  ]
@@ -400,7 +400,7 @@ describe HybridPlatformsConductor::NodesHandler do
400
400
  it 'does not refuse conflicts between CMDBs and overriden values' do
401
401
  with_cmdb_test_platform(cmdbs: %i[test_cmdb_others]) do
402
402
  test_nodes_handler.override_metadata_of 'node1', :downcase, 'OVERIDDEN'
403
- expect(test_nodes_handler.get_unknown_of('node1')).to eq nil
403
+ expect(test_nodes_handler.get_unknown_of('node1')).to be_nil
404
404
  expect(test_nodes_handler.get_downcase_of('node1')).to eq 'OVERIDDEN'
405
405
  end
406
406
  end
@@ -409,7 +409,7 @@ describe HybridPlatformsConductor::NodesHandler do
409
409
  with_cmdb_test_platform do
410
410
  test_nodes_handler.override_metadata_of 'node1', :upcase, 'OVERIDDEN'
411
411
  expect(test_nodes_handler.metadata_of('node1', :upcase)).to eq 'OVERIDDEN'
412
- expect(cmdb(:test_cmdb).calls).to eq nil
412
+ expect(cmdb(:test_cmdb).calls).to be_nil
413
413
  end
414
414
  end
415
415
 
@@ -12,7 +12,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
12
12
 
13
13
  it 'returns no nodes list' do
14
14
  with_serverless_chef_platforms('empty') do |platform|
15
- expect(platform.respond_to?(:known_nodes_lists)).to eq false
15
+ expect(platform.respond_to?(:known_nodes_lists)).to be false
16
16
  end
17
17
  end
18
18
 
@@ -90,7 +90,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
90
90
  with_packaging_mocked(repository) do
91
91
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: false)
92
92
  gems_file = "#{repository}/dist/prod/test_policy/gems.json"
93
- expect(File.exist?(gems_file)).to eq true
93
+ expect(File.exist?(gems_file)).to be true
94
94
  expect(JSON.parse(File.read(gems_file))).to eq []
95
95
  end
96
96
  end
@@ -110,7 +110,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
110
110
  with_packaging_mocked(repository) do
111
111
  platform.package(services: { 'node' => %w[test_policy] }, secrets: { secret: 'value' }, local_environment: false)
112
112
  secret_file = "#{repository}/dist/prod/test_policy/data_bags/hpc_secrets/hpc_secrets.json"
113
- expect(File.exist?(secret_file)).to eq true
113
+ expect(File.exist?(secret_file)).to be true
114
114
  expect(JSON.parse(File.read(secret_file))).to eq(
115
115
  'id' => 'hpc_secrets',
116
116
  'secret' => 'value'
@@ -124,7 +124,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
124
124
  with_packaging_mocked(repository, policy_file: 'policyfiles/test_policy.local.rb', env: 'local') do
125
125
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
126
126
  local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
127
- expect(File.exist?(local_policy_file)).to eq true
127
+ expect(File.exist?(local_policy_file)).to be true
128
128
  expect(JSON.parse(File.read(local_policy_file))).to eq('run_list' => ['recipe[test_cookbook]'])
129
129
  end
130
130
  end
@@ -247,7 +247,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
247
247
  ) do
248
248
  platform.package(services: { 'node1' => %w[test_policy_1] }, secrets: {}, local_environment: false)
249
249
  gems_file = "#{repository}/dist/prod/test_policy_1/gems.json"
250
- expect(File.exist?(gems_file)).to eq true
250
+ expect(File.exist?(gems_file)).to be true
251
251
  expect(JSON.parse(File.read(gems_file)).sort).to eq [
252
252
  ['my_gem_1', '0.0.1'],
253
253
  ['my_gem_2', '0.0.2'],
@@ -266,7 +266,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
266
266
  with_packaging_mocked(repository, data_bags: true) do
267
267
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: false)
268
268
  data_bag_file = "#{repository}/dist/prod/test_policy/data_bags/my_bag/my_item.json"
269
- expect(File.exist?(data_bag_file)).to eq true
269
+ expect(File.exist?(data_bag_file)).to be true
270
270
  expect(JSON.parse(File.read(data_bag_file))).to eq(
271
271
  'id' => 'my_item',
272
272
  'content' => 'Bag content'
@@ -284,7 +284,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
284
284
  with_packaging_mocked(repository, policy_file: 'policyfiles/test_policy.local.rb', env: 'local') do
285
285
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
286
286
  local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
287
- expect(File.exist?(local_policy_file)).to eq true
287
+ expect(File.exist?(local_policy_file)).to be true
288
288
  expect(JSON.parse(File.read(local_policy_file))).to eq(
289
289
  'run_list' => [
290
290
  'hpc_test::before_run',
@@ -302,7 +302,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
302
302
  with_packaging_mocked(repository, policy_file: 'policyfiles/test_policy.local.rb', env: 'local') do
303
303
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
304
304
  local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
305
- expect(File.exist?(local_policy_file)).to eq true
305
+ expect(File.exist?(local_policy_file)).to be true
306
306
  expect(JSON.parse(File.read(local_policy_file))).to eq(
307
307
  'run_list' => [
308
308
  'hpc_test::before_run',
@@ -319,7 +319,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
319
319
  with_packaging_mocked(repository, policy_file: 'policyfiles/test_policy.local.rb', env: 'local') do
320
320
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
321
321
  local_policy_file = "#{repository}/policyfiles/test_policy.local.lock.json"
322
- expect(File.exist?(local_policy_file)).to eq true
322
+ expect(File.exist?(local_policy_file)).to be true
323
323
  expect(JSON.parse(File.read(local_policy_file))).to eq(
324
324
  'run_list' => [
325
325
  'recipe[test_cookbook]',
@@ -343,7 +343,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
343
343
  ) do
344
344
  platform.package(services: { 'node' => %w[test_policy] }, secrets: {}, local_environment: true)
345
345
  testadmin_key_pub = Dir.glob("#{repository}/dist/local/test_policy/cookbook_artifacts/hpc_test-*/files/default/testadmin.key.pub").first
346
- expect(testadmin_key_pub).not_to eq nil
346
+ expect(testadmin_key_pub).not_to be_nil
347
347
  expect(File.read(testadmin_key_pub)).to eq 'ssh-rsa 12345 testadmin@test.com'
348
348
  end
349
349
  end
@@ -168,7 +168,7 @@ describe HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef d
168
168
  )
169
169
  expect(platform.actions_to_deploy_on('node', 'test_policy', use_why_run: false)).to eq expected_actions_to_deploy_chef(repository)
170
170
  attributes_file = "#{repository}/dist/prod/test_policy/nodes/node.json"
171
- expect(File.exist?(attributes_file)).to eq true
171
+ expect(File.exist?(attributes_file)).to be true
172
172
  expect(JSON.parse(File.read(attributes_file))).to eq(
173
173
  'description' => 'Single test node',
174
174
  'image' => 'debian_9',
@@ -138,7 +138,7 @@ describe HybridPlatformsConductor::PlatformsHandler do
138
138
  'platform3' => { platform_type: :test }
139
139
  }
140
140
  ) do
141
- expect(test_platforms_handler.platform('platform4')).to eq nil
141
+ expect(test_platforms_handler.platform('platform4')).to be_nil
142
142
  end
143
143
  end
144
144
 
@@ -7,6 +7,9 @@ module HybridPlatformsConductor
7
7
  class TestPluginType2 < Plugin
8
8
  end
9
9
 
10
+ class TestPluginType3 < Plugin
11
+ end
12
+
10
13
  end
11
14
 
12
15
  module HybridPlatformsConductorTest
@@ -122,7 +125,7 @@ describe HybridPlatformsConductor::Plugins do
122
125
  plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClassWithValidation
123
126
  expect(plugins.keys).to eq [:new_plugin]
124
127
  expect(plugins[:new_plugin]).to eq HybridPlatformsConductorTest::RandomClassWithValidation
125
- expect(HybridPlatformsConductorTest::RandomClassWithValidation.validation_done).to eq true
128
+ expect(HybridPlatformsConductorTest::RandomClassWithValidation.validation_done).to be true
126
129
  end
127
130
  end
128
131
 
@@ -133,7 +136,7 @@ describe HybridPlatformsConductor::Plugins do
133
136
  HybridPlatformsConductorTest::RandomClassWithValidation.validation_result = false
134
137
  plugins[:new_plugin] = HybridPlatformsConductorTest::RandomClassWithValidation
135
138
  expect(plugins.keys).to eq []
136
- expect(HybridPlatformsConductorTest::RandomClassWithValidation.validation_done).to eq true
139
+ expect(HybridPlatformsConductorTest::RandomClassWithValidation.validation_done).to be true
137
140
  end
138
141
  end
139
142
 
@@ -162,6 +165,31 @@ describe HybridPlatformsConductor::Plugins do
162
165
  end
163
166
  end
164
167
 
168
+ it 'discovers automatically plugins of a given type in the hpc_plugins directory of a gem even if lib is used in the gem\'s installation path' do
169
+ with_test_platform({}) do
170
+ # Mock the discovery of Ruby gems
171
+ expect(Gem).to receive(:loaded_specs) do
172
+ my_test_gem_spec = instance_double Gem::Specification
173
+ expect(my_test_gem_spec).to receive(:full_gem_path).and_return('path/to/__gem_full_path__/in/lib/sub')
174
+ expect(Dir).to receive(:glob).with('path/to/__gem_full_path__/in/lib/sub/lib/**/*.rb').and_return [
175
+ 'path/to/__gem_full_path__/in/lib/sub/lib/my_test_gem_with_lib/sub1/lib/sub2/hpc_plugins/test_plugin_type_3/test_plugin_id_5.rb'
176
+ ]
177
+ {
178
+ 'my_test_gem_with_lib' => my_test_gem_spec
179
+ }
180
+ end
181
+ # Alter the load path to mock an extra Rubygem
182
+ $LOAD_PATH.unshift "#{__dir__}/../mocked_lib"
183
+ begin
184
+ plugins = described_class.new(:test_plugin_type_3, logger: logger, logger_stderr: logger)
185
+ expect(plugins.keys).to eq [:test_plugin_id_5]
186
+ expect(plugins[:test_plugin_id_5]).to eq HybridPlatformsConductorTest::MockedLib::MyTestGemWithLib::Sub1::Lib::Sub2::HpcPlugins::TestPluginType3::TestPluginId5
187
+ ensure
188
+ $LOAD_PATH.shift
189
+ end
190
+ end
191
+ end
192
+
165
193
  it 'discovers automatically several plugins of different types in the hpc_plugins directories of several gems' do
166
194
  with_test_platform({}) do
167
195
  # Mock the discovery of Ruby gems
@@ -34,14 +34,14 @@ describe HybridPlatformsConductor::ServicesHandler do
34
34
  it 'allows deployment in local environment' do
35
35
  with_test_platform_for_services_test do
36
36
  with_cmd_runner_mocked([]) do
37
- expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: true)).to eq nil
37
+ expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: true)).to be_nil
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
42
  it 'allows deployment if branch is on master' do
43
43
  with_test_platform_for_services_test do
44
- expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to eq nil
44
+ expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to be_nil
45
45
  end
46
46
  end
47
47
 
@@ -52,7 +52,7 @@ describe HybridPlatformsConductor::ServicesHandler do
52
52
  deployable_services: %w[service1]
53
53
  }
54
54
  ) do
55
- expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to eq nil
55
+ expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to be_nil
56
56
  end
57
57
  end
58
58
 
@@ -62,7 +62,7 @@ describe HybridPlatformsConductor::ServicesHandler do
62
62
  git = Git.open(repository)
63
63
  git.add_remote('another_remote', remote_repo).fetch
64
64
  git.checkout('remotes/another_remote/master')
65
- expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to eq nil
65
+ expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to be_nil
66
66
  end
67
67
  end
68
68
  end
@@ -70,7 +70,7 @@ describe HybridPlatformsConductor::ServicesHandler do
70
70
  it 'allows deployment if branch is on master even if not checked-out' do
71
71
  with_test_platform_for_services_test do |repository|
72
72
  Git.open(repository).branch('other_branch').checkout
73
- expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to eq nil
73
+ expect(test_services_handler.deploy_allowed?(services: { 'node1' => %w[service1] }, local_environment: false)).to be_nil
74
74
  end
75
75
  end
76
76
 
@@ -95,7 +95,7 @@ describe HybridPlatformsConductor::ServicesHandler do
95
95
  services: { 'node1' => %w[service1], 'node2' => %w[service2], 'node3' => %w[service3] },
96
96
  local_environment: false
97
97
  )
98
- ).to eq nil
98
+ ).to be_nil
99
99
  end
100
100
  end
101
101
 
@@ -137,7 +137,7 @@ describe HybridPlatformsConductor::ServicesHandler do
137
137
  services: { 'node1' => %w[service1 service3] },
138
138
  local_environment: false
139
139
  )
140
- ).to eq nil
140
+ ).to be_nil
141
141
  end
142
142
  end
143
143
 
@@ -10,7 +10,7 @@ describe HybridPlatformsConductor::ServicesHandler do
10
10
  package: proc do |services:, secrets:, local_environment:|
11
11
  expect(services).to eq('node1' => %w[service1])
12
12
  expect(secrets).to eq({})
13
- expect(local_environment).to eq false
13
+ expect(local_environment).to be false
14
14
  end
15
15
  }
16
16
  ) do
@@ -31,7 +31,7 @@ describe HybridPlatformsConductor::ServicesHandler do
31
31
  package: proc do |services:, secrets:, local_environment:|
32
32
  expect(services).to eq('node1' => %w[service1])
33
33
  expect(secrets).to eq({})
34
- expect(local_environment).to eq false
34
+ expect(local_environment).to be false
35
35
  nbr_calls += 1
36
36
  end
37
37
  }
@@ -56,7 +56,7 @@ describe HybridPlatformsConductor::ServicesHandler do
56
56
  package: proc do |services:, secrets:, local_environment:|
57
57
  expect(services).to eq('node1' => %w[service1])
58
58
  expect(secrets).to eq({})
59
- expect(local_environment).to eq false
59
+ expect(local_environment).to be false
60
60
  nbr_calls += 1
61
61
  end
62
62
  }
@@ -91,7 +91,7 @@ describe HybridPlatformsConductor::ServicesHandler do
91
91
  package: proc do |services:, secrets:, local_environment:|
92
92
  expect(services).to eq('node1' => %w[service1])
93
93
  expect(secrets).to eq('my_secret' => 'value')
94
- expect(local_environment).to eq false
94
+ expect(local_environment).to be false
95
95
  end
96
96
  }
97
97
  ) do
@@ -111,7 +111,7 @@ describe HybridPlatformsConductor::ServicesHandler do
111
111
  package: proc do |services:, secrets:, local_environment:|
112
112
  expect(services).to eq('node1' => %w[service1])
113
113
  expect(secrets).to eq({})
114
- expect(local_environment).to eq true
114
+ expect(local_environment).to be true
115
115
  end
116
116
  }
117
117
  ) do
@@ -137,7 +137,7 @@ describe HybridPlatformsConductor::ServicesHandler do
137
137
  package: proc do |services:, secrets:, local_environment:|
138
138
  expect(services).to eq('node1' => %w[service1])
139
139
  expect(secrets).to eq({})
140
- expect(local_environment).to eq false
140
+ expect(local_environment).to be false
141
141
  nbr_calls['platform1'] += 1
142
142
  end
143
143
  },
@@ -147,7 +147,7 @@ describe HybridPlatformsConductor::ServicesHandler do
147
147
  package: proc do |services:, secrets:, local_environment:|
148
148
  expect(services).to eq('node2' => %w[service2])
149
149
  expect(secrets).to eq({})
150
- expect(local_environment).to eq false
150
+ expect(local_environment).to be false
151
151
  nbr_calls['platform2'] += 1
152
152
  end
153
153
  },
@@ -157,7 +157,7 @@ describe HybridPlatformsConductor::ServicesHandler do
157
157
  package: proc do |services:, secrets:, local_environment:|
158
158
  expect(services).to eq('node3' => %w[service3])
159
159
  expect(secrets).to eq({})
160
- expect(local_environment).to eq false
160
+ expect(local_environment).to be false
161
161
  nbr_calls['platform3'] += 1
162
162
  end
163
163
  }
@@ -190,7 +190,7 @@ describe HybridPlatformsConductor::ServicesHandler do
190
190
  package: proc do |services:, secrets:, local_environment:|
191
191
  expect(services).to eq('node1' => %w[service1])
192
192
  expect(secrets).to eq({})
193
- expect(local_environment).to eq false
193
+ expect(local_environment).to be false
194
194
  nbr_calls['platform1'] += 1
195
195
  end
196
196
  },
@@ -200,7 +200,7 @@ describe HybridPlatformsConductor::ServicesHandler do
200
200
  package: proc do |services:, secrets:, local_environment:|
201
201
  expect(services).to eq('node2' => %w[service2])
202
202
  expect(secrets).to eq({})
203
- expect(local_environment).to eq false
203
+ expect(local_environment).to be false
204
204
  nbr_calls['platform2'] += 1
205
205
  end
206
206
  },
@@ -210,7 +210,7 @@ describe HybridPlatformsConductor::ServicesHandler do
210
210
  package: proc do |services:, secrets:, local_environment:|
211
211
  expect(services).to eq('node1' => %w[service3])
212
212
  expect(secrets).to eq({})
213
- expect(local_environment).to eq false
213
+ expect(local_environment).to be false
214
214
  nbr_calls['platform3'] += 1
215
215
  end
216
216
  }
@@ -243,7 +243,7 @@ describe HybridPlatformsConductor::ServicesHandler do
243
243
  package: proc do |services:, secrets:, local_environment:|
244
244
  expect(services).to eq('node' => %w[service1 service2])
245
245
  expect(secrets).to eq({})
246
- expect(local_environment).to eq false
246
+ expect(local_environment).to be false
247
247
  nbr_calls['platform1'] += 1
248
248
  end
249
249
  },
@@ -253,7 +253,7 @@ describe HybridPlatformsConductor::ServicesHandler do
253
253
  package: proc do |services:, secrets:, local_environment:|
254
254
  expect(services).to eq('node' => %w[service3])
255
255
  expect(secrets).to eq({})
256
- expect(local_environment).to eq false
256
+ expect(local_environment).to be false
257
257
  nbr_calls['platform2'] += 1
258
258
  end
259
259
  },
@@ -263,7 +263,7 @@ describe HybridPlatformsConductor::ServicesHandler do
263
263
  package: proc do |services:, secrets:, local_environment:|
264
264
  expect(services).to eq('node' => %w[service5 service6])
265
265
  expect(secrets).to eq({})
266
- expect(local_environment).to eq false
266
+ expect(local_environment).to be false
267
267
  nbr_calls['platform3'] += 1
268
268
  end
269
269
  }
@@ -296,7 +296,7 @@ describe HybridPlatformsConductor::ServicesHandler do
296
296
  package: proc do |services:, secrets:, local_environment:|
297
297
  expect(services).to eq('node1' => %w[service1])
298
298
  expect(secrets).to eq({})
299
- expect(local_environment).to eq false
299
+ expect(local_environment).to be false
300
300
  nbr_calls['platform1'] += 1
301
301
  end
302
302
  },
@@ -306,7 +306,7 @@ describe HybridPlatformsConductor::ServicesHandler do
306
306
  package: proc do |services:, secrets:, local_environment:|
307
307
  expect(services).to eq('node2' => %w[service2])
308
308
  expect(secrets).to eq({})
309
- expect(local_environment).to eq false
309
+ expect(local_environment).to be false
310
310
  nbr_calls['platform2'] += 1
311
311
  end
312
312
  },
@@ -316,7 +316,7 @@ describe HybridPlatformsConductor::ServicesHandler do
316
316
  package: proc do |services:, secrets:, local_environment:|
317
317
  expect(services).to eq('node3' => %w[service3])
318
318
  expect(secrets).to eq({})
319
- expect(local_environment).to eq false
319
+ expect(local_environment).to be false
320
320
  nbr_calls['platform3'] += 1
321
321
  end
322
322
  }
@@ -355,7 +355,7 @@ describe HybridPlatformsConductor::ServicesHandler do
355
355
  package: proc do |services:, secrets:, local_environment:|
356
356
  expect(services).to eq('node1' => %w[service1])
357
357
  expect(secrets).to eq(expected_secrets)
358
- expect(local_environment).to eq false
358
+ expect(local_environment).to be false
359
359
  nbr_calls += 1
360
360
  end
361
361
  }
@@ -11,8 +11,8 @@ describe HybridPlatformsConductor::ServicesHandler do
11
11
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
12
12
  expect(services).to eq('node1' => %w[service1])
13
13
  expect(secrets).to eq({})
14
- expect(local_environment).to eq false
15
- expect(why_run).to eq false
14
+ expect(local_environment).to be false
15
+ expect(why_run).to be false
16
16
  called = true
17
17
  end
18
18
  }
@@ -23,7 +23,7 @@ describe HybridPlatformsConductor::ServicesHandler do
23
23
  local_environment: false,
24
24
  why_run: false
25
25
  )
26
- expect(called).to eq true
26
+ expect(called).to be true
27
27
  end
28
28
  end
29
29
 
@@ -36,8 +36,8 @@ describe HybridPlatformsConductor::ServicesHandler do
36
36
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
37
37
  expect(services).to eq('node1' => %w[service1])
38
38
  expect(secrets).to eq('my_secret' => 'value')
39
- expect(local_environment).to eq false
40
- expect(why_run).to eq false
39
+ expect(local_environment).to be false
40
+ expect(why_run).to be false
41
41
  called = true
42
42
  end
43
43
  }
@@ -48,7 +48,7 @@ describe HybridPlatformsConductor::ServicesHandler do
48
48
  local_environment: false,
49
49
  why_run: false
50
50
  )
51
- expect(called).to eq true
51
+ expect(called).to be true
52
52
  end
53
53
  end
54
54
 
@@ -61,8 +61,8 @@ describe HybridPlatformsConductor::ServicesHandler do
61
61
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
62
62
  expect(services).to eq('node1' => %w[service1])
63
63
  expect(secrets).to eq({})
64
- expect(local_environment).to eq true
65
- expect(why_run).to eq false
64
+ expect(local_environment).to be true
65
+ expect(why_run).to be false
66
66
  called = true
67
67
  end
68
68
  }
@@ -73,7 +73,7 @@ describe HybridPlatformsConductor::ServicesHandler do
73
73
  local_environment: true,
74
74
  why_run: false
75
75
  )
76
- expect(called).to eq true
76
+ expect(called).to be true
77
77
  end
78
78
  end
79
79
 
@@ -86,8 +86,8 @@ describe HybridPlatformsConductor::ServicesHandler do
86
86
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
87
87
  expect(services).to eq('node1' => %w[service1])
88
88
  expect(secrets).to eq({})
89
- expect(local_environment).to eq false
90
- expect(why_run).to eq true
89
+ expect(local_environment).to be false
90
+ expect(why_run).to be true
91
91
  called = true
92
92
  end
93
93
  }
@@ -98,7 +98,7 @@ describe HybridPlatformsConductor::ServicesHandler do
98
98
  local_environment: false,
99
99
  why_run: true
100
100
  )
101
- expect(called).to eq true
101
+ expect(called).to be true
102
102
  end
103
103
  end
104
104
 
@@ -116,8 +116,8 @@ describe HybridPlatformsConductor::ServicesHandler do
116
116
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
117
117
  expect(services).to eq('node1' => %w[service1])
118
118
  expect(secrets).to eq({})
119
- expect(local_environment).to eq false
120
- expect(why_run).to eq false
119
+ expect(local_environment).to be false
120
+ expect(why_run).to be false
121
121
  called['platform1'] = true
122
122
  end
123
123
  },
@@ -127,8 +127,8 @@ describe HybridPlatformsConductor::ServicesHandler do
127
127
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
128
128
  expect(services).to eq('node2' => %w[service2])
129
129
  expect(secrets).to eq({})
130
- expect(local_environment).to eq false
131
- expect(why_run).to eq false
130
+ expect(local_environment).to be false
131
+ expect(why_run).to be false
132
132
  called['platform2'] = true
133
133
  end
134
134
  },
@@ -138,8 +138,8 @@ describe HybridPlatformsConductor::ServicesHandler do
138
138
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
139
139
  expect(services).to eq('node3' => %w[service3])
140
140
  expect(secrets).to eq({})
141
- expect(local_environment).to eq false
142
- expect(why_run).to eq false
141
+ expect(local_environment).to be false
142
+ expect(why_run).to be false
143
143
  called['platform3'] = true
144
144
  end
145
145
  }
@@ -173,8 +173,8 @@ describe HybridPlatformsConductor::ServicesHandler do
173
173
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
174
174
  expect(services).to eq('node1' => %w[service1])
175
175
  expect(secrets).to eq({})
176
- expect(local_environment).to eq false
177
- expect(why_run).to eq false
176
+ expect(local_environment).to be false
177
+ expect(why_run).to be false
178
178
  called['platform1'] = true
179
179
  end
180
180
  },
@@ -184,8 +184,8 @@ describe HybridPlatformsConductor::ServicesHandler do
184
184
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
185
185
  expect(services).to eq('node2' => %w[service2])
186
186
  expect(secrets).to eq({})
187
- expect(local_environment).to eq false
188
- expect(why_run).to eq false
187
+ expect(local_environment).to be false
188
+ expect(why_run).to be false
189
189
  called['platform2'] = true
190
190
  end
191
191
  },
@@ -195,8 +195,8 @@ describe HybridPlatformsConductor::ServicesHandler do
195
195
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
196
196
  expect(services).to eq('node1' => %w[service3])
197
197
  expect(secrets).to eq({})
198
- expect(local_environment).to eq false
199
- expect(why_run).to eq false
198
+ expect(local_environment).to be false
199
+ expect(why_run).to be false
200
200
  called['platform3'] = true
201
201
  end
202
202
  }
@@ -230,8 +230,8 @@ describe HybridPlatformsConductor::ServicesHandler do
230
230
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
231
231
  expect(services).to eq('node' => %w[service1 service2])
232
232
  expect(secrets).to eq({})
233
- expect(local_environment).to eq false
234
- expect(why_run).to eq false
233
+ expect(local_environment).to be false
234
+ expect(why_run).to be false
235
235
  called['platform1'] = true
236
236
  end
237
237
  },
@@ -241,8 +241,8 @@ describe HybridPlatformsConductor::ServicesHandler do
241
241
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
242
242
  expect(services).to eq('node' => %w[service3])
243
243
  expect(secrets).to eq({})
244
- expect(local_environment).to eq false
245
- expect(why_run).to eq false
244
+ expect(local_environment).to be false
245
+ expect(why_run).to be false
246
246
  called['platform2'] = true
247
247
  end
248
248
  },
@@ -252,8 +252,8 @@ describe HybridPlatformsConductor::ServicesHandler do
252
252
  prepare_for_deploy: proc do |services:, secrets:, local_environment:, why_run:|
253
253
  expect(services).to eq('node' => %w[service5 service6])
254
254
  expect(secrets).to eq({})
255
- expect(local_environment).to eq false
256
- expect(why_run).to eq false
255
+ expect(local_environment).to be false
256
+ expect(why_run).to be false
257
257
  called['platform3'] = true
258
258
  end
259
259
  }