hybrid_platforms_conductor 33.0.1 → 33.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/lib/hybrid_platforms_conductor/cmd_runner.rb +13 -11
  4. data/lib/hybrid_platforms_conductor/config.rb +1 -0
  5. data/lib/hybrid_platforms_conductor/core_extensions/cleanroom/fix_kwargs.rb +116 -0
  6. data/lib/hybrid_platforms_conductor/deployer.rb +1 -1
  7. data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +8 -2
  8. data/lib/hybrid_platforms_conductor/hpc_plugins/log/remote_fs.rb +3 -1
  9. data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +28 -32
  10. data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +1 -1
  11. data/lib/hybrid_platforms_conductor/log.rb +3 -0
  12. data/lib/hybrid_platforms_conductor/topographer.rb +2 -1
  13. data/lib/hybrid_platforms_conductor/version.rb +1 -1
  14. data/spec/hybrid_platforms_conductor_test.rb +18 -0
  15. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb +4 -2
  16. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/interactive_spec.rb +1 -1
  17. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +26 -20
  18. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/ruby_spec.rb +39 -31
  19. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/scp_spec.rb +20 -14
  20. data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions_spec.rb +60 -42
  21. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connection_spec.rb +11 -9
  22. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +66 -0
  23. data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/connections_spec.rb +33 -21
  24. data/spec/hybrid_platforms_conductor_test/api/actions_executor/logging_spec.rb +91 -81
  25. data/spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb +6 -4
  26. data/spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb +6 -0
  27. data/spec/hybrid_platforms_conductor_test/test_connector.rb +1 -0
  28. metadata +136 -135
@@ -4,7 +4,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
4
4
 
5
5
  it 'executes remote Bash code' do
6
6
  with_test_platform_for_action_plugins do
7
- test_actions_executor.execute_actions('node' => { remote_bash: 'remote_bash_cmd.bash' })
7
+ test_actions_executor.execute_actions({ 'node' => { remote_bash: 'remote_bash_cmd.bash' } })
8
8
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
9
9
  [:connectable_nodes_from, ['node']],
10
10
  [:with_connection_to, ['node'], { no_exception: true }],
@@ -32,7 +32,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
32
32
 
33
33
  it 'executes remote Bash code in several lines' do
34
34
  with_test_platform_for_action_plugins do
35
- test_actions_executor.execute_actions('node' => { remote_bash: ['bash_cmd1.bash', 'bash_cmd2.bash', 'bash_cmd3.bash'] })
35
+ test_actions_executor.execute_actions({ 'node' => { remote_bash: ['bash_cmd1.bash', 'bash_cmd2.bash', 'bash_cmd3.bash'] } })
36
36
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
37
37
  [:connectable_nodes_from, ['node']],
38
38
  [:with_connection_to, ['node'], { no_exception: true }],
@@ -43,7 +43,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
43
43
 
44
44
  it 'executes remote Bash code using the commands syntax' do
45
45
  with_test_platform_for_action_plugins do
46
- test_actions_executor.execute_actions('node' => { remote_bash: { commands: 'bash_cmd.bash' } })
46
+ test_actions_executor.execute_actions({ 'node' => { remote_bash: { commands: 'bash_cmd.bash' } } })
47
47
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
48
48
  [:connectable_nodes_from, ['node']],
49
49
  [:with_connection_to, ['node'], { no_exception: true }],
@@ -55,7 +55,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
55
55
  it 'executes remote Bash code from a file' do
56
56
  with_test_platform_for_action_plugins do |repository|
57
57
  File.write("#{repository}/commands.txt", "bash_cmd1.bash\nbash_cmd2.bash")
58
- test_actions_executor.execute_actions('node' => { remote_bash: { file: "#{repository}/commands.txt" } })
58
+ test_actions_executor.execute_actions({ 'node' => { remote_bash: { file: "#{repository}/commands.txt" } } })
59
59
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
60
60
  [:connectable_nodes_from, ['node']],
