cfndk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +23 -14
- data/.gitignore +0 -1
- data/.rspec_parallel +6 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +811 -0
- data/README.md +122 -10
- data/cfndk.gemspec +1 -0
- data/lib/cfndk/change_set_command.rb +97 -0
- data/lib/cfndk/command.rb +15 -181
- data/lib/cfndk/config_file_loadable.rb +13 -0
- data/lib/cfndk/global_config.rb +15 -0
- data/lib/cfndk/key_pair.rb +7 -4
- data/lib/cfndk/key_pair_command.rb +53 -0
- data/lib/cfndk/key_pairs.rb +2 -1
- data/lib/cfndk/logger.rb +1 -1
- data/lib/cfndk/stack.rb +382 -103
- data/lib/cfndk/stack_command.rb +110 -0
- data/lib/cfndk/stacks.rb +40 -14
- data/lib/cfndk/subcommand_help_returnable.rb +16 -0
- data/lib/cfndk/version.rb +1 -1
- data/lib/cfndk.rb +6 -0
- data/skel/cfndk.yml +4 -0
- data/spec/cfndk_change_set_create_spec.rb +436 -0
- data/spec/cfndk_change_set_destroy_spec.rb +160 -0
- data/spec/cfndk_change_set_execute_spec.rb +179 -0
- data/spec/cfndk_change_set_report_spec.rb +107 -0
- data/spec/cfndk_change_set_spec.rb +37 -0
- data/spec/cfndk_create_spec.rb +56 -141
- data/spec/cfndk_destroy_spec.rb +4 -2
- data/spec/cfndk_keypiar_spec.rb +11 -9
- data/spec/cfndk_report_spec.rb +3 -1
- data/spec/cfndk_spec.rb +5 -3
- data/spec/cfndk_stack_create_spec.rb +454 -0
- data/spec/cfndk_stack_destroy_spec.rb +161 -0
- data/spec/cfndk_stack_report_spec.rb +181 -0
- data/spec/cfndk_stack_spec.rb +6 -1146
- data/spec/cfndk_stack_update_spec.rb +467 -0
- data/spec/spec_helper.rb +4 -1
- data/spec/support/aruba.rb +1 -0
- metadata +42 -2
data/spec/cfndk_create_spec.rb
CHANGED
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe 'CFnDK', type: :aruba do
|
4
4
|
before(:each) { set_environment_variable('AWS_REGION', ENV['AWS_REGION']) }
|
5
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']}"]) }
|
6
8
|
describe 'bin/cfndk' do
|
7
9
|
before(:each) { setup_aruba }
|
8
10
|
let(:file) { 'cfndk.yml' }
|
@@ -16,7 +18,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
16
18
|
it 'displays file does not exist error and status code = 1' do
|
17
19
|
aggregate_failures do
|
18
20
|
expect(last_command_started).to have_exit_status(1)
|
19
|
-
expect(last_command_started).to have_output(/ERROR File does not exist./)
|
21
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: File does not exist./)
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -177,23 +179,6 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
177
179
|
end
|
178
180
|
after(:each) { run_command("cfndk destroy -u=#{uuid} -f") }
|
179
181
|
end
|
180
|
-
|
181
|
-
context 'when env CFNDK_UUID=38437346-c75c-47c5-83b4-d504f85e275b' do
|
182
|
-
before(:each) { set_environment_variable('CFNDK_UUID', uuid) }
|
183
|
-
before(:each) { run_command('cfndk create') }
|
184
|
-
it 'runs the command with the expected results' do
|
185
|
-
aggregate_failures do
|
186
|
-
expect(last_command_started).to be_successfully_executed
|
187
|
-
expect(last_command_started).to have_output(/INFO create.../)
|
188
|
-
expect(last_command_started).to have_output(/INFO creating keypair: Test-#{uuid}/)
|
189
|
-
expect(last_command_started).to have_output(/INFO created keypair: Test-#{uuid}/)
|
190
|
-
expect(last_command_started).to have_output(/create key file: test-#{uuid}.pem/)
|
191
|
-
expect("test-#{uuid}.pem").to be_an_existing_file
|
192
|
-
expect("test-#{uuid}.pem").to have_file_content(/-----END RSA PRIVATE KEY-----/)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
after(:each) { run_command('cfndk destroy -f') }
|
196
|
-
end
|
197
182
|
end
|
198
183
|
end
|
199
184
|
context 'with keypairs' do
|
@@ -204,42 +189,40 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
204
189
|
Test3:
|
205
190
|
YAML
|
206
191
|
before(:each) { write_file(file, yaml) }
|
207
|
-
context '
|
208
|
-
|
209
|
-
|
192
|
+
context 'without UUID' do
|
193
|
+
before(:each) { run_command('cfndk create') }
|
194
|
+
it do
|
195
|
+
aggregate_failures do
|
196
|
+
expect(last_command_started).to be_successfully_executed
|
197
|
+
expect(last_command_started).to have_output(/INFO create.../)
|
198
|
+
expect(last_command_started).to have_output(/INFO creating keypair: Test1/)
|
199
|
+
expect(last_command_started).to have_output(/INFO created keypair: Test1/)
|
200
|
+
expect(last_command_started).to have_output(/INFO creating keypair: Test2/)
|
201
|
+
expect(last_command_started).to have_output(/INFO created keypair: Test2/)
|
202
|
+
expect(last_command_started).to have_output(/INFO creating keypair: Test3/)
|
203
|
+
expect(last_command_started).to have_output(/INFO created keypair: Test3/)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
after(:each) { run_command('cfndk destroy -f') }
|
207
|
+
end
|
208
|
+
context 'with UUID' do
|
209
|
+
context 'when env CFNDK_UUID=38437346-c75c-47c5-83b4-d504f85e275b' do
|
210
|
+
before(:each) { set_environment_variable('CFNDK_UUID', uuid) }
|
211
|
+
before(:each) { run_command('cfndk create') }
|
210
212
|
it do
|
211
213
|
aggregate_failures do
|
212
214
|
expect(last_command_started).to be_successfully_executed
|
213
215
|
expect(last_command_started).to have_output(/INFO create.../)
|
214
|
-
expect(last_command_started).to have_output(/INFO creating keypair: Test1/)
|
215
|
-
expect(last_command_started).to have_output(/INFO created keypair: Test1/)
|
216
|
-
expect(last_command_started).
|
217
|
-
expect(last_command_started).
|
218
|
-
expect(last_command_started).to have_output(/INFO creating keypair: Test3/)
|
219
|
-
expect(last_command_started).to have_output(/INFO created keypair: Test3/)
|
216
|
+
expect(last_command_started).to have_output(/INFO creating keypair: Test1-#{uuid}/)
|
217
|
+
expect(last_command_started).to have_output(/INFO created keypair: Test1-#{uuid}/)
|
218
|
+
expect(last_command_started).to have_output(/INFO creating keypair: Test2-#{uuid}/)
|
219
|
+
expect(last_command_started).to have_output(/INFO created keypair: Test2-#{uuid}/)
|
220
|
+
expect(last_command_started).to have_output(/INFO creating keypair: Test3-#{uuid}/)
|
221
|
+
expect(last_command_started).to have_output(/INFO created keypair: Test3-#{uuid}/)
|
220
222
|
end
|
221
223
|
end
|
222
224
|
after(:each) { run_command('cfndk destroy -f') }
|
223
225
|
end
|
224
|
-
context 'with UUID' do
|
225
|
-
context 'when env CFNDK_UUID=38437346-c75c-47c5-83b4-d504f85e275b' do
|
226
|
-
before(:each) { set_environment_variable('CFNDK_UUID', uuid) }
|
227
|
-
before(:each) { run_command('cfndk create --keypair-names=Test1 Test3') }
|
228
|
-
it do
|
229
|
-
aggregate_failures do
|
230
|
-
expect(last_command_started).to be_successfully_executed
|
231
|
-
expect(last_command_started).to have_output(/INFO create.../)
|
232
|
-
expect(last_command_started).to have_output(/INFO creating keypair: Test1-#{uuid}/)
|
233
|
-
expect(last_command_started).to have_output(/INFO created keypair: Test1-#{uuid}/)
|
234
|
-
expect(last_command_started).not_to have_output(/INFO creating keypair: Test2-#{uuid}/)
|
235
|
-
expect(last_command_started).not_to have_output(/INFO created keypair: Test2-#{uuid}/)
|
236
|
-
expect(last_command_started).to have_output(/INFO creating keypair: Test3-#{uuid}/)
|
237
|
-
expect(last_command_started).to have_output(/INFO created keypair: Test3-#{uuid}/)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
after(:each) { run_command('cfndk destroy -f') }
|
241
|
-
end
|
242
|
-
end
|
243
226
|
end
|
244
227
|
end
|
245
228
|
end
|
@@ -256,7 +239,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
256
239
|
end
|
257
240
|
end
|
258
241
|
|
259
|
-
context 'with a stack' do
|
242
|
+
context 'with a stack', aaa: true do
|
260
243
|
yaml = <<-"YAML"
|
261
244
|
stacks:
|
262
245
|
Test:
|
@@ -267,7 +250,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
267
250
|
before(:each) { write_file(file, yaml) }
|
268
251
|
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
269
252
|
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
270
|
-
before(:each) {
|
253
|
+
before(:each) { run_command_and_stop('cfndk create') }
|
271
254
|
it 'displays created log and stack exist' do
|
272
255
|
aggregate_failures do
|
273
256
|
expect(last_command_started).to be_successfully_executed
|
@@ -279,6 +262,8 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
279
262
|
expect(cloudformation_stack('Test').stack_status).to eq('CREATE_COMPLETE')
|
280
263
|
expect(cloudformation_stack('Test').timeout_in_minutes).to eq(2)
|
281
264
|
expect(cloudformation_stack('Test').parameters[0].parameter_value).to eq('sample')
|
265
|
+
expect(cloudformation_stack('Test').tags[0].key).to eq('origina_name')
|
266
|
+
expect(cloudformation_stack('Test').tags[0].value).to eq('Test')
|
282
267
|
end
|
283
268
|
end
|
284
269
|
after(:each) { run_command('cfndk destroy -f') }
|
@@ -339,7 +324,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
339
324
|
it do
|
340
325
|
aggregate_failures do
|
341
326
|
expect(last_command_started).to have_exit_status(1)
|
342
|
-
expect(last_command_started).to have_output(/ERROR stopped waiting, encountered a failure state$/)
|
327
|
+
expect(last_command_started).to have_output(/ERROR Aws::Waiters::Errors::FailureStateError: stopped waiting, encountered a failure state$/)
|
343
328
|
end
|
344
329
|
end
|
345
330
|
after(:each) { run_command('cfndk destroy -f') }
|
@@ -369,7 +354,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
369
354
|
it do
|
370
355
|
aggregate_failures do
|
371
356
|
expect(last_command_started).to have_exit_status(1)
|
372
|
-
expect(last_command_started).to have_output(/ERROR There are cyclic dependency or stack doesn't exist. unprocessed_stack: Test,Test2$/)
|
357
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: There are cyclic dependency or stack doesn't exist. unprocessed_stack: Test,Test2$/)
|
373
358
|
end
|
374
359
|
end
|
375
360
|
after(:each) { run_command('cfndk destroy -f') }
|
@@ -390,7 +375,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
390
375
|
it do
|
391
376
|
aggregate_failures do
|
392
377
|
expect(last_command_started).to have_exit_status(1)
|
393
|
-
expect(last_command_started).to have_output(/ERROR Requires capabilities : \[CAPABILITY_NAMED_IAM\]/)
|
378
|
+
expect(last_command_started).to have_output(/ERROR Aws::CloudFormation::Errors::InsufficientCapabilitiesException: Requires capabilities : \[CAPABILITY_NAMED_IAM\]/)
|
394
379
|
end
|
395
380
|
end
|
396
381
|
after(:each) { run_command('cfndk destroy -f') }
|
@@ -419,7 +404,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
419
404
|
after(:each) { run_command('cfndk destroy -f') }
|
420
405
|
end
|
421
406
|
context 'with UUID', uuid: true do
|
422
|
-
context 'when -u 38437346-c75c-47c5-83b4-d504f85e275b' do
|
407
|
+
context 'when -u 38437346-c75c-47c5-83b4-d504f85e275b', aaa: true do
|
423
408
|
yaml = <<-"YAML"
|
424
409
|
stacks:
|
425
410
|
Test:
|
@@ -441,8 +426,8 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
441
426
|
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
442
427
|
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
443
428
|
before(:each) { copy('%/sg.json', 'sg.json') }
|
444
|
-
before(:each) {
|
445
|
-
it do
|
429
|
+
before(:each) { run_command_and_stop("cfndk create -u=#{uuid}") }
|
430
|
+
it 'displays created logs and stacks exist' do
|
446
431
|
aggregate_failures do
|
447
432
|
expect(last_command_started).to be_successfully_executed
|
448
433
|
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
@@ -451,6 +436,23 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
451
436
|
expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
452
437
|
expect(last_command_started).to have_output(/INFO creating stack: Test2-#{uuid}$/)
|
453
438
|
expect(last_command_started).to have_output(/INFO created stack: Test2-#{uuid}$/)
|
439
|
+
expect(cloudformation_stack("Test-#{uuid}")).to exist
|
440
|
+
expect(cloudformation_stack("Test-#{uuid}").stack_name).to eq("Test-#{uuid}")
|
441
|
+
expect(cloudformation_stack("Test-#{uuid}").stack_status).to eq('CREATE_COMPLETE')
|
442
|
+
expect(cloudformation_stack("Test-#{uuid}").timeout_in_minutes).to eq(2)
|
443
|
+
expect(cloudformation_stack("Test-#{uuid}").parameters[0].parameter_value).to eq("sample-#{uuid}")
|
444
|
+
expect(cloudformation_stack("Test-#{uuid}").tags[0].key).to eq('origina_name')
|
445
|
+
expect(cloudformation_stack("Test-#{uuid}").tags[0].value).to eq('Test')
|
446
|
+
expect(cloudformation_stack("Test-#{uuid}").tags[1].key).to eq('UUID')
|
447
|
+
expect(cloudformation_stack("Test-#{uuid}").tags[1].value).to eq(uuid)
|
448
|
+
expect(cloudformation_stack("Test2-#{uuid}")).to exist
|
449
|
+
expect(cloudformation_stack("Test2-#{uuid}").stack_name).to eq("Test2-#{uuid}")
|
450
|
+
expect(cloudformation_stack("Test2-#{uuid}").stack_status).to eq('CREATE_COMPLETE')
|
451
|
+
expect(cloudformation_stack("Test2-#{uuid}").parameters[0].parameter_value).to eq("sample-#{uuid}")
|
452
|
+
expect(cloudformation_stack("Test2-#{uuid}").tags[0].key).to eq('origina_name')
|
453
|
+
expect(cloudformation_stack("Test2-#{uuid}").tags[0].value).to eq('Test2')
|
454
|
+
expect(cloudformation_stack("Test2-#{uuid}").tags[1].key).to eq('UUID')
|
455
|
+
expect(cloudformation_stack("Test2-#{uuid}").tags[1].value).to eq(uuid)
|
454
456
|
end
|
455
457
|
end
|
456
458
|
after(:each) { run_command("cfndk destroy -f -u=#{uuid}") }
|
@@ -493,93 +495,6 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
493
495
|
end
|
494
496
|
after(:each) { run_command('cfndk destroy -f') }
|
495
497
|
end
|
496
|
-
context 'when --stack-names=Test' do
|
497
|
-
yaml = <<-"YAML"
|
498
|
-
stacks:
|
499
|
-
Test:
|
500
|
-
template_file: vpc.yaml
|
501
|
-
parameter_input: vpc.json
|
502
|
-
parameters:
|
503
|
-
VpcName: sample<%= append_uuid%>
|
504
|
-
timeout_in_minutes: 2
|
505
|
-
Test2:
|
506
|
-
template_file: sg.yaml
|
507
|
-
parameter_input: sg.json
|
508
|
-
parameters:
|
509
|
-
VpcName: sample<%= append_uuid%>
|
510
|
-
depends:
|
511
|
-
- Test
|
512
|
-
YAML
|
513
|
-
before(:each) { write_file(file, yaml) }
|
514
|
-
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
515
|
-
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
516
|
-
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
517
|
-
before(:each) { copy('%/sg.json', 'sg.json') }
|
518
|
-
before(:each) { run_command('cfndk create --stack-names=Test') }
|
519
|
-
it do
|
520
|
-
aggregate_failures do
|
521
|
-
expect(last_command_started).to be_successfully_executed
|
522
|
-
expect(last_command_started).to have_output(/INFO create.../)
|
523
|
-
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
524
|
-
expect(last_command_started).to have_output(/INFO creating stack: Test-#{uuid}$/)
|
525
|
-
expect(last_command_started).to have_output(/INFO created stack: Test-#{uuid}$/)
|
526
|
-
expect(last_command_started).not_to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
527
|
-
expect(last_command_started).not_to have_output(/INFO creating stack: Test2-#{uuid}$/)
|
528
|
-
expect(last_command_started).not_to have_output(/INFO created stack: Test2-#{uuid}$/)
|
529
|
-
end
|
530
|
-
end
|
531
|
-
after(:each) { run_command('cfndk destroy -f') }
|
532
|
-
end
|
533
|
-
context 'when --stack-names=Test Test2' do
|
534
|
-
yaml = <<-"YAML"
|
535
|
-
stacks:
|
536
|
-
Test:
|
537
|
-
template_file: vpc.yaml
|
538
|
-
parameter_input: vpc.json
|
539
|
-
parameters:
|
540
|
-
VpcName: sample<%= append_uuid%>
|
541
|
-
timeout_in_minutes: 2
|
542
|
-
Test2:
|
543
|
-
template_file: sg.yaml
|
544
|
-
parameter_input: sg.json
|
545
|
-
parameters:
|
546
|
-
VpcName: sample<%= append_uuid%>
|
547
|
-
depends:
|
548
|
-
- Test
|
549
|
-
Test3:
|
550
|
-
template_file: iam.yaml
|
551
|
-
parameter_input: iam.json
|
552
|
-
parameters:
|
553
|
-
WebRoleName: WebhRole<%= append_uuid%>
|
554
|
-
capabilities:
|
555
|
-
- CAPABILITY_NAMED_IAM
|
556
|
-
timeout_in_minutes: 3
|
557
|
-
YAML
|
558
|
-
before(:each) { write_file(file, yaml) }
|
559
|
-
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
560
|
-
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
561
|
-
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
562
|
-
before(:each) { copy('%/sg.json', 'sg.json') }
|
563
|
-
before(:each) { copy('%/iam.yaml', 'iam.yaml') }
|
564
|
-
before(:each) { copy('%/iam.json', 'iam.json') }
|
565
|
-
before(:each) { run_command('cfndk create --stack-names=Test Test2') }
|
566
|
-
it do
|
567
|
-
aggregate_failures do
|
568
|
-
expect(last_command_started).to be_successfully_executed
|
569
|
-
expect(last_command_started).to have_output(/INFO create.../)
|
570
|
-
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
571
|
-
expect(last_command_started).to have_output(/INFO creating stack: Test-#{uuid}$/)
|
572
|
-
expect(last_command_started).to have_output(/INFO created stack: Test-#{uuid}$/)
|
573
|
-
expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
574
|
-
expect(last_command_started).to have_output(/INFO creating stack: Test2-#{uuid}$/)
|
575
|
-
expect(last_command_started).to have_output(/INFO created stack: Test2-#{uuid}$/)
|
576
|
-
expect(last_command_started).not_to have_output(/INFO validate stack: Test3-#{uuid}$/)
|
577
|
-
expect(last_command_started).not_to have_output(/INFO creating stack: Test3-#{uuid}$/)
|
578
|
-
expect(last_command_started).not_to have_output(/INFO created stack: Test3-#{uuid}$/)
|
579
|
-
end
|
580
|
-
end
|
581
|
-
after(:each) { run_command('cfndk destroy -f') }
|
582
|
-
end
|
583
498
|
end
|
584
499
|
end
|
585
500
|
end
|
data/spec/cfndk_destroy_spec.rb
CHANGED
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe 'CFnDK', type: :aruba do
|
4
4
|
before(:each) { set_environment_variable('AWS_REGION', ENV['AWS_REGION']) }
|
5
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']}"]) }
|
6
8
|
describe 'bin/cfndk' do
|
7
9
|
before(:each) { setup_aruba }
|
8
10
|
let(:file) { 'cfndk.yml' }
|
@@ -16,7 +18,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
16
18
|
it 'displays file does not exist error and status code = 1' do
|
17
19
|
aggregate_failures do
|
18
20
|
expect(last_command_started).to have_exit_status(1)
|
19
|
-
expect(last_command_started).to have_output(/
|
21
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: File does not exist./)
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -134,7 +136,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
134
136
|
expect(last_command_started).to have_output(%r{Are you sure you want to destroy\? \(y/n\)})
|
135
137
|
expect(last_command_started).to have_output(/INFO deleted keypair: Test1$/)
|
136
138
|
expect(last_command_started).to have_output(/INFO deleted stack: Test$/)
|
137
|
-
expect{cloudformation_stack('Test').exist}.to raise_error(Aws::CloudFormation::Errors::ValidationError)
|
139
|
+
expect { cloudformation_stack('Test').exist }.to raise_error(Aws::CloudFormation::Errors::ValidationError)
|
138
140
|
end
|
139
141
|
end
|
140
142
|
after(:each) { run_command('cfndk destroy -f') }
|
data/spec/cfndk_keypiar_spec.rb
CHANGED
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe 'CFnDK', type: :aruba do
|
4
4
|
before(:each) { set_environment_variable('AWS_REGION', ENV['AWS_REGION']) }
|
5
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']}"]) }
|
6
8
|
describe 'bin/cfndk' do
|
7
9
|
before(:each) { setup_aruba }
|
8
10
|
let(:file) { 'cfndk.yml' }
|
@@ -37,7 +39,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
37
39
|
it 'displays file does not exist error and status code = 1' do
|
38
40
|
aggregate_failures do
|
39
41
|
expect(last_command_started).to have_exit_status(1)
|
40
|
-
expect(last_command_started).to have_output(/ERROR File does not exist./)
|
42
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: File does not exist./)
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -56,7 +58,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
59
|
-
|
61
|
+
|
60
62
|
context 'when --config-path cfndk2.yml and empty keypairs' do
|
61
63
|
before(:each) { run_command("cfndk keypair create --config-path=#{file2}") }
|
62
64
|
it 'displays empty keypair log' do
|
@@ -78,7 +80,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
78
80
|
end
|
79
81
|
end
|
80
82
|
end
|
81
|
-
|
83
|
+
|
82
84
|
context 'with keyparis:', keypairs: true do
|
83
85
|
context 'without keypair' do
|
84
86
|
before(:each) { write_file(file, 'keypairs:') }
|
@@ -118,7 +120,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
118
120
|
end
|
119
121
|
after(:each) { run_command('cfndk destroy -f') }
|
120
122
|
end
|
121
|
-
|
123
|
+
|
122
124
|
context 'with two keypairs' do
|
123
125
|
yaml = <<-"YAML"
|
124
126
|
keypairs:
|
@@ -138,7 +140,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
138
140
|
end
|
139
141
|
after(:each) { run_command('cfndk destroy -f') }
|
140
142
|
end
|
141
|
-
|
143
|
+
|
142
144
|
context 'with a keypair and a key_file' do
|
143
145
|
context 'without UUID', uuid: true do
|
144
146
|
context 'without append_uuid' do
|
@@ -162,7 +164,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
162
164
|
end
|
163
165
|
after(:each) { run_command('cfndk destroy -f') }
|
164
166
|
end
|
165
|
-
|
167
|
+
|
166
168
|
context 'with append_uuid' do
|
167
169
|
yaml = <<-"YAML"
|
168
170
|
keypairs:
|
@@ -185,7 +187,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
185
187
|
after(:each) { run_command('cfndk destroy -f') }
|
186
188
|
end
|
187
189
|
end
|
188
|
-
|
190
|
+
|
189
191
|
context 'with UUID', uuid: true do
|
190
192
|
yaml = <<-"YAML"
|
191
193
|
keypairs:
|
@@ -208,7 +210,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
208
210
|
end
|
209
211
|
after(:each) { run_command("cfndk destroy -u=#{uuid} -f") }
|
210
212
|
end
|
211
|
-
|
213
|
+
|
212
214
|
context 'when env CFNDK_UUID=38437346-c75c-47c5-83b4-d504f85e275b' do
|
213
215
|
before(:each) { set_environment_variable('CFNDK_UUID', uuid) }
|
214
216
|
before(:each) { run_command('cfndk keypair create') }
|
@@ -283,7 +285,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
283
285
|
it 'displays file does not exist error and status code = 1' do
|
284
286
|
aggregate_failures do
|
285
287
|
expect(last_command_started).to have_exit_status(1)
|
286
|
-
expect(last_command_started).to have_output(/ERROR File does not exist./)
|
288
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: File does not exist./)
|
287
289
|
end
|
288
290
|
end
|
289
291
|
end
|
data/spec/cfndk_report_spec.rb
CHANGED
@@ -4,6 +4,8 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
4
4
|
before(:each) { setup_aruba }
|
5
5
|
before(:each) { set_environment_variable('AWS_REGION', ENV['AWS_REGION']) }
|
6
6
|
before(:each) { set_environment_variable('AWS_PROFILE', ENV['AWS_PROFILE']) }
|
7
|
+
before(:each) { set_environment_variable('AWS_ACCESS_KEY_ID', ENV["AWS_ACCESS_KEY_ID#{ENV['TEST_ENV_NUMBER']}"]) }
|
8
|
+
before(:each) { set_environment_variable('AWS_SECRET_ACCESS_KEY', ENV["AWS_SECRET_ACCESS_KEY#{ENV['TEST_ENV_NUMBER']}"]) }
|
7
9
|
|
8
10
|
describe 'bin/cfndk' do
|
9
11
|
describe 'report', report: true do
|
@@ -12,7 +14,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
12
14
|
it 'displays file does not exist error and status code = 1' do
|
13
15
|
aggregate_failures do
|
14
16
|
expect(last_command_started).to have_exit_status(1)
|
15
|
-
expect(last_command_started).to have_output(/ERROR File does not exist./)
|
17
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: File does not exist./)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
data/spec/cfndk_spec.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe 'CFnDK', type: :aruba do
|
4
|
-
before(:each) {
|
5
|
-
before(:each) {
|
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']}"]) }
|
6
8
|
describe 'bin/cfndk' do
|
7
9
|
before(:each) { setup_aruba }
|
8
10
|
let(:file) { 'cfndk.yml' }
|
@@ -34,7 +36,7 @@ RSpec.describe 'CFnDK', type: :aruba do
|
|
34
36
|
it 'displays version' do
|
35
37
|
aggregate_failures do
|
36
38
|
expect(last_command_started).to be_successfully_executed
|
37
|
-
expect(last_command_started).to have_output(/0.1.
|
39
|
+
expect(last_command_started).to have_output(/0.1.1/)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|