cfndk 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +23 -14
  3. data/.gitignore +0 -1
  4. data/.rspec_parallel +6 -0
  5. data/Gemfile +1 -0
  6. data/Gemfile.lock +811 -0
  7. data/README.md +122 -10
  8. data/cfndk.gemspec +1 -0
  9. data/lib/cfndk/change_set_command.rb +97 -0
  10. data/lib/cfndk/command.rb +15 -181
  11. data/lib/cfndk/config_file_loadable.rb +13 -0
  12. data/lib/cfndk/global_config.rb +15 -0
  13. data/lib/cfndk/key_pair.rb +7 -4
  14. data/lib/cfndk/key_pair_command.rb +53 -0
  15. data/lib/cfndk/key_pairs.rb +2 -1
  16. data/lib/cfndk/logger.rb +1 -1
  17. data/lib/cfndk/stack.rb +382 -103
  18. data/lib/cfndk/stack_command.rb +110 -0
  19. data/lib/cfndk/stacks.rb +40 -14
  20. data/lib/cfndk/subcommand_help_returnable.rb +16 -0
  21. data/lib/cfndk/version.rb +1 -1
  22. data/lib/cfndk.rb +6 -0
  23. data/skel/cfndk.yml +4 -0
  24. data/spec/cfndk_change_set_create_spec.rb +436 -0
  25. data/spec/cfndk_change_set_destroy_spec.rb +160 -0
  26. data/spec/cfndk_change_set_execute_spec.rb +179 -0
  27. data/spec/cfndk_change_set_report_spec.rb +107 -0
  28. data/spec/cfndk_change_set_spec.rb +37 -0
  29. data/spec/cfndk_create_spec.rb +56 -141
  30. data/spec/cfndk_destroy_spec.rb +4 -2
  31. data/spec/cfndk_keypiar_spec.rb +11 -9
  32. data/spec/cfndk_report_spec.rb +3 -1
  33. data/spec/cfndk_spec.rb +5 -3
  34. data/spec/cfndk_stack_create_spec.rb +454 -0
  35. data/spec/cfndk_stack_destroy_spec.rb +161 -0
  36. data/spec/cfndk_stack_report_spec.rb +181 -0
  37. data/spec/cfndk_stack_spec.rb +6 -1146
  38. data/spec/cfndk_stack_update_spec.rb +467 -0
  39. data/spec/spec_helper.rb +4 -1
  40. data/spec/support/aruba.rb +1 -0
  41. metadata +42 -2