61
61
  [:with_connection_to, ['node'], { no_exception: true }],
@@ -68,10 +68,12 @@ describe HybridPlatformsConductor::ActionsExecutor do
68
68
  with_test_platform_for_action_plugins do |repository|
69
69
  File.write("#{repository}/commands.txt", "bash_cmd3.bash\nbash_cmd4.bash")
70
70
  test_actions_executor.execute_actions(
71
- 'node' => { remote_bash: {
72
- commands: ['bash_cmd1.bash', 'bash_cmd2.bash'],
73
- file: "#{repository}/commands.txt"
74
- } }
71
+ {
72
+ 'node' => { remote_bash: {
73
+ commands: ['bash_cmd1.bash', 'bash_cmd2.bash'],
74
+ file: "#{repository}/commands.txt"
75
+ } }
76
+ }
75
77
  )
76
78
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
77
79
  [:connectable_nodes_from, ['node']],
@@ -85,11 +87,13 @@ describe HybridPlatformsConductor::ActionsExecutor do
85
87
  with_test_platform_for_action_plugins do |repository|
86
88
  File.write("#{repository}/commands.txt", "bash_cmd3.bash\nbash_cmd4.bash")
87
89
  test_actions_executor.execute_actions(
88
- 'node' => { remote_bash: [
89
- 'bash_cmd1.bash',
90
- 'bash_cmd2.bash',
91
- { file: "#{repository}/commands.txt" }
92
- ] }
90
+ {
91
+ 'node' => { remote_bash: [
92
+ 'bash_cmd1.bash',
93
+ 'bash_cmd2.bash',
94
+ { file: "#{repository}/commands.txt" }
95
+ ] }
96
+ }
93
97
  )
94
98
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
95
99
  [:connectable_nodes_from, ['node']],
@@ -102,13 +106,15 @@ describe HybridPlatformsConductor::ActionsExecutor do
102
106
  it 'executes remote Bash code with environment variables set' do
103
107
  with_test_platform_for_action_plugins do
104
108
  test_actions_executor.execute_actions(
105
- 'node' => { remote_bash: {
106
- commands: 'bash_cmd.bash',
107
- env: {
108
- 'var1' => 'value1',
109
- 'var2' => 'value2'
110
- }
111
- } }
109
+ {
110
+ 'node' => { remote_bash: {
111
+ commands: 'bash_cmd.bash',
112
+ env: {
113
+ 'var1' => 'value1',
114
+ 'var2' => 'value2'
115
+ }
116
+ } }
117
+ }
112
118
  )
113
119
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
114
120
  [:connectable_nodes_from, ['node']],
@@ -7,12 +7,14 @@ describe HybridPlatformsConductor::ActionsExecutor do
7
7
  executed = false
