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
@@ -0,0 +1,181 @@
|
|
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 'report', report: true do
|
17
|
+
context 'without cfndk.yml' do
|
18
|
+
before(:each) { run_command('cfndk stack report') }
|
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 report -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 report.../)
|
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 report --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 report.../)
|
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('cfndk.yml') }
|
56
|
+
before(:each) { run_command('cfndk stack report') }
|
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
|
+
|
65
|
+
context 'with empty keypairs and stacks' do
|
66
|
+
yaml = <<-"YAML"
|
67
|
+
keypairs:
|
68
|
+
stacks:
|
69
|
+
YAML
|
70
|
+
before(:each) { write_file('cfndk.yml', yaml) }
|
71
|
+
before(:each) { run_command('cfndk stack report') }
|
72
|
+
it 'displays empty stacks and keypairs report' do
|
73
|
+
aggregate_failures do
|
74
|
+
expect(last_command_started).to be_successfully_executed
|
75
|
+
expect(last_command_started).to have_output(/INFO report.../)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'with keypairs and stacks' do
|
81
|
+
yaml = <<-"YAML"
|
82
|
+
keypairs:
|
83
|
+
Key1:
|
84
|
+
Key2:
|
85
|
+
stacks:
|
86
|
+
Test:
|
87
|
+
template_file: vpc.yaml
|
88
|
+
parameter_input: vpc.json
|
89
|
+
timeout_in_minutes: 2
|
90
|
+
Test2:
|
91
|
+
template_file: sg.yaml
|
92
|
+
parameter_input: sg.json
|
93
|
+
depends:
|
94
|
+
- Test
|
95
|
+
YAML
|
96
|
+
context 'without UUID' do
|
97
|
+
before(:each) { write_file('cfndk.yml', yaml) }
|
98
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
99
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
100
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
101
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
102
|
+
before(:each) { run_command_and_stop('cfndk create') }
|
103
|
+
context 'without option' do
|
104
|
+
before(:each) { run_command('cfndk stack report') }
|
105
|
+
it 'displays stacks report' do
|
106
|
+
aggregate_failures do
|
107
|
+
expect(last_command_started).to be_successfully_executed
|
108
|
+
expect(last_command_started).to have_output(/INFO stack: Test$/)
|
109
|
+
expect(last_command_started).to have_output(/INFO stack: Test2$/)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
context 'when --stack-names Test2' do
|
114
|
+
before(:each) { run_command('cfndk stack report --stack-names Test2') }
|
115
|
+
it 'displays stacks report' do
|
116
|
+
aggregate_failures do
|
117
|
+
expect(last_command_started).to be_successfully_executed
|
118
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test$/)
|
119
|
+
expect(last_command_started).to have_output(/INFO stack: Test2$/)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
context 'when --stack-names Test3' do
|
124
|
+
before(:each) { run_command('cfndk stack report --stack-names Test3') }
|
125
|
+
it 'displays stacks report' do
|
126
|
+
aggregate_failures do
|
127
|
+
expect(last_command_started).to be_successfully_executed
|
128
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test$/)
|
129
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test2$/)
|
130
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test3$/)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
after(:each) { run_command('cfndk destroy -f') }
|
135
|
+
end
|
136
|
+
context 'with UUID' do
|
137
|
+
before(:each) { write_file('cfndk.yml', yaml) }
|
138
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
139
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
140
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
141
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
142
|
+
before(:each) { run_command_and_stop('cfndk create -u 38437346-c75c-47c5-83b4-d504f85e275b') }
|
143
|
+
context 'without option' do
|
144
|
+
before(:each) { run_command('cfndk stack report -u 38437346-c75c-47c5-83b4-d504f85e275b') }
|
145
|
+
it 'displays stacks report' do
|
146
|
+
aggregate_failures do
|
147
|
+
expect(last_command_started).to be_successfully_executed
|
148
|
+
expect(last_command_started).to have_output(/INFO stack: Test-38437346-c75c-47c5-83b4-d504f85e275b$/)
|
149
|
+
expect(last_command_started).to have_output(/INFO stack: Test2-38437346-c75c-47c5-83b4-d504f85e275b$/)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
context 'when --stack-names Test2' do
|
154
|
+
before(:each) { run_command('cfndk stack report -u 38437346-c75c-47c5-83b4-d504f85e275b --stack-names Test2') }
|
155
|
+
it 'displays stacks report' do
|
156
|
+
aggregate_failures do
|
157
|
+
expect(last_command_started).to be_successfully_executed
|
158
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test-38437346-c75c-47c5-83b4-d504f85e275b$/)
|
159
|
+
expect(last_command_started).to have_output(/INFO stack: Test2-38437346-c75c-47c5-83b4-d504f85e275b$/)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
context 'when --stack-names Test3' do
|
164
|
+
before(:each) { run_command('cfndk stack report -u 38437346-c75c-47c5-83b4-d504f85e275b --stack-names Test3') }
|
165
|
+
it 'displays stacks report' do
|
166
|
+
aggregate_failures do
|
167
|
+
expect(last_command_started).to be_successfully_executed
|
168
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test-/)
|
169
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test2-/)
|
170
|
+
expect(last_command_started).not_to have_output(/INFO stack: Test3-/)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
after(:each) { run_command('cfndk destroy -f -u 38437346-c75c-47c5-83b4-d504f85e275b') }
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|