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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/bin/last_deploys +3 -4
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/lib/hybrid_platforms_conductor/actions_executor.rb +2 -2
- data/lib/hybrid_platforms_conductor/common_config_dsl/file_system_tests.rb +2 -2
- data/lib/hybrid_platforms_conductor/config.rb +1 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +12 -12
- data/lib/hybrid_platforms_conductor/executable.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/host_ip.rb +21 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/cmdb/platform_handlers.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +1 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox/proxmox_waiter.rb +6 -6
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/mediawiki.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/keepass.rb +6 -6
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/file_system_hdfs.rb +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/linear_strategy.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/private_ips.rb +1 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb +1 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/veids.rb +1 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +2 -2
- data/lib/hybrid_platforms_conductor/plugins.rb +4 -3
- data/lib/hybrid_platforms_conductor/tests_runner.rb +2 -2
- data/lib/hybrid_platforms_conductor/topographer.rb +5 -6
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/helpers_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/api/deployer/log_plugins/remote_fs_spec.rb +12 -12
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/docker_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/expired_containers_spec.rb +27 -27
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/reserve_proxmox_container/retries_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs/host_ip_spec.rb +25 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +9 -9
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/platforms_handler_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/plugins_spec.rb +30 -2
- data/spec/hybrid_platforms_conductor_test/api/services_handler/deploy_allowed_spec.rb +7 -7
- data/spec/hybrid_platforms_conductor_test/api/services_handler/package_spec.rb +18 -18
- data/spec/hybrid_platforms_conductor_test/api/services_handler/prepare_for_deploy_spec.rb +30 -30
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/common_spec.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_check_spec.rb +6 -6
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/node_ssh_spec.rb +6 -6
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb +4 -4
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb +8 -8
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_2.rb +5 -5
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_others_2.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/check_node_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/deploy_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/cmd_runner_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/options/deployer_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/executables/options/nodes_handler_spec.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/executables/options/tests_runner_spec.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/executables/report_spec.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/executables/run_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/actions_executor_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/cmdb_helpers.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/helpers/connector_ssh_helpers.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/helpers/deployer_helpers.rb +7 -7
- data/spec/hybrid_platforms_conductor_test/helpers/platforms_handler_helpers.rb +3 -3
- data/spec/hybrid_platforms_conductor_test/helpers/provisioner_proxmox_helpers.rb +11 -12
- data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +2 -2
- 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
- data/spec/hybrid_platforms_conductor_test/shared_examples/deployer.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/test_connector.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +1 -0
- metadata +152 -136
@@ -54,7 +54,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
54
54
|
},
|
55
55
|
log_to_dir: logs_dir
|
56
56
|
)
|
57
|
-
expect(File.exist?("#{logs_dir}/node.stdout")).to
|
57
|
+
expect(File.exist?("#{logs_dir}/node.stdout")).to be true
|
58
58
|
expect(File.read("#{logs_dir}/node.stdout")).to eq "TestStdout\nTestStderr\n"
|
59
59
|
end
|
60
60
|
end
|
@@ -18,7 +18,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
18
18
|
}
|
19
19
|
)['node']
|
20
20
|
).to eq [0, 'TestStdout', 'TestStderr']
|
21
|
-
expect(executed).to
|
21
|
+
expect(executed).to be true
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -38,7 +38,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
38
38
|
timeout: 1
|
39
39
|
)['node']
|
40
40
|
).to eq [:timeout, '', '']
|
41
|
-
expect(executed).to
|
41
|
+
expect(executed).to be false
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -54,7 +54,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
54
54
|
} },
|
55
55
|
log_to_dir: logs_dir
|
56
56
|
)
|
57
|
-
expect(File.exist?("#{logs_dir}/node.stdout")).to
|
57
|
+
expect(File.exist?("#{logs_dir}/node.stdout")).to be true
|
58
58
|
expect(File.read("#{logs_dir}/node.stdout")).to eq "TestStdout\nTestStderr\n"
|
59
59
|
end
|
60
60
|
end
|
@@ -68,7 +68,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
68
68
|
{
|
69
69
|
'node' => {
|
70
70
|
ruby: proc do |stdout, stderr, action|
|
71
|
-
expect(action.is_a?(HybridPlatformsConductor::HpcPlugins::Action::Ruby)).to
|
71
|
+
expect(action.is_a?(HybridPlatformsConductor::HpcPlugins::Action::Ruby)).to be true
|
72
72
|
stdout << 'TestStdout'
|
73
73
|
stderr << 'TestStderr'
|
74
74
|
executed = true
|
@@ -77,7 +77,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
77
77
|
}
|
78
78
|
)['node']
|
79
79
|
).to eq [0, 'TestStdout', 'TestStderr']
|
80
|
-
expect(executed).to
|
80
|
+
expect(executed).to be true
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -90,7 +90,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
90
90
|
'node' => {
|
91
91
|
ruby: {
|
92
92
|
code: proc do |stdout, stderr, _action, connector|
|
93
|
-
expect(connector.is_a?(HybridPlatformsConductorTest::TestConnector)).to
|
93
|
+
expect(connector.is_a?(HybridPlatformsConductorTest::TestConnector)).to be true
|
94
94
|
stdout << 'TestStdout'
|
95
95
|
stderr << 'TestStderr'
|
96
96
|
executed = true
|
@@ -101,7 +101,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
101
101
|
}
|
102
102
|
)['node']
|
103
103
|
).to eq [0, 'TestStdout', 'TestStderr']
|
104
|
-
expect(executed).to
|
104
|
+
expect(executed).to be true
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -125,7 +125,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
125
125
|
}
|
126
126
|
)['node']
|
127
127
|
).to eq [0, 'TestStdout', 'TestStderr']
|
128
|
-
expect(executed).to
|
128
|
+
expect(executed).to be true
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb
CHANGED
@@ -60,7 +60,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
60
60
|
it 'does not use the SSH control master' do
|
61
61
|
with_test_platform_for_cli do
|
62
62
|
expect_actions_executor_runs [proc do
|
63
|
-
expect(test_connector.ssh_use_control_master).to
|
63
|
+
expect(test_connector.ssh_use_control_master).to be false
|
64
64
|
{}
|
65
65
|
end]
|
66
66
|
exit_code, stdout, stderr = run 'run', '--node', 'node', '--command', 'echo Hello', '--ssh-no-control-master'
|
@@ -73,7 +73,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
73
73
|
it 'does not use strict host key checking' do
|
74
74
|
with_test_platform_for_cli do
|
75
75
|
expect_actions_executor_runs [proc do
|
76
|
-
expect(test_connector.ssh_strict_host_key_checking).to
|
76
|
+
expect(test_connector.ssh_strict_host_key_checking).to be false
|
77
77
|
{}
|
78
78
|
end]
|
79
79
|
exit_code, stdout, stderr = run 'run', '--node', 'node', '--command', 'echo Hello', '--ssh-no-host-key-checking'
|
@@ -111,7 +111,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
111
111
|
it 'expects passwords to be input' do
|
112
112
|
with_test_platform_for_cli do
|
113
113
|
expect_actions_executor_runs [proc do
|
114
|
-
expect(test_connector.auth_password).to
|
114
|
+
expect(test_connector.auth_password).to be true
|
115
115
|
{}
|
116
116
|
end]
|
117
117
|
exit_code, stdout, stderr = run 'run', '--node', 'node', '--command', 'echo Hello', '--password'
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb
CHANGED
@@ -536,14 +536,14 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
536
536
|
test_connector.with_connection_to(['node']) do
|
537
537
|
test_connector.prepare_for('node', nil, stdout, stderr)
|
538
538
|
ssh_exec_2 = test_connector.ssh_exec
|
539
|
-
expect(File.exist?(ssh_exec_1)).to
|
540
|
-
expect(File.exist?(ssh_exec_2)).to
|
539
|
+
expect(File.exist?(ssh_exec_1)).to be true
|
540
|
+
expect(File.exist?(ssh_exec_2)).to be true
|
541
541
|
end
|
542
|
-
expect(File.exist?(ssh_exec_1)).to
|
543
|
-
expect(File.exist?(ssh_exec_2)).to
|
542
|
+
expect(File.exist?(ssh_exec_1)).to be true
|
543
|
+
expect(File.exist?(ssh_exec_2)).to be false
|
544
544
|
end
|
545
|
-
expect(File.exist?(ssh_exec_1)).to
|
546
|
-
expect(File.exist?(ssh_exec_2)).to
|
545
|
+
expect(File.exist?(ssh_exec_1)).to be false
|
546
|
+
expect(File.exist?(ssh_exec_2)).to be false
|
547
547
|
end
|
548
548
|
end
|
549
549
|
end
|
@@ -590,13 +590,13 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
590
590
|
['which env', proc { [0, "/usr/bin/env\n", ''] }],
|
591
591
|
['ssh -V 2>&1', proc { [0, "OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u 20 Dec 2019\n", ''] }]
|
592
592
|
] +
|
593
|
-
[[
|
593
|
+
([[
|
594
594
|
%r{^.+/ssh -o BatchMode=yes -o ControlMaster=yes -o ControlPersist=yes hpc\.node true$},
|
595
595
|
proc do
|
596
596
|
nbr_boot_messages += 1
|
597
597
|
[255, '', "System is booting up. See pam_nologin(8)\nAuthentication failed.\n"]
|
598
598
|
end
|
599
|
-
]] * 3 +
|
599
|
+
]] * 3) +
|
600
600
|
ssh_expected_commands_for({ 'node' => { connection: '192.168.42.42', user: 'test_user' } })
|
601
601
|
) do
|
602
602
|
test_connector.ssh_user = 'test_user'
|
data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb
CHANGED
@@ -246,7 +246,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
246
246
|
Host hpc.node1
|
247
247
|
Hostname 192.168.42.1
|
248
248
|
EO_SSH_CONFIG
|
249
|
-
expect(ssh_config_for('node2', nodes: %w[node1 node3])).to
|
249
|
+
expect(ssh_config_for('node2', nodes: %w[node1 node3])).to be_nil
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
@@ -11,14 +11,14 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
11
11
|
it 'returns if a user has privileged access on a node' do
|
12
12
|
with_test_platform({ nodes: { 'node' => {} } }) do
|
13
13
|
test_actions_executor.connector(:ssh).ssh_user = 'test_user'
|
14
|
-
expect(test_actions_executor.privileged_access?('node')).to
|
14
|
+
expect(test_actions_executor.privileged_access?('node')).to be false
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'returns if a user has privileged access on a node when connecting with root' do
|
19
19
|
with_test_platform({ nodes: { 'node' => {} } }) do
|
20
20
|
test_actions_executor.connector(:ssh).ssh_user = 'root'
|
21
|
-
expect(test_actions_executor.privileged_access?('node')).to
|
21
|
+
expect(test_actions_executor.privileged_access?('node')).to be true
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
28
28
|
['whoami', proc { [0, 'test_user', ''] }]
|
29
29
|
] do
|
30
30
|
test_actions_executor.connector(:ssh).ssh_user = 'test_user'
|
31
|
-
expect(test_actions_executor.privileged_access?('node')).to
|
31
|
+
expect(test_actions_executor.privileged_access?('node')).to be false
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -39,7 +39,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
39
39
|
['whoami', proc { [0, 'root', ''] }]
|
40
40
|
] do
|
41
41
|
test_actions_executor.connector(:ssh).ssh_user = 'test_user'
|
42
|
-
expect(test_actions_executor.privileged_access?('node')).to
|
42
|
+
expect(test_actions_executor.privileged_access?('node')).to be true
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -15,7 +15,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
|
|
15
15
|
expect(test_actions_executor.execute_actions(
|
16
16
|
{
|
17
17
|
'node' => { test_action: { code: proc do |stdout, _stderr, action|
|
18
|
-
expect(action.timeout).to
|
18
|
+
expect(action.timeout).to be_nil
|
19
19
|
stdout << 'Hello'
|
20
20
|
end } }
|
21
21
|
}
|
@@ -168,7 +168,7 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
168
168
|
cmd_runner = test_cmd_runner
|
169
169
|
cmd_runner.dry_run = true
|
170
170
|
expect(cmd_runner.run_cmd("echo TestContent >#{repository}/test_file")).to eq [0, '', '']
|
171
|
-
expect(File.exist?("#{repository}/test_file")).to
|
171
|
+
expect(File.exist?("#{repository}/test_file")).to be false
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
@@ -177,7 +177,7 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
177
177
|
cmd_runner = test_cmd_runner
|
178
178
|
cmd_runner.dry_run = true
|
179
179
|
expect(cmd_runner.run_cmd("echo TestContent >#{repository}/test_file", expected_code: 2)).to eq [2, '', '']
|
180
|
-
expect(File.exist?("#{repository}/test_file")).to
|
180
|
+
expect(File.exist?("#{repository}/test_file")).to be false
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -190,13 +190,13 @@ describe HybridPlatformsConductor::CmdRunner do
|
|
190
190
|
it 'returns non-root user when user is not root' do
|
191
191
|
cmd_runner = test_cmd_runner
|
192
192
|
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false).and_return [0, 'not_root', '']
|
193
|
-
expect(cmd_runner.root?).to
|
193
|
+
expect(cmd_runner.root?).to be false
|
194
194
|
end
|
195
195
|
|
196
196
|
it 'returns root user when user is root' do
|
197
197
|
cmd_runner = test_cmd_runner
|
198
198
|
expect(cmd_runner).to receive(:run_cmd).with('whoami', log_to_stdout: false).and_return [0, 'root', '']
|
199
|
-
expect(cmd_runner.root?).to
|
199
|
+
expect(cmd_runner.root?).to be true
|
200
200
|
end
|
201
201
|
|
202
202
|
it 'returns the correct executable prefix' do
|
@@ -34,7 +34,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
34
34
|
expect(actions_per_nodes['node'][0].keys.sort).to eq %i[ruby remote_bash].sort
|
35
35
|
expect(actions_per_nodes['node'][0][:remote_bash]).to eq 'sudo -u root mkdir -p /var/log/deployments && sudo -u root chmod 600 /var/log/deployments'
|
36
36
|
expect(actions_per_nodes['node'][1].keys.sort).to eq %i[scp].sort
|
37
|
-
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to
|
37
|
+
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to be true
|
38
38
|
expect(actions_per_nodes['node'][1][:scp].delete(:owner)).to eq 'root'
|
39
39
|
expect(actions_per_nodes['node'][1][:scp].delete(:group)).to eq 'root'
|
40
40
|
expect(actions_per_nodes['node'][1][:scp].size).to eq 1
|
@@ -44,7 +44,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
44
44
|
expect(actions_per_nodes['node'][2][:remote_bash]).to eq "sudo -u root chmod 600 /var/log/deployments/#{File.basename(tmp_log_file)}"
|
45
45
|
# Call the Ruby codes to be tested
|
46
46
|
actions_per_nodes['node'][0][:ruby].call
|
47
|
-
expect(File.exist?(tmp_log_file)).to
|
47
|
+
expect(File.exist?(tmp_log_file)).to be true
|
48
48
|
file_content_regexp = Regexp.new <<~EOREGEXP
|
49
49
|
repo_name_0: platform
|
50
50
|
commit_id_0: 123456
|
@@ -62,7 +62,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
62
62
|
expect(File.read(tmp_log_file)).to match file_content_regexp
|
63
63
|
actions_per_nodes['node'][2][:ruby].call
|
64
64
|
# Check temporary log file gets deleted for security reasons
|
65
|
-
expect(File.exist?(tmp_log_file)).to
|
65
|
+
expect(File.exist?(tmp_log_file)).to be false
|
66
66
|
end
|
67
67
|
]
|
68
68
|
expect(test_deployer.deploy_on('node')).to eq('node' => [0, 'Deploy successful stdout', 'Deploy successful stderr'])
|
@@ -93,7 +93,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
93
93
|
expect(actions_per_nodes['node'][0].keys.sort).to eq %i[ruby remote_bash].sort
|
94
94
|
expect(actions_per_nodes['node'][0][:remote_bash]).to eq 'mkdir -p /var/log/deployments && chmod 600 /var/log/deployments'
|
95
95
|
expect(actions_per_nodes['node'][1].keys.sort).to eq %i[scp].sort
|
96
|
-
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to
|
96
|
+
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to be false
|
97
97
|
expect(actions_per_nodes['node'][1][:scp].delete(:owner)).to eq 'root'
|
98
98
|
expect(actions_per_nodes['node'][1][:scp].delete(:group)).to eq 'root'
|
99
99
|
expect(actions_per_nodes['node'][1][:scp].size).to eq 1
|
@@ -103,7 +103,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
103
103
|
expect(actions_per_nodes['node'][2][:remote_bash]).to eq "chmod 600 /var/log/deployments/#{File.basename(tmp_log_file)}"
|
104
104
|
# Call the Ruby codes to be tested
|
105
105
|
actions_per_nodes['node'][0][:ruby].call
|
106
|
-
expect(File.exist?(tmp_log_file)).to
|
106
|
+
expect(File.exist?(tmp_log_file)).to be true
|
107
107
|
file_content_regexp = Regexp.new <<~EOREGEXP
|
108
108
|
repo_name_0: platform
|
109
109
|
commit_id_0: 123456
|
@@ -121,7 +121,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
121
121
|
expect(File.read(tmp_log_file)).to match file_content_regexp
|
122
122
|
actions_per_nodes['node'][2][:ruby].call
|
123
123
|
# Check temporary log file gets deleted for security reasons
|
124
|
-
expect(File.exist?(tmp_log_file)).to
|
124
|
+
expect(File.exist?(tmp_log_file)).to be false
|
125
125
|
end
|
126
126
|
]
|
127
127
|
expect(test_deployer.deploy_on('node')).to eq('node' => [0, 'Deploy successful stdout', 'Deploy successful stderr'])
|
@@ -150,7 +150,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
150
150
|
expect(actions_per_nodes['node'][0].keys.sort).to eq %i[ruby remote_bash].sort
|
151
151
|
expect(actions_per_nodes['node'][0][:remote_bash]).to eq 'sudo -u root mkdir -p /var/log/deployments && sudo -u root chmod 600 /var/log/deployments'
|
152
152
|
expect(actions_per_nodes['node'][1].keys.sort).to eq %i[scp].sort
|
153
|
-
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to
|
153
|
+
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to be true
|
154
154
|
expect(actions_per_nodes['node'][1][:scp].delete(:owner)).to eq 'root'
|
155
155
|
expect(actions_per_nodes['node'][1][:scp].delete(:group)).to eq 'root'
|
156
156
|
expect(actions_per_nodes['node'][1][:scp].size).to eq 1
|
@@ -160,7 +160,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
160
160
|
expect(actions_per_nodes['node'][2][:remote_bash]).to eq "sudo -u root chmod 600 /var/log/deployments/#{File.basename(tmp_log_file)}"
|
161
161
|
# Call the Ruby codes to be tested
|
162
162
|
actions_per_nodes['node'][0][:ruby].call
|
163
|
-
expect(File.exist?(tmp_log_file)).to
|
163
|
+
expect(File.exist?(tmp_log_file)).to be true
|
164
164
|
file_content_regexp = Regexp.new <<~EOREGEXP
|
165
165
|
repo_name_0: platform
|
166
166
|
commit_id_0: 123456
|
@@ -178,7 +178,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
178
178
|
expect(File.read(tmp_log_file)).to match file_content_regexp
|
179
179
|
actions_per_nodes['node'][2][:ruby].call
|
180
180
|
# Check temporary log file gets deleted for security reasons
|
181
|
-
expect(File.exist?(tmp_log_file)).to
|
181
|
+
expect(File.exist?(tmp_log_file)).to be false
|
182
182
|
end
|
183
183
|
]
|
184
184
|
with_cmd_runner_mocked [
|
@@ -211,7 +211,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
211
211
|
expect(actions_per_nodes['node'][0].keys.sort).to eq %i[ruby remote_bash].sort
|
212
212
|
expect(actions_per_nodes['node'][0][:remote_bash]).to eq 'mkdir -p /var/log/deployments && chmod 600 /var/log/deployments'
|
213
213
|
expect(actions_per_nodes['node'][1].keys.sort).to eq %i[scp].sort
|
214
|
-
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to
|
214
|
+
expect(actions_per_nodes['node'][1][:scp].delete(:sudo)).to be false
|
215
215
|
expect(actions_per_nodes['node'][1][:scp].delete(:owner)).to eq 'root'
|
216
216
|
expect(actions_per_nodes['node'][1][:scp].delete(:group)).to eq 'root'
|
217
217
|
expect(actions_per_nodes['node'][1][:scp].size).to eq 1
|
@@ -221,7 +221,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
221
221
|
expect(actions_per_nodes['node'][2][:remote_bash]).to eq "chmod 600 /var/log/deployments/#{File.basename(tmp_log_file)}"
|
222
222
|
# Call the Ruby codes to be tested
|
223
223
|
actions_per_nodes['node'][0][:ruby].call
|
224
|
-
expect(File.exist?(tmp_log_file)).to
|
224
|
+
expect(File.exist?(tmp_log_file)).to be true
|
225
225
|
file_content_regexp = Regexp.new <<~EOREGEXP
|
226
226
|
repo_name_0: platform
|
227
227
|
commit_id_0: 123456
|
@@ -239,7 +239,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
239
239
|
expect(File.read(tmp_log_file)).to match file_content_regexp
|
240
240
|
actions_per_nodes['node'][2][:ruby].call
|
241
241
|
# Check temporary log file gets deleted for security reasons
|
242
|
-
expect(File.exist?(tmp_log_file)).to
|
242
|
+
expect(File.exist?(tmp_log_file)).to be false
|
243
243
|
end
|
244
244
|
]
|
245
245
|
with_cmd_runner_mocked [
|
@@ -14,7 +14,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
14
14
|
expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }).and_yield
|
15
15
|
provisioner = nil
|
16
16
|
test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner') do |sub_test_deployer, test_instance|
|
17
|
-
expect(sub_test_deployer.local_environment).to
|
17
|
+
expect(sub_test_deployer.local_environment).to be true
|
18
18
|
provisioner = test_instance
|
19
19
|
expect(test_instance.node).to eq 'node'
|
20
20
|
expect(test_instance.environment).to match(/^#{Regexp.escape(`whoami`.strip)}_hpc_testing_provisioner_\d+_\d+_\w+$/)
|
@@ -33,7 +33,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
33
33
|
expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 666 }).and_yield
|
34
34
|
provisioner = nil
|
35
35
|
test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner') do |sub_test_deployer, test_instance|
|
36
|
-
expect(sub_test_deployer.local_environment).to
|
36
|
+
expect(sub_test_deployer.local_environment).to be true
|
37
37
|
provisioner = test_instance
|
38
38
|
expect(test_instance.node).to eq 'node'
|
39
39
|
expect(test_instance.environment).to match(/^#{Regexp.escape(`whoami`.strip)}_hpc_testing_provisioner_\d+_\d+_\w+$/)
|
@@ -65,8 +65,8 @@ describe HybridPlatformsConductor::Deployer do
|
|
65
65
|
expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }).and_yield
|
66
66
|
test_deployer.with_test_provisioned_instance(:test_provisioner, 'node1', environment: 'hpc_testing_provisioner') do |sub_test_deployer, test_instance|
|
67
67
|
sub_nodes_handler = sub_test_deployer.instance_variable_get(:@nodes_handler)
|
68
|
-
expect(sub_nodes_handler.get_ssh_session_exec_of('node1')).to
|
69
|
-
expect(sub_nodes_handler.get_ssh_session_exec_of('node2')).to
|
68
|
+
expect(sub_nodes_handler.get_ssh_session_exec_of('node1')).to be true
|
69
|
+
expect(sub_nodes_handler.get_ssh_session_exec_of('node2')).to be false
|
70
70
|
ssh_transforms = test_instance.instance_variable_get(:@config).ssh_connection_transforms
|
71
71
|
expect(ssh_transforms.size).to eq 1
|
72
72
|
expect(ssh_transforms[0][:nodes_selectors_stack]).to eq [%w[node2]]
|
@@ -90,8 +90,8 @@ describe HybridPlatformsConductor::Deployer do
|
|
90
90
|
expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }).and_yield
|
91
91
|
test_deployer.with_test_provisioned_instance(:test_provisioner, 'node1', environment: 'hpc_testing_provisioner') do |sub_test_deployer|
|
92
92
|
sub_nodes_handler = sub_test_deployer.instance_variable_get(:@nodes_handler)
|
93
|
-
expect(sub_nodes_handler.get_local_node_of('node1')).to
|
94
|
-
expect(sub_nodes_handler.get_local_node_of('node2')).to
|
93
|
+
expect(sub_nodes_handler.get_local_node_of('node1')).to be false
|
94
|
+
expect(sub_nodes_handler.get_local_node_of('node2')).to be true
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
@@ -132,7 +132,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
132
132
|
expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }).and_yield
|
133
133
|
provisioner = nil
|
134
134
|
test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner', reuse_instance: true) do |sub_test_deployer, test_instance|
|
135
|
-
expect(sub_test_deployer.local_environment).to
|
135
|
+
expect(sub_test_deployer.local_environment).to be true
|
136
136
|
provisioner = test_instance
|
137
137
|
expect(test_instance.node).to eq 'node'
|
138
138
|
expect(test_instance.environment).to eq "#{`whoami`.strip}_hpc_testing_provisioner"
|
@@ -150,7 +150,7 @@ describe HybridPlatformsConductor::Deployer do
|
|
150
150
|
expect(Socket).to receive(:tcp).with('172.17.0.1', 22, { connect_timeout: 1 }).and_yield
|
151
151
|
provisioner = nil
|
152
152
|
test_deployer.with_test_provisioned_instance(:test_provisioner, 'node', environment: 'hpc_testing_provisioner', reuse_instance: true) do |sub_test_deployer, test_instance|
|
153
|
-
expect(sub_test_deployer.local_environment).to
|
153
|
+
expect(sub_test_deployer.local_environment).to be true
|
154
154
|
provisioner = test_instance
|
155
155
|
expect(test_instance.node).to eq 'node'
|
156
156
|
expect(test_instance.environment).to eq "#{`whoami`.strip}_hpc_testing_provisioner"
|
@@ -48,7 +48,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Docker do
|
|
48
48
|
instance.wait_for_state! :created
|
49
49
|
begin
|
50
50
|
# Test that the instance is created
|
51
|
-
expect(::Docker::Container.all(all: true).find { |container| container.info['Names'].include? "/hpc_docker_container_node_#{environment}" }).not_to
|
51
|
+
expect(::Docker::Container.all(all: true).find { |container| container.info['Names'].include? "/hpc_docker_container_node_#{environment}" }).not_to be_nil
|
52
52
|
expect(instance.state).to eq :created
|
53
53
|
ensure
|
54
54
|
# Clean the Docker containers if needed
|
@@ -14,7 +14,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
14
14
|
memory_total: 4 * 1024 * 1024 * 1024,
|
15
15
|
lxc_containers: {
|
16
16
|
# Make sure it is expired
|
17
|
-
1000 => { ip: '192.168.0.100', maxmem: 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
17
|
+
1000 => { ip: '192.168.0.100', maxmem: 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
18
18
|
}
|
19
19
|
}
|
20
20
|
}
|
@@ -29,7 +29,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
29
29
|
|
30
30
|
it 'expires a VM when there are not enough free resources on a PVE node' do
|
31
31
|
with_sync_node do
|
32
|
-
creation_date = (Time.now - 31 * 24 * 60 * 60).utc
|
32
|
+
creation_date = (Time.now - (31 * 24 * 60 * 60)).utc
|
33
33
|
mock_proxmox(
|
34
34
|
mocked_pve_nodes: {
|
35
35
|
'pve_node_name' => {
|
@@ -81,7 +81,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
81
81
|
maxmem: 4 * 1024 * 1024 * 1024,
|
82
82
|
status: 'stopped',
|
83
83
|
# Make sure it is expired
|
84
|
-
creation_date: (Time.now - 31 * 24 * 60 * 60).utc
|
84
|
+
creation_date: (Time.now - (31 * 24 * 60 * 60)).utc
|
85
85
|
}
|
86
86
|
}
|
87
87
|
}
|
@@ -117,7 +117,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
117
117
|
memory_total: 8 * 1024 * 1024 * 1024,
|
118
118
|
lxc_containers: {
|
119
119
|
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
120
|
-
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
120
|
+
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
121
121
|
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
122
122
|
}
|
123
123
|
}
|
@@ -154,7 +154,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
154
154
|
memory_total: 6 * 1024 * 1024 * 1024,
|
155
155
|
lxc_containers: {
|
156
156
|
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
157
|
-
1001 => { ip: '192.168.0.101', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
157
|
+
1001 => { ip: '192.168.0.101', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
158
158
|
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
159
159
|
}
|
160
160
|
}
|
@@ -185,8 +185,8 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
185
185
|
memory_total: 8 * 1024 * 1024 * 1024,
|
186
186
|
lxc_containers: {
|
187
187
|
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
188
|
-
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
189
|
-
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
188
|
+
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
189
|
+
1002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
190
190
|
}
|
191
191
|
}
|
192
192
|
}
|
@@ -224,8 +224,8 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
224
224
|
memory_total: 8 * 1024 * 1024 * 1024,
|
225
225
|
lxc_containers: {
|
226
226
|
1000 => { ip: '192.168.0.100', maxmem: 2 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
227
|
-
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
228
|
-
2002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
227
|
+
1001 => { ip: '192.168.0.101', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
228
|
+
2002 => { ip: '192.168.0.102', maxmem: 2 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
229
229
|
}
|
230
230
|
}
|
231
231
|
}
|
@@ -261,14 +261,14 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
261
261
|
'pve_node_1' => {
|
262
262
|
memory_total: 16 * 1024 * 1024 * 1024,
|
263
263
|
lxc_containers: {
|
264
|
-
1000 => { ip: '192.168.0.100', maxmem: 14 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
264
|
+
1000 => { ip: '192.168.0.100', maxmem: 14 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
265
265
|
}
|
266
266
|
},
|
267
267
|
# But this node has still a bit of resources left without expiring VMs
|
268
268
|
'pve_node_2' => {
|
269
269
|
memory_total: 16 * 1024 * 1024 * 1024,
|
270
270
|
lxc_containers: {
|
271
|
-
1001 => { ip: '192.168.0.101', maxmem: 10 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
271
|
+
1001 => { ip: '192.168.0.101', maxmem: 10 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
272
272
|
}
|
273
273
|
}
|
274
274
|
}
|
@@ -302,14 +302,14 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
302
302
|
memory_total: 16 * 1024 * 1024 * 1024,
|
303
303
|
lxc_containers: {
|
304
304
|
1000 => { ip: '192.168.0.100', maxmem: 8 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
305
|
-
1001 => { ip: '192.168.0.101', maxmem: 6 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
305
|
+
1001 => { ip: '192.168.0.101', maxmem: 6 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
306
306
|
}
|
307
307
|
},
|
308
308
|
'pve_node_2' => {
|
309
309
|
memory_total: 16 * 1024 * 1024 * 1024,
|
310
310
|
lxc_containers: {
|
311
311
|
1002 => { ip: '192.168.0.102', maxmem: 10 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
312
|
-
1003 => { ip: '192.168.0.103', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
312
|
+
1003 => { ip: '192.168.0.103', maxmem: 4 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
313
313
|
}
|
314
314
|
}
|
315
315
|
}
|
@@ -359,7 +359,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
359
359
|
memory_total: 16 * 1024 * 1024 * 1024,
|
360
360
|
lxc_containers: {
|
361
361
|
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
362
|
-
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
362
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
363
363
|
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
364
364
|
}
|
365
365
|
}
|
@@ -415,7 +415,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
415
415
|
'pve_node_2' => {
|
416
416
|
memory_total: 2 * 1024 * 1024 * 1024,
|
417
417
|
lxc_containers: {
|
418
|
-
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
418
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
419
419
|
}
|
420
420
|
}
|
421
421
|
}
|
@@ -463,7 +463,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
463
463
|
memory_total: 16 * 1024 * 1024 * 1024,
|
464
464
|
lxc_containers: {
|
465
465
|
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
466
|
-
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
466
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
467
467
|
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
468
468
|
}
|
469
469
|
}
|
@@ -521,7 +521,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
521
521
|
'pve_node_2' => {
|
522
522
|
memory_total: 2 * 1024 * 1024 * 1024,
|
523
523
|
lxc_containers: {
|
524
|
-
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
524
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
525
525
|
}
|
526
526
|
}
|
527
527
|
}
|
@@ -571,7 +571,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
571
571
|
memory_total: 16 * 1024 * 1024 * 1024,
|
572
572
|
lxc_containers: {
|
573
573
|
1000 => { ip: '192.168.0.100', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc },
|
574
|
-
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc },
|
574
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc },
|
575
575
|
1002 => { ip: '192.168.0.102', maxmem: 1 * 1024 * 1024 * 1024, creation_date: Time.now.utc }
|
576
576
|
}
|
577
577
|
}
|
@@ -634,7 +634,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
634
634
|
'pve_node_2' => {
|
635
635
|
memory_total: 2 * 1024 * 1024 * 1024,
|
636
636
|
lxc_containers: {
|
637
|
-
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - 31 * 24 * 60 * 60).utc }
|
637
|
+
1001 => { ip: '192.168.0.101', maxmem: 1 * 1024 * 1024 * 1024, creation_date: (Time.now - (31 * 24 * 60 * 60)).utc }
|
638
638
|
}
|
639
639
|
}
|
640
640
|
}
|
@@ -748,7 +748,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
748
748
|
it 'does not expire a VM that is stopped for some time even when it is not used for debug purposes' do
|
749
749
|
with_sync_node do
|
750
750
|
mock_proxmox(
|
751
|
-
mocked_pve_nodes: [{
|
751
|
+
mocked_pve_nodes: ([{
|
752
752
|
# 2 seconds separate each run.
|
753
753
|
# Make sure the third and later runs mock the container as running instead of stopped
|
754
754
|
'pve_node_name' => {
|
@@ -765,8 +765,8 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
765
765
|
}
|
766
766
|
}
|
767
767
|
}
|
768
|
-
}] * 2 +
|
769
|
-
[{
|
768
|
+
}] * 2) +
|
769
|
+
([{
|
770
770
|
# 2 seconds separate each run.
|
771
771
|
# Make sure the third and later runs mock the container as running instead of stopped
|
772
772
|
'pve_node_name' => {
|
@@ -783,7 +783,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
783
783
|
}
|
784
784
|
}
|
785
785
|
}
|
786
|
-
}] * 2
|
786
|
+
}] * 2)
|
787
787
|
)
|
788
788
|
# Timeout for a non-debug stopped container to be considered expired is 3 seconds in tests
|
789
789
|
expect(call_reserve_proxmox_container(2, 1024, 1, max_retries: 4, wait_before_retry: 2)).to eq(error: 'not_enough_resources')
|
@@ -796,7 +796,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
796
796
|
creation_date_1 = (Time.now - 20).utc
|
797
797
|
creation_date_2 = (Time.now - 10).utc
|
798
798
|
mock_proxmox(
|
799
|
-
mocked_pve_nodes: [{
|
799
|
+
mocked_pve_nodes: ([{
|
800
800
|
# 2 seconds separate each run.
|
801
801
|
# Make sure the third and later runs mock the container as another one, still stopped
|
802
802
|
'pve_node_name' => {
|
@@ -812,8 +812,8 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
812
812
|
}
|
813
813
|
}
|
814
814
|
}
|
815
|
-
}] * 2 +
|
816
|
-
[{
|
815
|
+
}] * 2) +
|
816
|
+
([{
|
817
817
|
# 2 seconds separate each run.
|
818
818
|
# Make sure the third and later runs mock the container as another one, still stopped
|
819
819
|
'pve_node_name' => {
|
@@ -829,7 +829,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
829
829
|
}
|
830
830
|
}
|
831
831
|
}
|
832
|
-
}] * 2
|
832
|
+
}] * 2)
|
833
833
|
)
|
834
834
|
# Timeout for a non-debug stopped container to be considered expired is 3 seconds in tests
|
835
835
|
expect(call_reserve_proxmox_container(2, 1024, 1, max_retries: 4, wait_before_retry: 2)).to eq(error: 'not_enough_resources')
|
@@ -52,7 +52,7 @@ describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do
|
|
52
52
|
with_sync_node do
|
53
53
|
mock_proxmox(mocked_pve_nodes: [{ 'pve_node_name' => { error_strings: ['NOK: error code = 500'] * 5 } }])
|
54
54
|
result = call_reserve_proxmox_container(2, 1024, 4, config: { api_max_retries: 4 })
|
55
|
-
expect(result[:error]).not_to
|
55
|
+
expect(result[:error]).not_to be_nil
|
56
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\)})
|
57
57
|
expect_proxmox_actions_to_be [
|
58
58
|
[:create_ticket],
|