8
8
  expect(
9
9
  test_actions_executor.execute_actions(
10
- 'node' => {
11
- ruby: proc do |stdout, stderr|
12
- stdout << 'TestStdout'
13
- stderr << 'TestStderr'
14
- executed = true
15
- end
10
+ {
11
+ 'node' => {
12
+ ruby: proc do |stdout, stderr|
13
+ stdout << 'TestStdout'
14
+ stderr << 'TestStderr'
15
+ executed = true
16
+ end
17
+ }
16
18
  }
17
19
  )['node']
18
20
  ).to eq [0, 'TestStdout', 'TestStderr']
@@ -63,13 +65,15 @@ describe HybridPlatformsConductor::ActionsExecutor do
63
65
  executed = false
64
66
  expect(
65
67
  test_actions_executor.execute_actions(
66
- 'node' => {
67
- ruby: proc do |stdout, stderr, action|
68
- expect(action.is_a?(HybridPlatformsConductor::HpcPlugins::Action::Ruby)).to eq true
69
- stdout << 'TestStdout'
70
- stderr << 'TestStderr'
71
- executed = true
72
- end
68
+ {
69
+ 'node' => {
70
+ ruby: proc do |stdout, stderr, action|
71
+ expect(action.is_a?(HybridPlatformsConductor::HpcPlugins::Action::Ruby)).to eq true
72
+ stdout << 'TestStdout'
73
+ stderr << 'TestStderr'
74
+ executed = true
75
+ end
76
+ }
73
77
  }
74
78
  )['node']
75
79
  ).to eq [0, 'TestStdout', 'TestStderr']
@@ -82,15 +86,17 @@ describe HybridPlatformsConductor::ActionsExecutor do
82
86
  executed = false
83
87
  expect(
84
88
  test_actions_executor.execute_actions(
85
- 'node' => {
86
- ruby: {
87
- code: proc do |stdout, stderr, _action, connector|
88
- expect(connector.is_a?(HybridPlatformsConductorTest::TestConnector)).to eq true
89
- stdout << 'TestStdout'
90
- stderr << 'TestStderr'
91
- executed = true
92
- end,
93
- need_remote: true
89
+ {
90
+ 'node' => {
91
+ ruby: {
92
+ code: proc do |stdout, stderr, _action, connector|
93
+ expect(connector.is_a?(HybridPlatformsConductorTest::TestConnector)).to eq true
94
+ stdout << 'TestStdout'
95
+ stderr << 'TestStderr'
96
+ executed = true
97
+ end,
98
+ need_remote: true
99
+ }
94
100
  }
95
101
  }
96
102
  )['node']
@@ -104,15 +110,17 @@ describe HybridPlatformsConductor::ActionsExecutor do
104
110
  executed = false
105
111
  expect(
106
112
  test_actions_executor.execute_actions(
107
- 'node' => {
108
- ruby: {
109
- code: proc do |stdout, stderr, _action, connector|
110
- expect(connector).to be_nil
111
- stdout << 'TestStdout'
112
- stderr << 'TestStderr'
113
- executed = true
114
- end,
115
- need_remote: false
113
+ {
114
+ 'node' => {
115
+ ruby: {
116
+ code: proc do |stdout, stderr, _action, connector|
117
+ expect(connector).to be_nil
118
+ stdout << 'TestStdout'
119
+ stderr << 'TestStderr'
120
+ executed = true
121
+ end,
122
+ need_remote: false
123
+ }
116
124
  }
117
125
  }
118
126
  )['node']
@@ -4,7 +4,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
4
4
 
5
5
  it 'executes remote SCP' do
6
6
  with_test_platform_for_action_plugins do
7
- test_actions_executor.execute_actions('node' => { scp: { 'from' => 'to' } })
7
+ test_actions_executor.execute_actions({ 'node' => { scp: { 'from' => 'to' } } })
8
8
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
9
9
  [:connectable_nodes_from, ['node']],
10
10
  [:with_connection_to, ['node'], { no_exception: true }],
@@ -33,10 +33,12 @@ describe HybridPlatformsConductor::ActionsExecutor do
33
33
  it 'executes remote SCP on several files' do
34
34
  with_test_platform_for_action_plugins do
35
35
  test_actions_executor.execute_actions(
36
- 'node' => { scp: {
37
- 'from1' => 'to1',
38
- 'from2' => 'to2'
39
- } }
36
+ {
37
+ 'node' => { scp: {
38
+ 'from1' => 'to1',
39
+ 'from2' => 'to2'
40
+ } }
41
+ }
40
42
  )
41
43
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
42
44
  [:connectable_nodes_from, ['node']],
@@ -50,10 +52,12 @@ describe HybridPlatformsConductor::ActionsExecutor do
50
52
  it 'executes remote SCP with sudo' do
51
53
  with_test_platform_for_action_plugins do
52
54
  test_actions_executor.execute_actions(
53
- 'node' => { scp: {
54
- 'from' => 'to',
55
- sudo: true
56
- } }
55
+ {
56
+ 'node' => { scp: {
57
+ 'from' => 'to',
58
+ sudo: true
59
+ } }
60
+ }
57
61
  )
58
62
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
59
63
  [:connectable_nodes_from, ['node']],
@@ -66,11 +70,13 @@ describe HybridPlatformsConductor::ActionsExecutor do
66
70
  it 'executes remote SCP with different owner and group' do
67
71
  with_test_platform_for_action_plugins do
68
72
  test_actions_executor.execute_actions(
69
- 'node' => { scp: {
70
- 'from' => 'to',
71
- owner: 'new_owner',
72
- group: 'new_group'
73
- } }
73
+ {
74
+ 'node' => { scp: {
75
+ 'from' => 'to',
76
+ owner: 'new_owner',
77
+ group: 'new_group'
78
+ } }
79
+ }
74
80
  )
75
81
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
76
82
  [:connectable_nodes_from, ['node']],
@@ -14,20 +14,20 @@ describe HybridPlatformsConductor::ActionsExecutor do
14
14
 
15
15
  it 'executes a simple action on 1 node' do
16
16
  with_test_platform_for_actions do
17
- test_actions_executor.execute_actions('node1' => { test_action: 'Action executed' })
17
+ test_actions_executor.execute_actions({ 'node1' => { test_action: 'Action executed' } })
18
18
  expect(action_executions).to eq [{ node: 'node1', message: 'Action executed' }]
19
19
  end
20
20
  end
21
21
 
22
22
  it 'fails to execute an unknown action' do
23
23
  with_test_platform_for_actions do
24
- expect { test_actions_executor.execute_actions('node1' => { unknown_action: 'Action executed' }) }.to raise_error(/Unknown action type unknown_action/)
24
+ expect { test_actions_executor.execute_actions({ 'node1' => { unknown_action: 'Action executed' } }) }.to raise_error(/Unknown action type unknown_action/)
25
25
  end
26
26
  end
27
27
 
28
28
  it 'executes a simple action on several nodes' do
29
29
  with_test_platform_for_actions do
30
- test_actions_executor.execute_actions(%w[node1 node2 node3] => { test_action: 'Action executed' })
30
+ test_actions_executor.execute_actions({ %w[node1 node2 node3] => { test_action: 'Action executed' } })
31
31
  expect(action_executions).to eq [
32
32
  { node: 'node1', message: 'Action executed' },
33
33
  { node: 'node2', message: 'Action executed' },
@@ -39,11 +39,13 @@ describe HybridPlatformsConductor::ActionsExecutor do
39
39
  it 'executes several actions on 1 node' do
40
40
  with_test_platform_for_actions do
41
41
  test_actions_executor.execute_actions(
42
- 'node1' => [
43
- { test_action: 'Action 1 executed' },
44
- { test_action: 'Action 2 executed' },
45
- { test_action: 'Action 3 executed' }
46
- ]
42
+ {
43
+ 'node1' => [
44
+ { test_action: 'Action 1 executed' },
45
+ { test_action: 'Action 2 executed' },
46
+ { test_action: 'Action 3 executed' }
47
+ ]
48
+ }
47
49
  )
48
50
  expect(action_executions).to eq [
49
51
  { node: 'node1', message: 'Action 1 executed' },
@@ -56,9 +58,11 @@ describe HybridPlatformsConductor::ActionsExecutor do
56
58
  it 'executes different actions on several nodes' do
57
59
  with_test_platform_for_actions do
58
60
  test_actions_executor.execute_actions(
59
- 'node1' => { test_action: 'Action 1 executed' },
60
- 'node2' => { test_action: 'Action 2 executed' },
61
- 'node3' => { test_action: 'Action 3 executed' }
61
+ {
62
+ 'node1' => { test_action: 'Action 1 executed' },
63
+ 'node2' => { test_action: 'Action 2 executed' },
64
+ 'node3' => { test_action: 'Action 3 executed' }
65
+ }
62
66
  )
63
67
  expect(action_executions).to eq [
64
68
  { node: 'node1', message: 'Action 1 executed' },
@@ -73,19 +77,21 @@ describe HybridPlatformsConductor::ActionsExecutor do
73
77
  actions_executed = []
74
78
  expect(
75
79
  test_actions_executor.execute_actions(
76
- 'node1' => [
77
- { ruby: proc do |stdout, stderr|
78
- stdout << 'action1_stdout '
79
- stderr << 'action1_stderr '
80
- actions_executed << 'action1'
81
- end },
82
- { bash: 'echo action2_stdout' },
83
- { ruby: proc do |stdout, stderr|
84
- stdout << 'action3_stdout'
85
- stderr << 'action3_stderr'
86
- actions_executed << 'action3'
87
- end }
88
- ]
80
+ {
81
+ 'node1' => [
82
+ { ruby: proc do |stdout, stderr|
83
+ stdout << 'action1_stdout '
84
+ stderr << 'action1_stderr '
85
+ actions_executed << 'action1'
86
+ end },
87
+ { bash: 'echo action2_stdout' },
88
+ { ruby: proc do |stdout, stderr|
89
+ stdout << 'action3_stdout'
90
+ stderr << 'action3_stderr'
91
+ actions_executed << 'action3'
92
+ end }
93
+ ]
94
+ }
89
95
  )
90
96
  ).to eq('node1' => [0, "action1_stdout action2_stdout\naction3_stdout", 'action1_stderr action3_stderr'])
91
97
  expect(actions_executed).to eq %w[action1 action3]
@@ -95,8 +101,10 @@ describe HybridPlatformsConductor::ActionsExecutor do
95
101
  it 'executes several actions on 1 node specified using different selectors' do
96
102
  with_test_platform_for_actions do
97
103
  test_actions_executor.execute_actions(
98
- 'node1' => { test_action: 'Action 1 executed' },
99
- '/node1/' => { test_action: 'Action 2 executed' }
104
+ {
105
+ 'node1' => { test_action: 'Action 1 executed' },
106
+ '/node1/' => { test_action: 'Action 2 executed' }
107
+ }
100
108
  )
101
109
  expect(action_executions).to eq [
102
110
  { node: 'node1', message: 'Action 1 executed' },
@@ -107,7 +115,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
107
115
 
108
116
  it 'fails to execute an action on an unknown node' do
109
117
  with_test_platform_for_actions do
110
- expect { test_actions_executor.execute_actions('unknown_node' => { test_action: 'Action executed' }) }.to raise_error(RuntimeError, 'Unknown nodes: unknown_node')
118
+ expect { test_actions_executor.execute_actions({ 'unknown_node' => { test_action: 'Action executed' } }) }.to raise_error(RuntimeError, 'Unknown nodes: unknown_node')
111
119
  expect(action_executions).to eq []
112
120
  end
113
121
  end
@@ -130,9 +138,11 @@ describe HybridPlatformsConductor::ActionsExecutor do
130
138
  with_test_platform_for_actions do
131
139
  expect(
132
140
  test_actions_executor.execute_actions(
133
- 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
134
- 'node2' => { test_action: { code: proc { raise HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command returned 1' } } },
135
- 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
141
+ {
142
+ 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
143
+ 'node2' => { test_action: { code: proc { raise HybridPlatformsConductor::CmdRunner::UnexpectedExitCodeError, 'Command returned 1' } } },
144
+ 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
145
+ }
136
146
  )
137
147
  ).to eq(
138
148
  'node1' => [0, 'Action 1', ''],
@@ -146,9 +156,11 @@ describe HybridPlatformsConductor::ActionsExecutor do
146
156
  with_test_platform_for_actions do
147
157
  expect(
148
158
  test_actions_executor.execute_actions(
149
- 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
150
- 'node2' => { test_action: { code: proc { raise HybridPlatformsConductor::CmdRunner::TimeoutError } } },
151
- 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
159
+ {
160
+ 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
161
+ 'node2' => { test_action: { code: proc { raise HybridPlatformsConductor::CmdRunner::TimeoutError } } },
162
+ 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
163
+ }
152
164
  )
153
165
  ).to eq(
154
166
  'node1' => [0, 'Action 1', ''],
@@ -162,9 +174,11 @@ describe HybridPlatformsConductor::ActionsExecutor do
162
174
  with_test_platform_for_actions do
163
175
  expect(
164
176
  test_actions_executor.execute_actions(
165
- 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
166
- 'node2' => { test_action: { code: proc { raise HybridPlatformsConductor::ActionsExecutor::ConnectionError, 'Can\'t connect' } } },
167
- 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
177
+ {
178
+ 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
179
+ 'node2' => { test_action: { code: proc { raise HybridPlatformsConductor::ActionsExecutor::ConnectionError, 'Can\'t connect' } } },
180
+ 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
181
+ }
168
182
  )
169
183
  ).to eq(
170
184
  'node1' => [0, 'Action 1', ''],
@@ -178,9 +192,11 @@ describe HybridPlatformsConductor::ActionsExecutor do
178
192
  with_test_platform_for_actions do
179
193
  expect(
180
194
  test_actions_executor.execute_actions(
181
- 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
182
- 'node2' => { test_action: { code: proc { raise 'Strange error' } } },
183
- 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
195
+ {
196
+ 'node1' => { test_action: { code: proc { |stdout| stdout << 'Action 1' } } },
197
+ 'node2' => { test_action: { code: proc { raise 'Strange error' } } },
198
+ 'node3' => { test_action: { code: proc { |stdout| stdout << 'Action 3' } } }
199
+ }
184
200
  )
185
201
  ).to eq(
186
202
  'node1' => [0, 'Action 1', ''],
@@ -195,9 +211,11 @@ describe HybridPlatformsConductor::ActionsExecutor do
195
211
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node3]
196
212
  expect(
197
213
  test_actions_executor.execute_actions(
198
- 'node1' => { test_action: { need_connector: true, code: proc { |stdout| stdout << 'Action 1' } } },
199
- 'node2' => { test_action: { need_connector: true, code: proc { |stdout| stdout << 'Action 2' } } },
200
- 'node3' => { test_action: { need_connector: true, code: proc { |stdout| stdout << 'Action 3' } } }
214
+ {
215
+ 'node1' => { test_action: { need_connector: true, code: proc { |stdout| stdout << 'Action 1' } } },
216
+ 'node2' => { test_action: { need_connector: true, code: proc { |stdout| stdout << 'Action 2' } } },
217
+ 'node3' => { test_action: { need_connector: true, code: proc { |stdout| stdout << 'Action 3' } } }
218
+ }
201
219
  )
202
220
  ).to eq(
203
221
  'node1' => [0, 'Action 1', ''],
@@ -22,7 +22,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
22
22
  it 'connects on a node before executing actions needing connection' do
23
23
  with_test_platform_for_connections do
24
24
  test_actions_executor.connector(:test_connector).accept_nodes = ['node1']
25
- test_actions_executor.execute_actions('node1' => { test_action: { need_connector: true } })
25
+ test_actions_executor.execute_actions({ 'node1' => { test_action: { need_connector: true } } })
26
26
  expect(action_executions).to eq [{ node: 'node1', message: 'Action executed' }]
27
27
  expect(test_actions_executor.connector(:test_connector).calls).to eq [
28
28
  [:connectable_nodes_from, ['node1']],
@@ -33,7 +33,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
33
33
 
34
34
  it 'returns an error when no connector can connect to the needed node' do
35
35
  with_test_platform_for_connections do
36
- expect(test_actions_executor.execute_actions('node1' => { test_action: { need_connector: true } })).to eq(
36
+ expect(test_actions_executor.execute_actions({ 'node1' => { test_action: { need_connector: true } } })).to eq(
37
37
  'node1' => [:no_connector, '', 'Unable to get a connector to node1']
38
38
  )
39
39
  end
@@ -42,7 +42,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
42
42
  it 'connects on several nodes before executing actions needing connection' do
43
43
  with_test_platform_for_connections do
44
44
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node2 node3 node4]
45
- test_actions_executor.execute_actions(%w[node1 node2 node3 node4] => { test_action: { need_connector: true } })
45
+ test_actions_executor.execute_actions({ %w[node1 node2 node3 node4] => { test_action: { need_connector: true } } })
46
46
  expect(action_executions).to eq [
47
47
  { node: 'node1', message: 'Action executed' },
48
48
  { node: 'node2', message: 'Action executed' },
@@ -60,7 +60,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
60
60
  with_test_platform_for_connections do
61
61
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node2 node3 node4]
62
62
  test_actions_executor.connector(:test_connector).connected_nodes = %w[node1 node2 node4]
63
- test_actions_executor.execute_actions(%w[node1 node2 node3 node4] => { test_action: { need_connector: true } })
63
+ test_actions_executor.execute_actions({ %w[node1 node2 node3 node4] => { test_action: { need_connector: true } } })
64
64
  expect(action_executions).to eq [
65
65
  { node: 'node1', message: 'Action executed' },
66
66
  { node: 'node2', message: 'Action executed' },
@@ -77,8 +77,10 @@ describe HybridPlatformsConductor::ActionsExecutor do
77
77
  with_test_platform_for_connections do
78
78
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node2 node3 node4]
79
79
  test_actions_executor.execute_actions(
80
- %w[node1 node3] => { test_action: { need_connector: true } },
81
- %w[node2 node4] => { test_action: { need_connector: false } }
80
+ {
81
+ %w[node1 node3] => { test_action: { need_connector: true } },
82
+ %w[node2 node4] => { test_action: { need_connector: false } }
83
+ }
82
84
  )
83
85
  expect(action_executions).to eq [
84
86
  { node: 'node1', message: 'Action executed' },
@@ -96,7 +98,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
96
98
  it 'does not ask for any connection if actions don\'t need remote' do
97
99
  with_test_platform_for_connections do
98
100
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node2 node3 node4]
99
- test_actions_executor.execute_actions(%w[node1 node2 node3 node4] => { test_action: { need_connector: false } })
101
+ test_actions_executor.execute_actions({ %w[node1 node2 node3 node4] => { test_action: { need_connector: false } } })
100
102
  expect(action_executions).to eq [
101
103
  { node: 'node1', message: 'Action executed' },
102
104
  { node: 'node2', message: 'Action executed' },
@@ -111,7 +113,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
111
113
  with_test_platform_for_connections do
112
114
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node3]
113
115
  test_actions_executor.connector(:test_connector_2).accept_nodes = %w[node2 node4]
114
- test_actions_executor.execute_actions(%w[node1 node2 node3 node4] => { test_action: { need_connector: true } })
116
+ test_actions_executor.execute_actions({ %w[node1 node2 node3 node4] => { test_action: { need_connector: true } } })
115
117
  expect(action_executions).to eq [
116
118
  { node: 'node1', message: 'Action executed' },
117
119
  { node: 'node2', message: 'Action executed' },
@@ -133,7 +135,7 @@ describe HybridPlatformsConductor::ActionsExecutor do
133
135
  with_test_platform_for_connections do
134
136
  test_actions_executor.connector(:test_connector).accept_nodes = %w[node1 node2 node3]
135
137
  test_actions_executor.connector(:test_connector_2).accept_nodes = %w[node2 node4]
136
- test_actions_executor.execute_actions(%w[node1 node2 node3 node4] => { test_action: { need_connector: true } })
138
+ test_actions_executor.execute_actions({ %w[node1 node2 node3 node4] => { test_action: { need_connector: true } } })
137
139
  expect(action_executions).to eq [
138
140
  { node: 'node1', message: 'Action executed' },
139
141
  { node: 'node2', message: 'Action executed' },