kumogata 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/kumogata/argument_parser.rb +1 -0
- data/lib/kumogata/client.rb +9 -0
- data/lib/kumogata/version.rb +1 -1
- data/spec/kumogata_create_spec.rb +249 -249
- data/spec/kumogata_delete_spec.rb +12 -12
- data/spec/kumogata_export_spec.rb +8 -8
- data/spec/kumogata_list_spec.rb +15 -15
- data/spec/kumogata_show_events_spec.rb +14 -14
- data/spec/kumogata_show_outputs_spec.rb +6 -6
- data/spec/kumogata_show_resources_spec.rb +4 -4
- data/spec/kumogata_update_spec.rb +257 -200
- data/spec/kumogata_validate_spec.rb +55 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19f66a07b454ab92e7351753a201b112702efcc7
|
4
|
+
data.tar.gz: 189130373b0ba7b733acf56ddb4cafc296ccd907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66df3ba400dcbb14e5888e3dd125406c594e514633cb6fb3329d02bd85c08c4aa4c5dcfe659392a6b3753a261326272e227a3a241beba68a6df12d6b8a5f2946
|
7
|
+
data.tar.gz: 1aa6c374292cf938e5cd2e7d29044dcdc34c0fe444c9ce3a70df1044680a902cd3c1738602eacd43b0f9794cfb6614a2b2ea4987557aa4ac699be94c3e5188e2
|
data/README.md
CHANGED
@@ -98,6 +98,7 @@ Options:
|
|
98
98
|
--skip-replace-underscore
|
99
99
|
--deletion-policy-retain
|
100
100
|
-p, --parameters KEY_VALUES
|
101
|
+
-j, --json-parameters JSON
|
101
102
|
-e, --encrypt-parameters KEYS
|
102
103
|
--encryption-password PASS
|
103
104
|
--skip-send-password
|
@@ -113,6 +114,7 @@ Options:
|
|
113
114
|
--color
|
114
115
|
--no-color
|
115
116
|
--debug
|
117
|
+
-v, --verbose
|
116
118
|
```
|
117
119
|
|
118
120
|
### KUMOGATA_OPTIONS
|
@@ -107,6 +107,7 @@ class Kumogata::ArgumentParser
|
|
107
107
|
opt.on('' , '--color') { options[:color] = true }
|
108
108
|
opt.on('' , '--no-color') { options[:color] = false }
|
109
109
|
opt.on('' , '--debug') { options[:debug] = true }
|
110
|
+
opt.on('-v', '--verbose') { options[:verbose] = true }
|
110
111
|
opt.parse!
|
111
112
|
|
112
113
|
unless (command = ARGV.shift)
|
data/lib/kumogata/client.rb
CHANGED
@@ -521,6 +521,11 @@ class Kumogata::Client
|
|
521
521
|
def build_update_options(template)
|
522
522
|
opts = {:template => template}
|
523
523
|
add_parameters(opts)
|
524
|
+
|
525
|
+
[:capabilities].each do |k|
|
526
|
+
opts[k] = @options[k] if @options[k]
|
527
|
+
end
|
528
|
+
|
524
529
|
return opts
|
525
530
|
end
|
526
531
|
|
@@ -589,6 +594,10 @@ class Kumogata::Client
|
|
589
594
|
end
|
590
595
|
|
591
596
|
Kumogata.logger.info('Template validated successfully'.green)
|
597
|
+
|
598
|
+
if @options.verbose
|
599
|
+
Kumogata.logger.info(JSON.pretty_generate(JSON.parse(result.to_json)).colorize_as(:json))
|
600
|
+
end
|
592
601
|
end
|
593
602
|
|
594
603
|
def events_for(stack)
|
data/lib/kumogata/version.rb
CHANGED
@@ -22,40 +22,40 @@ end
|
|
22
22
|
|
23
23
|
run_client(:create, :template => template) do |client, cf|
|
24
24
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
25
|
-
client.
|
26
|
-
client.
|
25
|
+
expect(client).to receive(:print_event_log).twice
|
26
|
+
expect(client).to receive(:create_event_log).once
|
27
27
|
|
28
28
|
output = make_double('output') do |obj|
|
29
|
-
obj.
|
30
|
-
obj.
|
29
|
+
expect(obj).to receive(:key) { 'AZ' }
|
30
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
31
31
|
end
|
32
32
|
|
33
33
|
resource_summary = make_double('resource_summary') do |obj|
|
34
|
-
obj.
|
35
|
-
obj.
|
36
|
-
obj.
|
37
|
-
obj.
|
38
|
-
obj.
|
39
|
-
obj.
|
34
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
35
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
36
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
37
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
38
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
39
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
40
40
|
end
|
41
41
|
|
42
42
|
stack = make_double('stack') do |obj|
|
43
|
-
obj.
|
43
|
+
expect(obj).to receive(:status).and_return(
|
44
44
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
45
45
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
46
|
-
obj.
|
47
|
-
obj.
|
48
|
-
obj.
|
46
|
+
expect(obj).to receive(:outputs) { [output] }
|
47
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
48
|
+
expect(obj).to receive(:delete)
|
49
49
|
end
|
50
50
|
|
51
51
|
stacks = make_double('stacks') do |obj|
|
52
|
-
obj.
|
52
|
+
expect(obj).to receive(:create)
|
53
53
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
54
|
-
obj.
|
54
|
+
expect(obj).to receive(:[])
|
55
55
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
56
56
|
end
|
57
57
|
|
58
|
-
cf.
|
58
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -82,23 +82,23 @@ end
|
|
82
82
|
|
83
83
|
out = run_client(:create, :template => template, :options => {:detach => true}) do |client, cf|
|
84
84
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
85
|
-
client.
|
86
|
-
client.
|
85
|
+
expect(client).not_to receive(:print_event_log)
|
86
|
+
expect(client).not_to receive(:create_event_log)
|
87
87
|
|
88
88
|
stack = make_double('stack') do |obj|
|
89
|
-
obj.
|
90
|
-
obj.
|
91
|
-
obj.
|
92
|
-
obj.
|
89
|
+
expect(obj).not_to receive(:status)
|
90
|
+
expect(obj).not_to receive(:outputs)
|
91
|
+
expect(obj).not_to receive(:resource_summaries)
|
92
|
+
expect(obj).not_to receive(:delete)
|
93
93
|
end
|
94
94
|
|
95
95
|
stacks = make_double('stacks') do |obj|
|
96
|
-
obj.
|
96
|
+
expect(obj).to receive(:create)
|
97
97
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
98
|
-
obj.
|
98
|
+
expect(obj).not_to receive(:[])
|
99
99
|
end
|
100
100
|
|
101
|
-
cf.
|
101
|
+
expect(cf).to receive(:stacks).once { stacks }
|
102
102
|
end
|
103
103
|
|
104
104
|
expect(out).to be_nil
|
@@ -148,72 +148,72 @@ end
|
|
148
148
|
|
149
149
|
run_client(:create, :template => template) do |client, cf|
|
150
150
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
151
|
-
client.
|
152
|
-
client.
|
151
|
+
expect(client).to receive(:print_event_log).twice
|
152
|
+
expect(client).to receive(:create_event_log).once
|
153
153
|
|
154
154
|
output1 = make_double('output') do |obj|
|
155
|
-
obj.
|
156
|
-
obj.
|
155
|
+
expect(obj).to receive(:key) { 'AZ' }
|
156
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
157
157
|
end
|
158
158
|
|
159
159
|
output2 = make_double('output') do |obj|
|
160
|
-
obj.
|
161
|
-
obj.
|
160
|
+
expect(obj).to receive(:key) { 'Region' }
|
161
|
+
expect(obj).to receive(:value) { 'ap-northeast-1' }
|
162
162
|
end
|
163
163
|
|
164
164
|
resource_summary = make_double('resource_summary') do |obj|
|
165
|
-
obj.
|
166
|
-
obj.
|
167
|
-
obj.
|
168
|
-
obj.
|
169
|
-
obj.
|
170
|
-
obj.
|
165
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
166
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
167
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
168
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
169
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
170
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
171
171
|
end
|
172
172
|
|
173
173
|
stack = make_double('stack') do |obj|
|
174
|
-
obj.
|
174
|
+
expect(obj).to receive(:status).and_return(
|
175
175
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
176
176
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
177
|
-
obj.
|
178
|
-
obj.
|
179
|
-
obj.
|
177
|
+
expect(obj).to receive(:outputs) { [output1, output2] }
|
178
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
179
|
+
expect(obj).to receive(:delete)
|
180
180
|
end
|
181
181
|
|
182
182
|
stacks = make_double('stacks') do |obj|
|
183
|
-
obj.
|
183
|
+
expect(obj).to receive(:create)
|
184
184
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
185
|
-
obj.
|
185
|
+
expect(obj).to receive(:[])
|
186
186
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
187
187
|
end
|
188
188
|
|
189
|
-
cf.
|
189
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
190
190
|
|
191
|
-
process_status1 = make_double('process_status1') {|obj| obj.
|
192
|
-
process_status2 = make_double('process_status2') {|obj| obj.
|
191
|
+
process_status1 = make_double('process_status1') {|obj| expect(obj).to receive(:to_i).and_return(0) }
|
192
|
+
process_status2 = make_double('process_status2') {|obj| expect(obj).to receive(:to_i).and_return(0) }
|
193
193
|
|
194
|
-
client.instance_variable_get(:@post_processing)
|
195
|
-
.
|
194
|
+
expect(client.instance_variable_get(:@post_processing))
|
195
|
+
.to receive(:run_shell_command)
|
196
196
|
.with(" echo <%= Key \"AZ\" %>\n echo <%= Key \"Region\" %>\n", {"AZ"=>"ap-northeast-1b", "Region"=>"ap-northeast-1"})
|
197
197
|
.and_return(["ap-northeast-1b\nap-northeast-1\n", "", process_status1])
|
198
|
-
client.instance_variable_get(:@post_processing)
|
199
|
-
.
|
198
|
+
expect(client.instance_variable_get(:@post_processing))
|
199
|
+
.to receive(:run_shell_command)
|
200
200
|
.with(" echo <%= Key \"Region\" %>\n echo <%= Key \"AZ\" %>\n", {"AZ"=>"ap-northeast-1b", "Region"=>"ap-northeast-1"})
|
201
201
|
.and_return(["ap-northeast-1\nap-northeast-1b\n", "", process_status2])
|
202
202
|
|
203
|
-
client.instance_variable_get(:@post_processing)
|
204
|
-
.
|
205
|
-
client.instance_variable_get(:@post_processing)
|
206
|
-
.
|
203
|
+
expect(client.instance_variable_get(:@post_processing))
|
204
|
+
.to receive(:print_command).with('command_a')
|
205
|
+
expect(client.instance_variable_get(:@post_processing))
|
206
|
+
.to receive(:print_command).with('command_b')
|
207
207
|
|
208
|
-
client.instance_variable_get(:@post_processing)
|
209
|
-
.
|
208
|
+
expect(client.instance_variable_get(:@post_processing))
|
209
|
+
.to receive(:print_command_result)
|
210
210
|
.with("ap-northeast-1b\nap-northeast-1\n", "", process_status1)
|
211
|
-
client.instance_variable_get(:@post_processing)
|
212
|
-
.
|
211
|
+
expect(client.instance_variable_get(:@post_processing))
|
212
|
+
.to receive(:print_command_result)
|
213
213
|
.with("ap-northeast-1\nap-northeast-1b\n", "", process_status2)
|
214
214
|
|
215
|
-
client.instance_variable_get(:@post_processing)
|
216
|
-
.
|
215
|
+
expect(client.instance_variable_get(:@post_processing))
|
216
|
+
.to receive(:save_command_results)
|
217
217
|
.with([{'command_a' => {'ExitStatus' => 0, 'StdOut' => "ap-northeast-1b\nap-northeast-1\n", 'StdErr' => ""}},
|
218
218
|
{'command_b' => {'ExitStatus' => 0, 'StdOut' => "ap-northeast-1\nap-northeast-1b\n", 'StdErr' => ""}}])
|
219
219
|
end
|
@@ -254,55 +254,55 @@ end
|
|
254
254
|
|
255
255
|
run_client(:create, :template => template) do |client, cf|
|
256
256
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
257
|
-
client.
|
258
|
-
client.
|
257
|
+
expect(client).to receive(:print_event_log).twice
|
258
|
+
expect(client).to receive(:create_event_log).once
|
259
259
|
|
260
260
|
output = make_double('output') do |obj|
|
261
|
-
obj.
|
262
|
-
obj.
|
261
|
+
expect(obj).to receive(:key) { 'PublicIp' }
|
262
|
+
expect(obj).to receive(:value) { '127.0.0.1' }
|
263
263
|
end
|
264
264
|
|
265
265
|
resource_summary = make_double('resource_summary') do |obj|
|
266
|
-
obj.
|
267
|
-
obj.
|
268
|
-
obj.
|
269
|
-
obj.
|
270
|
-
obj.
|
271
|
-
obj.
|
266
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
267
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
268
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
269
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
270
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
271
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
272
272
|
end
|
273
273
|
|
274
274
|
stack = make_double('stack') do |obj|
|
275
|
-
obj.
|
275
|
+
expect(obj).to receive(:status).and_return(
|
276
276
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
277
277
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
278
|
-
obj.
|
279
|
-
obj.
|
280
|
-
obj.
|
278
|
+
expect(obj).to receive(:outputs) { [output] }
|
279
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
280
|
+
expect(obj).to receive(:delete)
|
281
281
|
end
|
282
282
|
|
283
283
|
stacks = make_double('stacks') do |obj|
|
284
|
-
obj.
|
284
|
+
expect(obj).to receive(:create)
|
285
285
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
286
|
-
obj.
|
286
|
+
expect(obj).to receive(:[])
|
287
287
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
288
288
|
end
|
289
289
|
|
290
|
-
cf.
|
290
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
291
291
|
|
292
|
-
client.instance_variable_get(:@post_processing)
|
293
|
-
.
|
292
|
+
expect(client.instance_variable_get(:@post_processing))
|
293
|
+
.to receive(:run_ssh_command)
|
294
294
|
.with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user", "request_pty"=>true}, " ls\n", {"PublicIp"=>"127.0.0.1"})
|
295
295
|
.and_return(["file1\nfile2\n", "", 0])
|
296
296
|
|
297
|
-
client.instance_variable_get(:@post_processing)
|
298
|
-
.
|
297
|
+
expect(client.instance_variable_get(:@post_processing))
|
298
|
+
.to receive(:print_command).with('ssh_command')
|
299
299
|
|
300
|
-
client.instance_variable_get(:@post_processing)
|
301
|
-
.
|
300
|
+
expect(client.instance_variable_get(:@post_processing))
|
301
|
+
.to receive(:print_command_result)
|
302
302
|
.with("file1\nfile2\n", "", 0)
|
303
303
|
|
304
|
-
client.instance_variable_get(:@post_processing)
|
305
|
-
.
|
304
|
+
expect(client.instance_variable_get(:@post_processing))
|
305
|
+
.to receive(:save_command_results)
|
306
306
|
.with([{'ssh_command' => {'ExitStatus' => 0, 'StdOut' => "file1\nfile2\n", 'StdErr' => ""}}])
|
307
307
|
end
|
308
308
|
end
|
@@ -346,55 +346,55 @@ end
|
|
346
346
|
|
347
347
|
run_client(:create, :template => template) do |client, cf|
|
348
348
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
349
|
-
client.
|
350
|
-
client.
|
349
|
+
expect(client).to receive(:print_event_log).twice
|
350
|
+
expect(client).to receive(:create_event_log).once
|
351
351
|
|
352
352
|
output = make_double('output') do |obj|
|
353
|
-
obj.
|
354
|
-
obj.
|
353
|
+
expect(obj).to receive(:key) { 'PublicIp' }
|
354
|
+
expect(obj).to receive(:value) { '127.0.0.1' }
|
355
355
|
end
|
356
356
|
|
357
357
|
resource_summary = make_double('resource_summary') do |obj|
|
358
|
-
obj.
|
359
|
-
obj.
|
360
|
-
obj.
|
361
|
-
obj.
|
362
|
-
obj.
|
363
|
-
obj.
|
358
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
359
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
360
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
361
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
362
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
363
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
364
364
|
end
|
365
365
|
|
366
366
|
stack = make_double('stack') do |obj|
|
367
|
-
obj.
|
367
|
+
expect(obj).to receive(:status).and_return(
|
368
368
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
369
369
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
370
|
-
obj.
|
371
|
-
obj.
|
372
|
-
obj.
|
370
|
+
expect(obj).to receive(:outputs) { [output] }
|
371
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
372
|
+
expect(obj).to receive(:delete)
|
373
373
|
end
|
374
374
|
|
375
375
|
stacks = make_double('stacks') do |obj|
|
376
|
-
obj.
|
376
|
+
expect(obj).to receive(:create)
|
377
377
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
378
|
-
obj.
|
378
|
+
expect(obj).to receive(:[])
|
379
379
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
380
380
|
end
|
381
381
|
|
382
|
-
cf.
|
382
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
383
383
|
|
384
|
-
client.instance_variable_get(:@post_processing)
|
385
|
-
.
|
384
|
+
expect(client.instance_variable_get(:@post_processing))
|
385
|
+
.to receive(:run_ssh_command)
|
386
386
|
.with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user", "request_pty"=>true}, " ls\n", {"PublicIp"=>"127.0.0.1", "MyOutput"=>100})
|
387
387
|
.and_return(["file1\nfile2\n", "", 0])
|
388
388
|
|
389
|
-
client.instance_variable_get(:@post_processing)
|
390
|
-
.
|
389
|
+
expect(client.instance_variable_get(:@post_processing))
|
390
|
+
.to receive(:print_command).with('ssh_command')
|
391
391
|
|
392
|
-
client.instance_variable_get(:@post_processing)
|
393
|
-
.
|
392
|
+
expect(client.instance_variable_get(:@post_processing))
|
393
|
+
.to receive(:print_command_result)
|
394
394
|
.with("file1\nfile2\n", "", 0)
|
395
395
|
|
396
|
-
client.instance_variable_get(:@post_processing)
|
397
|
-
.
|
396
|
+
expect(client.instance_variable_get(:@post_processing))
|
397
|
+
.to receive(:save_command_results)
|
398
398
|
.with([{'ssh_command' => {'ExitStatus' => 0, 'StdOut' => "file1\nfile2\n", 'StdErr' => ""}}])
|
399
399
|
end
|
400
400
|
end
|
@@ -445,72 +445,72 @@ end
|
|
445
445
|
|
446
446
|
run_client(:create, :template => template) do |client, cf|
|
447
447
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
448
|
-
client.
|
449
|
-
client.
|
448
|
+
expect(client).to receive(:print_event_log).twice
|
449
|
+
expect(client).to receive(:create_event_log).once
|
450
450
|
|
451
451
|
output1 = make_double('output') do |obj|
|
452
|
-
obj.
|
453
|
-
obj.
|
452
|
+
expect(obj).to receive(:key) { 'AZ' }
|
453
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
454
454
|
end
|
455
455
|
|
456
456
|
output2 = make_double('output') do |obj|
|
457
|
-
obj.
|
458
|
-
obj.
|
457
|
+
expect(obj).to receive(:key) { 'Region' }
|
458
|
+
expect(obj).to receive(:value) { 'ap-northeast-1' }
|
459
459
|
end
|
460
460
|
|
461
461
|
resource_summary = make_double('resource_summary') do |obj|
|
462
|
-
obj.
|
463
|
-
obj.
|
464
|
-
obj.
|
465
|
-
obj.
|
466
|
-
obj.
|
467
|
-
obj.
|
462
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
463
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
464
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
465
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
466
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
467
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
468
468
|
end
|
469
469
|
|
470
470
|
stack = make_double('stack') do |obj|
|
471
|
-
obj.
|
471
|
+
expect(obj).to receive(:status).and_return(
|
472
472
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
473
473
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
474
|
-
obj.
|
475
|
-
obj.
|
476
|
-
obj.
|
474
|
+
expect(obj).to receive(:outputs) { [output1, output2] }
|
475
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
476
|
+
expect(obj).to receive(:delete)
|
477
477
|
end
|
478
478
|
|
479
479
|
stacks = make_double('stacks') do |obj|
|
480
|
-
obj.
|
480
|
+
expect(obj).to receive(:create)
|
481
481
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
482
|
-
obj.
|
482
|
+
expect(obj).to receive(:[])
|
483
483
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
484
484
|
end
|
485
485
|
|
486
|
-
cf.
|
486
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
487
487
|
|
488
|
-
process_status1 = make_double('process_status1') {|obj| obj.
|
489
|
-
process_status2 = make_double('process_status2') {|obj| obj.
|
488
|
+
process_status1 = make_double('process_status1') {|obj| expect(obj).to receive(:to_i).and_return(0) }
|
489
|
+
process_status2 = make_double('process_status2') {|obj| expect(obj).to receive(:to_i).and_return(0) }
|
490
490
|
|
491
|
-
client.instance_variable_get(:@post_processing)
|
492
|
-
.
|
491
|
+
expect(client.instance_variable_get(:@post_processing))
|
492
|
+
.to receive(:run_shell_command)
|
493
493
|
.with(" echo <%= Key \"AZ\" %>\n echo <%= Key \"Region\" %>\n", {"AZ"=>"ap-northeast-1b", "Region"=>"ap-northeast-1"})
|
494
494
|
.and_return(["ap-northeast-1b\nap-northeast-1\n", "", process_status1])
|
495
|
-
client.instance_variable_get(:@post_processing)
|
496
|
-
.
|
495
|
+
expect(client.instance_variable_get(:@post_processing))
|
496
|
+
.to receive(:run_shell_command)
|
497
497
|
.with(" echo <%= Key \"Region\" %>\n echo <%= Key \"AZ\" %>\n", {"AZ"=>"ap-northeast-1b", "Region"=>"ap-northeast-1"})
|
498
498
|
.and_return(["ap-northeast-1\nap-northeast-1b\n", "", process_status2])
|
499
499
|
|
500
|
-
client.instance_variable_get(:@post_processing)
|
501
|
-
.
|
502
|
-
client.instance_variable_get(:@post_processing)
|
503
|
-
.
|
500
|
+
expect(client.instance_variable_get(:@post_processing))
|
501
|
+
.to receive(:print_command).with('command_a')
|
502
|
+
expect(client.instance_variable_get(:@post_processing))
|
503
|
+
.to receive(:print_command).with('command_b')
|
504
504
|
|
505
|
-
client.instance_variable_get(:@post_processing)
|
506
|
-
.
|
505
|
+
expect(client.instance_variable_get(:@post_processing))
|
506
|
+
.to receive(:print_command_result)
|
507
507
|
.with("ap-northeast-1b\nap-northeast-1\n", "", process_status1)
|
508
|
-
client.instance_variable_get(:@post_processing)
|
509
|
-
.
|
508
|
+
expect(client.instance_variable_get(:@post_processing))
|
509
|
+
.to receive(:print_command_result)
|
510
510
|
.with("ap-northeast-1\nap-northeast-1b\n", "", process_status2)
|
511
511
|
|
512
|
-
client.instance_variable_get(:@post_processing)
|
513
|
-
.
|
512
|
+
expect(client.instance_variable_get(:@post_processing))
|
513
|
+
.to receive(:save_command_results)
|
514
514
|
.with([{'command_a' => {'ExitStatus' => 0, 'StdOut' => "ap-northeast-1b\nap-northeast-1\n", 'StdErr' => ""}},
|
515
515
|
{'command_b' => {'ExitStatus' => 0, 'StdOut' => "ap-northeast-1\nap-northeast-1b\n", 'StdErr' => ""}}])
|
516
516
|
end
|
@@ -562,53 +562,53 @@ end
|
|
562
562
|
|
563
563
|
run_client(:create, :template => template) do |client, cf|
|
564
564
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
565
|
-
client.
|
566
|
-
client.
|
565
|
+
expect(client).to receive(:print_event_log).twice
|
566
|
+
expect(client).to receive(:create_event_log).once
|
567
567
|
|
568
568
|
output1 = make_double('output') do |obj|
|
569
|
-
obj.
|
570
|
-
obj.
|
569
|
+
expect(obj).to receive(:key) { 'AZ' }
|
570
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
571
571
|
end
|
572
572
|
|
573
573
|
output2 = make_double('output') do |obj|
|
574
|
-
obj.
|
575
|
-
obj.
|
574
|
+
expect(obj).to receive(:key) { 'Region' }
|
575
|
+
expect(obj).to receive(:value) { 'ap-northeast-1' }
|
576
576
|
end
|
577
577
|
|
578
578
|
resource_summary = make_double('resource_summary') do |obj|
|
579
|
-
obj.
|
580
|
-
obj.
|
581
|
-
obj.
|
582
|
-
obj.
|
583
|
-
obj.
|
584
|
-
obj.
|
579
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
580
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
581
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
582
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
583
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
584
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
585
585
|
end
|
586
586
|
|
587
587
|
stack = make_double('stack') do |obj|
|
588
|
-
obj.
|
588
|
+
expect(obj).to receive(:status).and_return(
|
589
589
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
590
590
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
591
|
-
obj.
|
592
|
-
obj.
|
593
|
-
obj.
|
591
|
+
expect(obj).to receive(:outputs) { [output1, output2] }
|
592
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
593
|
+
expect(obj).to receive(:delete)
|
594
594
|
end
|
595
595
|
|
596
596
|
stacks = make_double('stacks') do |obj|
|
597
|
-
obj.
|
597
|
+
expect(obj).to receive(:create)
|
598
598
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
599
|
-
obj.
|
599
|
+
expect(obj).to receive(:[])
|
600
600
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
601
601
|
end
|
602
602
|
|
603
|
-
cf.
|
603
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
604
604
|
|
605
|
-
Open3.
|
605
|
+
expect(Open3).not_to receive(:capture3)
|
606
606
|
|
607
|
-
client.instance_variable_get(:@post_processing)
|
608
|
-
.
|
607
|
+
expect(client.instance_variable_get(:@post_processing))
|
608
|
+
.not_to receive(:print_command_result)
|
609
609
|
|
610
|
-
client.instance_variable_get(:@post_processing)
|
611
|
-
.
|
610
|
+
expect(client.instance_variable_get(:@post_processing))
|
611
|
+
.not_to receive(:save_command_results)
|
612
612
|
end
|
613
613
|
end
|
614
614
|
|
@@ -638,40 +638,40 @@ end
|
|
638
638
|
template = eval_template(template, :update_deletion_policy => true)
|
639
639
|
expect(template['Resources']['myEC2Instance']['DeletionPolicy']).to eq('Delete')
|
640
640
|
json = template.to_json
|
641
|
-
client.
|
642
|
-
client.
|
641
|
+
expect(client).to receive(:print_event_log).twice
|
642
|
+
expect(client).to receive(:create_event_log).once
|
643
643
|
|
644
644
|
output = make_double('output') do |obj|
|
645
|
-
obj.
|
646
|
-
obj.
|
645
|
+
expect(obj).to receive(:key) { 'AZ' }
|
646
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
647
647
|
end
|
648
648
|
|
649
649
|
resource_summary = make_double('resource_summary') do |obj|
|
650
|
-
obj.
|
651
|
-
obj.
|
652
|
-
obj.
|
653
|
-
obj.
|
654
|
-
obj.
|
655
|
-
obj.
|
650
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
651
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
652
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
653
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
654
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
655
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
656
656
|
end
|
657
657
|
|
658
658
|
stack = make_double('stack') do |obj|
|
659
|
-
obj.
|
659
|
+
expect(obj).to receive(:status).and_return(
|
660
660
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
661
661
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
662
|
-
obj.
|
663
|
-
obj.
|
664
|
-
obj.
|
662
|
+
expect(obj).to receive(:outputs) { [output] }
|
663
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
664
|
+
expect(obj).to receive(:delete)
|
665
665
|
end
|
666
666
|
|
667
667
|
stacks = make_double('stacks') do |obj|
|
668
|
-
obj.
|
668
|
+
expect(obj).to receive(:create)
|
669
669
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {}) { stack }
|
670
|
-
obj.
|
670
|
+
expect(obj).to receive(:[])
|
671
671
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
672
672
|
end
|
673
673
|
|
674
|
-
cf.
|
674
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
675
675
|
end
|
676
676
|
end
|
677
677
|
|
@@ -706,40 +706,40 @@ end
|
|
706
706
|
|
707
707
|
run_client(:create, :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}}) do |client, cf|
|
708
708
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
709
|
-
client.
|
710
|
-
client.
|
709
|
+
expect(client).to receive(:print_event_log).twice
|
710
|
+
expect(client).to receive(:create_event_log).once
|
711
711
|
|
712
712
|
output = make_double('output') do |obj|
|
713
|
-
obj.
|
714
|
-
obj.
|
713
|
+
expect(obj).to receive(:key) { 'AZ' }
|
714
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
715
715
|
end
|
716
716
|
|
717
717
|
resource_summary = make_double('resource_summary') do |obj|
|
718
|
-
obj.
|
719
|
-
obj.
|
720
|
-
obj.
|
721
|
-
obj.
|
722
|
-
obj.
|
723
|
-
obj.
|
718
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
719
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
720
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
721
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
722
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
723
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
724
724
|
end
|
725
725
|
|
726
726
|
stack = make_double('stack') do |obj|
|
727
|
-
obj.
|
727
|
+
expect(obj).to receive(:status).and_return(
|
728
728
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
729
729
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
730
|
-
obj.
|
731
|
-
obj.
|
732
|
-
obj.
|
730
|
+
expect(obj).to receive(:outputs) { [output] }
|
731
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
732
|
+
expect(obj).to receive(:delete)
|
733
733
|
end
|
734
734
|
|
735
735
|
stacks = make_double('stacks') do |obj|
|
736
|
-
obj.
|
736
|
+
expect(obj).to receive(:create)
|
737
737
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {:parameters=>{"InstanceType"=>"m1.large"}}) { stack }
|
738
|
-
obj.
|
738
|
+
expect(obj).to receive(:[])
|
739
739
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
740
740
|
end
|
741
741
|
|
742
|
-
cf.
|
742
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
743
743
|
end
|
744
744
|
end
|
745
745
|
|
@@ -766,36 +766,36 @@ end
|
|
766
766
|
|
767
767
|
run_client(:create, :arguments => ['MyStack'], :template => template) do |client, cf|
|
768
768
|
json = eval_template(template).to_json
|
769
|
-
client.
|
769
|
+
expect(client).to receive(:print_event_log).once
|
770
770
|
|
771
771
|
output = make_double('output') do |obj|
|
772
|
-
obj.
|
773
|
-
obj.
|
772
|
+
expect(obj).to receive(:key) { 'AZ' }
|
773
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
774
774
|
end
|
775
775
|
|
776
776
|
resource_summary = make_double('resource_summary') do |obj|
|
777
|
-
obj.
|
778
|
-
obj.
|
779
|
-
obj.
|
780
|
-
obj.
|
781
|
-
obj.
|
782
|
-
obj.
|
777
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
778
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
779
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
780
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
781
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
782
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
783
783
|
end
|
784
784
|
|
785
785
|
stack = make_double('stack') do |obj|
|
786
|
-
obj.
|
786
|
+
expect(obj).to receive(:status).and_return(
|
787
787
|
'CREATE_COMPLETE',
|
788
788
|
'CREATE_COMPLETE')
|
789
|
-
obj.
|
790
|
-
obj.
|
789
|
+
expect(obj).to receive(:outputs) { [output] }
|
790
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
791
791
|
end
|
792
792
|
|
793
793
|
stacks = make_double('status') do |obj|
|
794
|
-
obj.
|
794
|
+
expect(obj).to receive(:create)
|
795
795
|
.with('MyStack', json, {}) { stack }
|
796
796
|
end
|
797
797
|
|
798
|
-
cf.
|
798
|
+
expect(cf).to receive(:stacks) { stacks }
|
799
799
|
end
|
800
800
|
end
|
801
801
|
|
@@ -822,36 +822,36 @@ end
|
|
822
822
|
|
823
823
|
run_client(:create, :arguments => ['MyStack'], :template => template, :options => {:deletion_policy_retain => true}) do |client, cf|
|
824
824
|
json = eval_template(template, :update_deletion_policy => true).to_json
|
825
|
-
client.
|
825
|
+
expect(client).to receive(:print_event_log).once
|
826
826
|
|
827
827
|
output = make_double('output') do |obj|
|
828
|
-
obj.
|
829
|
-
obj.
|
828
|
+
expect(obj).to receive(:key) { 'AZ' }
|
829
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
830
830
|
end
|
831
831
|
|
832
832
|
resource_summary = make_double('resource_summary') do |obj|
|
833
|
-
obj.
|
834
|
-
obj.
|
835
|
-
obj.
|
836
|
-
obj.
|
837
|
-
obj.
|
838
|
-
obj.
|
833
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
834
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
835
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
836
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
837
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
838
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
839
839
|
end
|
840
840
|
|
841
841
|
stack = make_double('stack') do |obj|
|
842
|
-
obj.
|
842
|
+
expect(obj).to receive(:status).and_return(
|
843
843
|
'CREATE_COMPLETE',
|
844
844
|
'CREATE_COMPLETE')
|
845
|
-
obj.
|
846
|
-
obj.
|
845
|
+
expect(obj).to receive(:outputs) { [output] }
|
846
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
847
847
|
end
|
848
848
|
|
849
849
|
stacks = make_double('status') do |obj|
|
850
|
-
obj.
|
850
|
+
expect(obj).to receive(:create)
|
851
851
|
.with('MyStack', json, {}) { stack }
|
852
852
|
end
|
853
853
|
|
854
|
-
cf.
|
854
|
+
expect(cf).to receive(:stacks) { stacks }
|
855
855
|
end
|
856
856
|
end
|
857
857
|
|
@@ -912,40 +912,40 @@ end
|
|
912
912
|
|
913
913
|
run_client(:create, :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}, :encrypt_parameters => ['Password']}) do |client, cf|
|
914
914
|
json = eval_template(template, :update_deletion_policy => true, :add_encryption_password => true).to_json
|
915
|
-
client.
|
916
|
-
client.
|
915
|
+
expect(client).to receive(:print_event_log).twice
|
916
|
+
expect(client).to receive(:create_event_log).once
|
917
917
|
|
918
918
|
output = make_double('output') do |obj|
|
919
|
-
obj.
|
920
|
-
obj.
|
919
|
+
expect(obj).to receive(:key) { 'AZ' }
|
920
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
921
921
|
end
|
922
922
|
|
923
923
|
resource_summary = make_double('resource_summary') do |obj|
|
924
|
-
obj.
|
925
|
-
obj.
|
926
|
-
obj.
|
927
|
-
obj.
|
928
|
-
obj.
|
929
|
-
obj.
|
924
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
925
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
926
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
927
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'CREATE_COMPLETE' }
|
928
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
929
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
930
930
|
end
|
931
931
|
|
932
932
|
stack = make_double('stack') do |obj|
|
933
|
-
obj.
|
933
|
+
expect(obj).to receive(:status).and_return(
|
934
934
|
'CREATE_COMPLETE', 'CREATE_COMPLETE',
|
935
935
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
936
|
-
obj.
|
937
|
-
obj.
|
938
|
-
obj.
|
936
|
+
expect(obj).to receive(:outputs) { [output] }
|
937
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
938
|
+
expect(obj).to receive(:delete)
|
939
939
|
end
|
940
940
|
|
941
941
|
stacks = make_double('stacks') do |obj|
|
942
|
-
obj.
|
942
|
+
expect(obj).to receive(:create)
|
943
943
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {:parameters=>{"InstanceType"=>"m1.large", "EncryptionPassword"=>"KioqKioqKioqKioqKioqKg=="}}) { stack }
|
944
|
-
obj.
|
944
|
+
expect(obj).to receive(:[])
|
945
945
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
946
946
|
end
|
947
947
|
|
948
|
-
cf.
|
948
|
+
expect(cf).to receive(:stacks).twice { stacks }
|
949
949
|
end
|
950
950
|
end
|
951
951
|
end
|