@@ -0,0 +1,467 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe 'CFnDK', type: :aruba do
4
+ before(:each) { set_environment_variable('AWS_REGION', ENV['AWS_REGION']) }
5
+ before(:each) { set_environment_variable('AWS_PROFILE', ENV['AWS_PROFILE']) }
6
+ before(:each) { set_environment_variable('AWS_ACCESS_KEY_ID', ENV["AWS_ACCESS_KEY_ID#{ENV['TEST_ENV_NUMBER']}"]) }
7
+ before(:each) { set_environment_variable('AWS_SECRET_ACCESS_KEY', ENV["AWS_SECRET_ACCESS_KEY#{ENV['TEST_ENV_NUMBER']}"]) }
8
+ describe 'bin/cfndk' do
9
+ before(:each) { setup_aruba }
10
+ let(:file) { 'cfndk.yml' }
11
+ let(:file2) { 'cfndk2.yml' }
12
+ let(:pem) { 'test.pem' }
13
+ let(:uuid) { '38437346-c75c-47c5-83b4-d504f85e275b' }
14
+
15
+ describe 'stack' do
16
+ describe 'update', update: true do
17
+ context 'without cfndk.yml' do
18
+ before(:each) { run_command('cfndk stack update') }
19
+ it 'displays file does not exist error and status code = 1' do
20
+ aggregate_failures do
21
+ expect(last_command_started).to have_exit_status(1)
22
+ expect(last_command_started).to have_output(/ERROR RuntimeError: File does not exist./)
23
+ end
24
+ end
25
+ end
26
+
27
+ context 'with cfndk2.yml' do
28
+ yaml = <<-"YAML"
29
+ keypairs:
30
+ YAML
31
+ before(:each) { write_file(file2, yaml) }
32
+ context 'when -c cfndk2.yml and empty stacks' do
33
+ before(:each) { run_command("cfndk stack update -c=#{file2}") }
34
+ it 'displays empty stack log' do
35
+ aggregate_failures do
36
+ expect(last_command_started).to be_successfully_executed
37
+ expect(last_command_started).to have_output(/INFO update.../)
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'when --config-path cfndk2.yml and empty stacks' do
43
+ before(:each) { run_command("cfndk stack update --config-path=#{file2}") }
44
+ it 'displays empty stack log' do
45
+ aggregate_failures do
46
+ expect(last_command_started).to be_successfully_executed
47
+ expect(last_command_started).to have_output(/INFO update.../)
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ context 'with cfndk.yml' do
54
+ context 'when cfndk.yml is empty' do
55
+ before(:each) { touch(file) }
56
+ before(:each) { run_command('cfndk stack update') }
57
+ it 'displays File is empty error and status code = 1' do
58
+ aggregate_failures do
59
+ expect(last_command_started).to have_exit_status(1)
60
+ expect(last_command_started).to have_output(/ERROR File is empty./)
61
+ end
62
+ end
63
+ end
64
+ context 'when empty yaml' do
65
+ yaml = <<-"YAML"
66
+ stacks:
67
+ Test:
68
+ template_file: vpc.yaml
69
+ timeout_in_minutes: 2
70
+ YAML
71
+ before(:each) { write_file(file, yaml) }
72
+ before(:each) { copy('%/empty_resource.yaml', 'vpc.yaml') }
73
+ before(:each) { run_command('cfndk stack update') }
74
+ it 'Displays error message and status code = 1' do
75
+ aggregate_failures do
76
+ expect(last_command_started).to have_exit_status(1)
77
+ expect(last_command_started).to have_output(/INFO validate stack: Test$/)
78
+ expect(last_command_started).to have_output(/ERROR Aws::CloudFormation::Errors::ValidationError: Template format error: At least one Resources member must be defined\.$/)
79
+ end
80
+ end
81
+ end
82
+ context 'when invalid yaml' do
83
+ yaml = <<-"YAML"
84
+ stacks:
85
+ Test:
86
+ template_file: vpc.yaml
87
+ parameter_input: vpc.json
88
+ timeout_in_minutes: 2
89
+ YAML
90
+ before(:each) { write_file(file, yaml) }
91
+ before(:each) { copy('%/invalid_vpc.yaml', 'vpc.yaml') }
92
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
93
+ before(:each) { run_command('cfndk stack update') }
94
+ it 'Displays error message and status code = 1' do
95
+ aggregate_failures do
96
+ expect(last_command_started).to have_exit_status(1)
97
+ expect(last_command_started).to have_output(/INFO validate stack: Test$/)
98
+ expect(last_command_started).to have_output(/ERROR Aws::CloudFormation::Errors::ValidationError: \[\/Resources\] 'null' values are not allowed in templates$/)
99
+ end
100
+ end
101
+ end
102
+
103
+ context 'with stacks:' do
104
+ context 'without stack' do
105
+ before(:each) { write_file(file, 'stacks:') }
106
+ before(:each) { run_command('cfndk stack update') }
107
+ it do
108
+ aggregate_failures do
109
+ expect(last_command_started).to be_successfully_executed
110
+ expect(last_command_started).to have_output(/INFO update.../)
111
+ end
112
+ end
113
+ end
114
+
115
+ context 'with a stack', with_stack: true do
116
+ yaml = <<-"YAML"
117
+ stacks:
118
+ Test:
119
+ template_file: vpc.yaml
120
+ parameter_input: vpc.json
121
+ timeout_in_minutes: 2
122
+ YAML
123
+ before(:each) { write_file(file, yaml) }
124
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
125
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
126
+ context 'when stack already exist' do
127
+ context 'when same yaml' do
128
+ before(:each) { run_command_and_stop('cfndk stack create') }
129
+ before(:each) { run_command('cfndk stack update') }
130
+ it 'displays No update warn' do
131
+ aggregate_failures do
132
+ expect(last_command_started).to have_exit_status(0)
133
+ expect(last_command_started).to have_output(/INFO validate stack: Test$/)
134
+ expect(last_command_started).to have_output(/INFO updating stack: Test$/)
135
+ expect(last_command_started).to have_output(/WARN No updates are to be performed\.: Test$/)
136
+ end
137
+ end
138
+ end
139
+ context 'when different yaml' do
140
+ before(:each) { run_command_and_stop('cfndk stack create') }
141
+ before(:each) { copy('%/vpc_different.yaml', 'vpc.yaml') }
142
+ before(:each) { run_command('cfndk stack update') }
143
+ before(:each) { append_to_file('vpc.yaml', ' ' * (51200 + 1 - file_size('vpc.yaml').to_i)) }
144
+ it 'displays update log' do
145
+ aggregate_failures do
146
+ expect(last_command_started).to be_successfully_executed
147
+ expect(last_command_started).to have_output(/INFO validate stack: Test$/)
148
+ expect(last_command_started).to have_output(/INFO updating stack: Test$/)
149
+ expect(last_command_started).to have_output(/INFO updated stack: Test$/)
150
+ end
151
+ end
152
+ end
153
+ end
154
+ context 'when stack does not exist' do
155
+ before(:each) { run_command('cfndk stack update') }
156
+ it 'displays no stack error and statu code = 1' do
157
+ aggregate_failures do
158
+ expect(last_command_started).to have_exit_status(1)
159
+ expect(last_command_started).to have_output(/INFO validate stack: Test$/)
160
+ expect(last_command_started).to have_output(/INFO updating stack: Test$/)
161
+ expect(last_command_started).to have_output(/ERROR Aws::CloudFormation::Errors::ValidationError: Stack \[Test\] does not exist$/)
162
+ end
163
+ end
164
+ end
165
+ after(:each) { run_command('cfndk destroy -f') }
166
+ end
167
+ context 'with two stacks' do
168
+ yaml = <<-"YAML"
169
+ stacks:
170
+ Test:
171
+ template_file: vpc.yaml
172
+ parameter_input: vpc.json
173
+ timeout_in_minutes: 4
174
+ Test2:
175
+ template_file: sg.yaml
176
+ parameter_input: sg.json
177
+ depends:
178
+ - Test
179
+ YAML
180
+ before(:each) { write_file(file, yaml) }
181
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
182
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
183
+ before(:each) { copy('%/sg.yaml', 'sg.yaml') }
184
+ before(:each) { copy('%/sg.json', 'sg.json') }
185
+ before(:each) { run_command_and_stop('cfndk stack create') }
186
+ before(:each) { copy('%/sg_different.yaml', 'sg.yaml') }
187
+ before(:each) { run_command('cfndk stack update') }
188
+ it 'displays updated logs' do
189
+ aggregate_failures do
190
+ expect(last_command_started).to be_successfully_executed
191
+ expect(last_command_started).to have_output(/INFO validate stack: Test$/)
192
+ expect(last_command_started).to have_output(/INFO updating stack: Test$/)
193
+ expect(last_command_started).to have_output(/WARN No updates are to be performed.: Test$/)
194
+ expect(last_command_started).to have_output(/INFO validate stack: Test2$/)
195
+ expect(last_command_started).to have_output(/INFO updating stack: Test2$/)
196
+ expect(last_command_started).to have_output(/INFO updated stack: Test2$/)
197
+ end
198
+ end
199
+ after(:each) { run_command('cfndk destroy -f') }
200
+ end
201
+ context 'when cyclic dependency', dependency: true do
202
+ yaml = <<-"YAML"
203
+ stacks:
204
+ Test:
205
+ template_file: vpc.yaml
206
+ parameter_input: vpc.json
207
+ timeout_in_minutes: 2
208
+ depends:
209
+ - Test2
210
+ Test2:
211
+ template_file: sg.yaml
212
+ parameter_input: sg.json
213
+ depends:
214
+ - Test
215
+ YAML
216
+
217
+ before(:each) { write_file(file, yaml) }
218
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
219
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
220
+ before(:each) { copy('%/sg.yaml', 'sg.yaml') }
221
+ before(:each) { copy('%/sg.json', 'sg.json') }
222
+ before(:each) { run_command('cfndk stack update') }
223
+ it 'displays cyclic error log and exit status = 1' do
224
+ aggregate_failures do
225
+ expect(last_command_started).to have_exit_status(1)
226
+ expect(last_command_started).to have_output(/ERROR RuntimeError: There are cyclic dependency or stack doesn't exist. unprocessed_stack: Test,Test2$/)
227
+ end
228
+ end
229
+ after(:each) { run_command('cfndk destroy -f') }
230
+ end
231
+ context 'when requires capabilities without capabilities', capabilities: true do
232
+ yaml = <<-"YAML"
233
+ stacks:
234
+ Test:
235
+ template_file: iam.yaml
236
+ parameter_input: iam.json
237
+ capabilities:
238
+ - CAPABILITY_NAMED_IAM
239
+ timeout_in_minutes: 3
240
+ YAML
241
+ yaml2 = <<-"YAML"
242
+ stacks:
243
+ Test:
244
+ template_file: iam.yaml
245
+ parameter_input: iam.json
246
+ timeout_in_minutes: 2
247
+ YAML
248
+ before(:each) { write_file(file, yaml) }
249
+ before(:each) { copy('%/iam.yaml', 'iam.yaml') }
250
+ before(:each) { copy('%/iam.json', 'iam.json') }
251
+ before(:each) { run_command_and_stop('cfndk stack create') }
252
+ before(:each) { write_file(file, yaml2) }
253
+ before(:each) { run_command('cfndk stack update') }
254
+ it 'displays Requires capabilities log and exit status = 1' do
255
+ aggregate_failures do
256
+ expect(last_command_started).to have_exit_status(1)
257
+ expect(last_command_started).to have_output(/ERROR Aws::CloudFormation::Errors::InsufficientCapabilitiesException: Requires capabilities : \[CAPABILITY_NAMED_IAM\]/)
258
+ end
259
+ end
260
+ after(:each) { run_command('cfndk destroy -f') }
261
+ end
262
+ context 'when success with capabilities', capabilities: true do
263
+ yaml = <<-"YAML"
264
+ stacks:
265
+ Test:
266
+ template_file: iam.yaml
267
+ parameter_input: iam.json
268
+ capabilities:
269
+ - CAPABILITY_NAMED_IAM
270
+ timeout_in_minutes: 3
271
+ YAML
272
+
273
+ before(:each) { write_file(file, yaml) }
274
+ before(:each) { copy('%/iam.yaml', 'iam.yaml') }
275
+ before(:each) { copy('%/iam.json', 'iam.json') }
276
+ before(:each) { run_command_and_stop('cfndk stack create') }
277
+ before(:each) { copy('%/iam_different.json', 'iam.json') }
278
+ before(:each) { run_command('cfndk stack update') }
279
+ it 'displays updated log' do
280
+ aggregate_failures do
281
+ expect(last_command_started).to be_successfully_executed
282
+ expect(last_command_started).to have_output(/INFO updated stack: Test$/)
283
+ end
284
+ end
285
+ after(:each) { run_command('cfndk destroy -f') }
286
+ end
287
+ context 'with UUID', uuid: true do
288
+ context 'when -u 38437346-c75c-47c5-83b4-d504f85e275b' do
289
+ yaml = <<-"YAML"
290
+ stacks:
291
+ Test:
292
+ template_file: vpc.yaml
293
+ parameter_input: vpc.json
294
+ parameters:
295
+ VpcName: sample<%= append_uuid%>
296
+ timeout_in_minutes: 2
297
+ Test2:
298
+ template_file: sg.yaml
299
+ parameter_input: sg.json
300
+ parameters:
301
+ VpcName: sample<%= append_uuid%>
302
+ depends:
303
+ - Test
304
+ YAML
305
+ before(:each) { write_file(file, yaml) }
306
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
307
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
308
+ before(:each) { copy('%/sg.yaml', 'sg.yaml') }
309
+ before(:each) { copy('%/sg.json', 'sg.json') }
310
+ before(:each) { run_command_and_stop("cfndk stack create -u=#{uuid}") }
311
+ before(:each) { copy('%/vpc_different.yaml', 'vpc.yaml') }
312
+ before(:each) { copy('%/sg_different.yaml', 'sg.yaml') }
313
+ before(:each) { run_command("cfndk stack update -u=#{uuid}") }
314
+ it 'displays updated logs' do
315
+ aggregate_failures do
316
+ expect(last_command_started).to be_successfully_executed
317
+ expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
318
+ expect(last_command_started).to have_output(/INFO updating stack: Test-#{uuid}$/)
319
+ expect(last_command_started).to have_output(/INFO updated stack: Test-#{uuid}$/)
320
+ expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
321
+ expect(last_command_started).to have_output(/INFO updating stack: Test2-#{uuid}$/)
322
+ expect(last_command_started).to have_output(/INFO updated stack: Test2-#{uuid}$/)
323
+ end
324
+ end
325
+ after(:each) { run_command("cfndk destroy -f -u=#{uuid}") }
326
+ end
327
+ context 'when env CFNDK_UUID=38437346-c75c-47c5-83b4-d504f85e275b' do
328
+ before(:each) { set_environment_variable('CFNDK_UUID', uuid) }
329
+ context 'with two stacks' do
330
+ yaml = <<-"YAML"
331
+ stacks:
332
+ Test:
333
+ template_file: vpc.yaml
334
+ parameter_input: vpc.json
335
+ parameters:
336
+ VpcName: sample<%= append_uuid%>
337
+ timeout_in_minutes: 2
338
+ Test2:
339
+ template_file: sg.yaml
340
+ parameter_input: sg.json
341
+ parameters:
342
+ VpcName: sample<%= append_uuid%>
343
+ depends:
344
+ - Test
345
+ YAML
346
+ before(:each) { write_file(file, yaml) }
347
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
348
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
349
+ before(:each) { copy('%/sg.yaml', 'sg.yaml') }
350
+ before(:each) { copy('%/sg.json', 'sg.json') }
351
+ before(:each) { run_command_and_stop('cfndk stack create') }
352
+ before(:each) { copy('%/vpc_different.yaml', 'vpc.yaml') }
353
+ before(:each) { copy('%/sg_different.yaml', 'sg.yaml') }
354
+ before(:each) { run_command('cfndk stack update') }
355
+ it 'displays updated logs' do
356
+ aggregate_failures do
357
+ expect(last_command_started).to be_successfully_executed
358
+ expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
359
+ expect(last_command_started).to have_output(/INFO updating stack: Test-#{uuid}$/)
360
+ expect(last_command_started).to have_output(/INFO updated stack: Test-#{uuid}$/)
361
+ expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
362
+ expect(last_command_started).to have_output(/INFO updating stack: Test2-#{uuid}$/)
363
+ expect(last_command_started).to have_output(/INFO updated stack: Test2-#{uuid}$/)
364
+ end
365
+ end
366
+ after(:each) { run_command('cfndk destroy -f') }
367
+ end
368
+ context 'when --stack-names=Test' do
369
+ yaml = <<-"YAML"
370
+ stacks:
371
+ Test:
372
+ template_file: vpc.yaml
373
+ parameter_input: vpc.json
374
+ parameters:
375
+ VpcName: sample<%= append_uuid%>
376
+ timeout_in_minutes: 2
377
+ Test2:
378
+ template_file: sg.yaml
379
+ parameter_input: sg.json
380
+ parameters:
381
+ VpcName: sample<%= append_uuid%>
382
+ depends:
383
+ - Test
384
+ YAML
385
+ before(:each) { write_file(file, yaml) }
386
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
387
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
388
+ before(:each) { copy('%/sg.yaml', 'sg.yaml') }
389
+ before(:each) { copy('%/sg.json', 'sg.json') }
390
+ before(:each) { run_command_and_stop('cfndk stack create') }
391
+ before(:each) { copy('%/vpc_different.yaml', 'vpc.yaml') }
392
+ before(:each) { run_command('cfndk stack update --stack-names=Test') }
393
+ it 'displays updated log of Test stack' do
394
+ aggregate_failures do
395
+ expect(last_command_started).to be_successfully_executed
396
+ expect(last_command_started).to have_output(/INFO update.../)
397
+ expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
398
+ expect(last_command_started).to have_output(/INFO updating stack: Test-#{uuid}$/)
399
+ expect(last_command_started).to have_output(/INFO updated stack: Test-#{uuid}$/)
400
+ expect(last_command_started).not_to have_output(/INFO validate stack: Test2-#{uuid}$/)
401
+ expect(last_command_started).not_to have_output(/INFO updating stack: Test2-#{uuid}$/)
402
+ expect(last_command_started).not_to have_output(/INFO updated stack: Test2-#{uuid}$/)
403
+ end
404
+ end
405
+ after(:each) { run_command('cfndk destroy -f') }
406
+ end
407
+ context 'when --stack-names=Test Test2' do
408
+ yaml = <<-"YAML"
409
+ stacks:
410
+ Test:
411
+ template_file: vpc.yaml
412
+ parameter_input: vpc.json
413
+ parameters:
414
+ VpcName: sample<%= append_uuid%>
415
+ timeout_in_minutes: 2
416
+ Test2:
417
+ template_file: sg.yaml
418
+ parameter_input: sg.json
419
+ parameters:
420
+ VpcName: sample<%= append_uuid%>
421
+ depends:
422
+ - Test
423
+ Test3:
424
+ template_file: iam.yaml
425
+ parameter_input: iam.json
426
+ parameters:
427
+ WebRoleName: WebhRole<%= append_uuid%>
428
+ capabilities:
429
+ - CAPABILITY_NAMED_IAM
430
+ timeout_in_minutes: 3
431
+ YAML
432
+ before(:each) { write_file(file, yaml) }
433
+ before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
434
+ before(:each) { copy('%/vpc.json', 'vpc.json') }
435
+ before(:each) { copy('%/sg.yaml', 'sg.yaml') }
436
+ before(:each) { copy('%/sg.json', 'sg.json') }
437
+ before(:each) { copy('%/iam.yaml', 'iam.yaml') }
438
+ before(:each) { copy('%/iam.json', 'iam.json') }
439
+ before(:each) { run_command_and_stop('cfndk stack create') }
440
+ before(:each) { copy('%/vpc_different.yaml', 'vpc.yaml') }
441
+ before(:each) { copy('%/sg_different.yaml', 'sg.yaml') }
442
+ before(:each) { run_command('cfndk stack update --stack-names=Test Test2') }
443
+ it 'displays updated logs of Test1/Test2 stacks' do
444
+ aggregate_failures do
445
+ expect(last_command_started).to be_successfully_executed
446
+ expect(last_command_started).to have_output(/INFO update.../)
447
+ expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
448
+ expect(last_command_started).to have_output(/INFO updating stack: Test-#{uuid}$/)
449
+ expect(last_command_started).to have_output(/INFO updated stack: Test-#{uuid}$/)
450
+ expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
451
+ expect(last_command_started).to have_output(/INFO updating stack: Test2-#{uuid}$/)
452
+ expect(last_command_started).to have_output(/INFO updated stack: Test2-#{uuid}$/)
453
+ expect(last_command_started).not_to have_output(/INFO validate stack: Test3-#{uuid}$/)
454
+ expect(last_command_started).not_to have_output(/INFO updating stack: Test3-#{uuid}$/)
455
+ expect(last_command_started).not_to have_output(/INFO updated stack: Test3-#{uuid}$/)
456
+ end
457
+ end
458
+ after(:each) { run_command('cfndk destroy -f') }
459
+ end
460
+ end
461
+ end
462
+ end
463
+ end
464
+ end
465
+ end
466
+ end
467
+ end
data/spec/spec_helper.rb CHANGED
@@ -8,4 +8,7 @@ else
8
8
  ::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
9
9
  end
10
10
 
11
- require 'awspec'
11
+ ENV['AWS_ACCESS_KEY_ID'] = ENV["AWS_ACCESS_KEY_ID#{ENV['TEST_ENV_NUMBER']}"]
12
+ ENV['AWS_SECRET_ACCESS_KEY'] = ENV["AWS_SECRET_ACCESS_KEY#{ENV['TEST_ENV_NUMBER']}"]
13
+
14
+ require 'awspec'
@@ -2,4 +2,5 @@ require 'aruba/rspec'
2
2
 
3
3
  Aruba.configure do |config|
4
4
  config.exit_timeout = 60 * 5
5
+ config.working_directory = "tmp/aruba#{ENV['TEST_ENV_NUMBER']}"
5
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshihisa AMAKATA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: parallel_tests
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: thor
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -174,23 +188,31 @@ extra_rdoc_files: []
174
188
  files:
175
189
  - ".circleci/config.yml"
176
190
  - ".gitignore"
191
+ - ".rspec_parallel"
177
192
  - ".rubocop.yml"
178
193
  - ".simplecov"
179
194
  - Gemfile
195
+ - Gemfile.lock
180
196
  - LICENSE.txt
181
197
  - README.md
182
198
  - Rakefile
183
199
  - bin/cfndk
184
200
  - cfndk.gemspec
185
201
  - lib/cfndk.rb
202
+ - lib/cfndk/change_set_command.rb
186
203
  - lib/cfndk/command.rb
204
+ - lib/cfndk/config_file_loadable.rb
187
205
  - lib/cfndk/credential_provider_chain.rb
188
206
  - lib/cfndk/erb_string.rb
207
+ - lib/cfndk/global_config.rb
189
208
  - lib/cfndk/key_pair.rb
209
+ - lib/cfndk/key_pair_command.rb
190
210
  - lib/cfndk/key_pairs.rb
191
211
  - lib/cfndk/logger.rb
192
212
  - lib/cfndk/stack.rb
213
+ - lib/cfndk/stack_command.rb
193
214
  - lib/cfndk/stacks.rb
215
+ - lib/cfndk/subcommand_help_returnable.rb
194
216
  - lib/cfndk/version.rb
195
217
  - skel/cfndk.yml
196
218
  - skel/db/db.yaml
@@ -209,12 +231,21 @@ files:
209
231
  - skel/web/prod.json
210
232
  - skel/web/web.yaml
211
233
  - spec/.gitignore
234
+ - spec/cfndk_change_set_create_spec.rb
235
+ - spec/cfndk_change_set_destroy_spec.rb
236
+ - spec/cfndk_change_set_execute_spec.rb
237
+ - spec/cfndk_change_set_report_spec.rb
238
+ - spec/cfndk_change_set_spec.rb
212
239
  - spec/cfndk_create_spec.rb
213
240
  - spec/cfndk_destroy_spec.rb
214
241
  - spec/cfndk_keypiar_spec.rb
215
242
  - spec/cfndk_report_spec.rb
216
243
  - spec/cfndk_spec.rb
244
+ - spec/cfndk_stack_create_spec.rb
245
+ - spec/cfndk_stack_destroy_spec.rb
246
+ - spec/cfndk_stack_report_spec.rb
217
247
  - spec/cfndk_stack_spec.rb
248
+ - spec/cfndk_stack_update_spec.rb
218
249
  - spec/fixtures/empty_resource.yaml
219
250
  - spec/fixtures/iam.json
220
251
  - spec/fixtures/iam.yaml
@@ -254,12 +285,21 @@ specification_version: 4
254
285
  summary: cfndk is AWS Cloud Formation Development Kit
255
286
  test_files:
256
287
  - spec/.gitignore
288
+ - spec/cfndk_change_set_create_spec.rb
289
+ - spec/cfndk_change_set_destroy_spec.rb
290
+ - spec/cfndk_change_set_execute_spec.rb
291
+ - spec/cfndk_change_set_report_spec.rb
292
+ - spec/cfndk_change_set_spec.rb
257
293
  - spec/cfndk_create_spec.rb
258
294
  - spec/cfndk_destroy_spec.rb
259
295
  - spec/cfndk_keypiar_spec.rb
260
296
  - spec/cfndk_report_spec.rb
261
297
  - spec/cfndk_spec.rb
298
+ - spec/cfndk_stack_create_spec.rb
299
+ - spec/cfndk_stack_destroy_spec.rb
300
+ - spec/cfndk_stack_report_spec.rb
262
301
  - spec/cfndk_stack_spec.rb
302
+ - spec/cfndk_stack_update_spec.rb
263
303
  - spec/fixtures/empty_resource.yaml
264
304
  - spec/fixtures/iam.json
265
305
  - spec/fixtures/iam.yaml