cfndk 0.0.7 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +79 -0
- data/.gitignore +1 -1
- data/.rspec +2 -0
- data/.rspec_parallel +6 -0
- data/.simplecov +9 -0
- data/Gemfile +11 -1
- data/Gemfile.lock +815 -0
- data/README.md +269 -76
- data/bin/cfndk +3 -18
- data/cfndk.gemspec +15 -6
- data/docker/Dockerfile +8 -0
- data/docker/build.sh +3 -0
- data/docker/cfndk.sh +14 -0
- data/lib/cfndk.rb +36 -0
- data/lib/cfndk/change_set_command.rb +103 -0
- data/lib/cfndk/command.rb +125 -119
- data/lib/cfndk/config_file_loadable.rb +13 -0
- data/lib/cfndk/credential_provider_chain.rb +12 -42
- data/lib/cfndk/credential_resolvable.rb +10 -0
- data/lib/cfndk/diff.rb +38 -0
- data/lib/cfndk/global_config.rb +46 -0
- data/lib/cfndk/key_pair.rb +66 -14
- data/lib/cfndk/key_pair_command.rb +60 -0
- data/lib/cfndk/key_pairs.rb +22 -5
- data/lib/cfndk/logger.rb +12 -3
- data/lib/cfndk/stack.rb +427 -126
- data/lib/cfndk/stack_command.rb +128 -0
- data/lib/cfndk/stacks.rb +48 -22
- data/lib/cfndk/subcommand_help_returnable.rb +16 -0
- data/lib/cfndk/template_packager.rb +210 -0
- data/lib/cfndk/uuid.rb +10 -0
- data/lib/cfndk/version.rb +1 -1
- data/skel/cfndk.yml +4 -0
- data/spec/.gitignore +1 -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 +504 -0
- data/spec/cfndk_destroy_spec.rb +148 -0
- data/spec/cfndk_keypiar_spec.rb +397 -0
- data/spec/cfndk_report_spec.rb +164 -0
- data/spec/cfndk_spec.rb +103 -0
- data/spec/cfndk_stack_create_spec.rb +814 -0
- data/spec/cfndk_stack_destroy_spec.rb +225 -0
- data/spec/cfndk_stack_report_spec.rb +181 -0
- data/spec/cfndk_stack_spec.rb +133 -0
- data/spec/cfndk_stack_update_spec.rb +553 -0
- data/spec/fixtures/big_vpc.yaml +533 -0
- data/spec/fixtures/empty_resource.yaml +2 -0
- data/spec/fixtures/iam.json +8 -0
- data/spec/fixtures/iam.yaml +38 -0
- data/spec/fixtures/iam_different.json +8 -0
- data/spec/fixtures/invalid_vpc.yaml +21 -0
- data/spec/fixtures/lambda_function/index.js +4 -0
- data/spec/fixtures/lambda_function/lambda_function.json +4 -0
- data/spec/fixtures/lambda_function/lambda_function.yaml +28 -0
- data/spec/fixtures/nested_stack.json +35 -0
- data/spec/fixtures/nested_stack.yaml +20 -0
- data/spec/fixtures/serverless_function/index.js +4 -0
- data/spec/fixtures/serverless_function/serverless_function.json +4 -0
- data/spec/fixtures/serverless_function/serverless_function.yaml +21 -0
- data/spec/fixtures/sg.json +8 -0
- data/spec/fixtures/sg.yaml +27 -0
- data/spec/fixtures/sg_different.yaml +22 -0
- data/spec/fixtures/stack.json +8 -0
- data/spec/fixtures/stack.template.json +39 -0
- data/spec/fixtures/stack.yaml +22 -0
- data/spec/fixtures/vpc.json +8 -0
- data/spec/fixtures/vpc.template.json +40 -0
- data/spec/fixtures/vpc.yaml +21 -0
- data/spec/fixtures/vpc_different.yaml +21 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/aruba.rb +6 -0
- data/vagrant/Vagrantfile +89 -0
- metadata +259 -31
data/lib/cfndk/uuid.rb
ADDED
data/lib/cfndk/version.rb
CHANGED
data/skel/cfndk.yml
CHANGED
data/spec/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
secrets.yml
|
@@ -0,0 +1,436 @@
|
|
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(:uuid) { '38437346-c75c-47c5-83b4-d504f85e275b' }
|
13
|
+
let(:change_set_uuid) { '38437346-c75c-47c5-83b4-d504f85e27ca' }
|
14
|
+
|
15
|
+
describe 'changeset' do
|
16
|
+
describe 'create', create: true do
|
17
|
+
context 'without cfndk.yml' do
|
18
|
+
before(:each) { run_command('cfndk changeset create') }
|
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 changeset create -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 create.../)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'with cfndk.yml' do
|
44
|
+
context 'when cfndk.yml is empty' do
|
45
|
+
before(:each) { touch(file) }
|
46
|
+
before(:each) { run_command('cfndk changeset create') }
|
47
|
+
it 'displays File is empty error and status code = 1' do
|
48
|
+
aggregate_failures do
|
49
|
+
expect(last_command_started).to have_exit_status(1)
|
50
|
+
expect(last_command_started).to have_output(/ERROR File is empty./)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'with stacks:' do
|
56
|
+
context 'without stack' do
|
57
|
+
before(:each) { write_file(file, 'stacks:') }
|
58
|
+
before(:each) { run_command('cfndk changeset create') }
|
59
|
+
it 'displays create log' do
|
60
|
+
aggregate_failures do
|
61
|
+
expect(last_command_started).to be_successfully_executed
|
62
|
+
expect(last_command_started).to have_output(/INFO create.../)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'with a stack' do
|
68
|
+
yaml = <<-"YAML"
|
69
|
+
stacks:
|
70
|
+
Test:
|
71
|
+
template_file: vpc.yaml
|
72
|
+
parameter_input: vpc.json
|
73
|
+
timeout_in_minutes: 2
|
74
|
+
YAML
|
75
|
+
before(:each) { write_file(file, yaml) }
|
76
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
77
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
78
|
+
before(:each) { append_to_file('vpc.yaml', ' ' * (51200 + 1 - file_size('vpc.yaml').to_i)) }
|
79
|
+
before(:each) { run_command('cfndk changeset create') }
|
80
|
+
it 'displays created log' do
|
81
|
+
aggregate_failures do
|
82
|
+
expect(last_command_started).to be_successfully_executed
|
83
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test$/)
|
84
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
85
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
after(:each) { run_command('cfndk destroy -f') }
|
89
|
+
end
|
90
|
+
context 'with two stacks' do
|
91
|
+
yaml = <<-"YAML"
|
92
|
+
stacks:
|
93
|
+
Test:
|
94
|
+
template_file: vpc.yaml
|
95
|
+
parameter_input: vpc.json
|
96
|
+
timeout_in_minutes: 2
|
97
|
+
Test2:
|
98
|
+
template_file: sg.yaml
|
99
|
+
parameter_input: sg.json
|
100
|
+
depends:
|
101
|
+
- Test
|
102
|
+
YAML
|
103
|
+
|
104
|
+
before(:each) { write_file(file, yaml) }
|
105
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
106
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
107
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
108
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
109
|
+
before(:each) { run_command('cfndk changeset create') }
|
110
|
+
it 'displays created logs' do
|
111
|
+
aggregate_failures do
|
112
|
+
expect(last_command_started).to be_successfully_executed
|
113
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test$/)
|
114
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
115
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
116
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test2$/)
|
117
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test2$/)
|
118
|
+
expect(last_command_started).to have_output(/INFO created change set: Test2$/)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
after(:each) { run_command('cfndk destroy -f') }
|
122
|
+
end
|
123
|
+
context 'when invalid dependency', dependency: true do
|
124
|
+
yaml = <<-"YAML"
|
125
|
+
stacks:
|
126
|
+
Test:
|
127
|
+
template_file: vpc.yaml
|
128
|
+
parameter_input: vpc.json
|
129
|
+
timeout_in_minutes: 2
|
130
|
+
depends:
|
131
|
+
- Test2
|
132
|
+
Test2:
|
133
|
+
template_file: sg.yaml
|
134
|
+
parameter_input: sg.json
|
135
|
+
YAML
|
136
|
+
|
137
|
+
before(:each) { write_file(file, 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('cfndk changeset create') }
|
143
|
+
it 'displays created logs' do
|
144
|
+
aggregate_failures do
|
145
|
+
expect(last_command_started).to be_successfully_executed
|
146
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test$/)
|
147
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
148
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
149
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test2$/)
|
150
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test2$/)
|
151
|
+
expect(last_command_started).to have_output(/INFO created change set: Test2$/)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
after(:each) { run_command('cfndk destroy -f') }
|
155
|
+
end
|
156
|
+
context 'when cyclic dependency', dependency: true do
|
157
|
+
yaml = <<-"YAML"
|
158
|
+
stacks:
|
159
|
+
Test:
|
160
|
+
template_file: vpc.yaml
|
161
|
+
parameter_input: vpc.json
|
162
|
+
timeout_in_minutes: 2
|
163
|
+
depends:
|
164
|
+
- Test2
|
165
|
+
Test2:
|
166
|
+
template_file: sg.yaml
|
167
|
+
parameter_input: sg.json
|
168
|
+
depends:
|
169
|
+
- Test
|
170
|
+
YAML
|
171
|
+
|
172
|
+
before(:each) { write_file(file, yaml) }
|
173
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
174
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
175
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
176
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
177
|
+
before(:each) { run_command('cfndk changeset create') }
|
178
|
+
it 'displays cyclic dependency error and exit code = 1' do
|
179
|
+
aggregate_failures do
|
180
|
+
expect(last_command_started).to have_exit_status(1)
|
181
|
+
expect(last_command_started).to have_output(/ERROR RuntimeError: There are cyclic dependency or stack doesn't exist. unprocessed_stack: Test,Test2$/)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
after(:each) { run_command('cfndk destroy -f') }
|
185
|
+
end
|
186
|
+
context 'when requires capabilities without capabilities', capabilities: true do
|
187
|
+
yaml = <<-"YAML"
|
188
|
+
stacks:
|
189
|
+
Test:
|
190
|
+
template_file: iam.yaml
|
191
|
+
parameter_input: iam.json
|
192
|
+
timeout_in_minutes: 2
|
193
|
+
YAML
|
194
|
+
|
195
|
+
before(:each) { write_file(file, yaml) }
|
196
|
+
before(:each) { copy('%/iam.yaml', 'iam.yaml') }
|
197
|
+
before(:each) { copy('%/iam.json', 'iam.json') }
|
198
|
+
before(:each) { run_command('cfndk changeset create') }
|
199
|
+
it 'displays Requires capabilities error and exit code = 1' do
|
200
|
+
aggregate_failures do
|
201
|
+
expect(last_command_started).to have_exit_status(1)
|
202
|
+
expect(last_command_started).to have_output(/ERROR Aws::CloudFormation::Errors::InsufficientCapabilitiesException: Requires capabilities : \[CAPABILITY_NAMED_IAM\]/)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
after(:each) { run_command('cfndk destroy -f') }
|
206
|
+
end
|
207
|
+
context 'when success with capabilities', capabilities: true do
|
208
|
+
yaml = <<-"YAML"
|
209
|
+
stacks:
|
210
|
+
Test:
|
211
|
+
template_file: iam.yaml
|
212
|
+
parameter_input: iam.json
|
213
|
+
capabilities:
|
214
|
+
- CAPABILITY_NAMED_IAM
|
215
|
+
timeout_in_minutes: 3
|
216
|
+
YAML
|
217
|
+
|
218
|
+
before(:each) { write_file(file, yaml) }
|
219
|
+
before(:each) { copy('%/iam.yaml', 'iam.yaml') }
|
220
|
+
before(:each) { copy('%/iam.json', 'iam.json') }
|
221
|
+
before(:each) { run_command('cfndk changeset create') }
|
222
|
+
it do
|
223
|
+
aggregate_failures do
|
224
|
+
expect(last_command_started).to be_successfully_executed
|
225
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
after(:each) { run_command('cfndk destroy -f') }
|
229
|
+
end
|
230
|
+
context 'with UUID', uuid: true do
|
231
|
+
context 'when -u 38437346-c75c-47c5-83b4-d504f85e275b' do
|
232
|
+
yaml = <<-"YAML"
|
233
|
+
stacks:
|
234
|
+
Test:
|
235
|
+
template_file: vpc.yaml
|
236
|
+
parameter_input: vpc.json
|
237
|
+
parameters:
|
238
|
+
VpcName: sample<%= append_uuid%>
|
239
|
+
timeout_in_minutes: 2
|
240
|
+
Test2:
|
241
|
+
template_file: sg.yaml
|
242
|
+
parameter_input: sg.json
|
243
|
+
parameters:
|
244
|
+
VpcName: sample<%= append_uuid%>
|
245
|
+
depends:
|
246
|
+
- Test
|
247
|
+
YAML
|
248
|
+
before(:each) { write_file(file, yaml) }
|
249
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
250
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
251
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
252
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
253
|
+
before(:each) { run_command("cfndk changeset create -u=#{uuid}") }
|
254
|
+
it do
|
255
|
+
aggregate_failures do
|
256
|
+
expect(last_command_started).to be_successfully_executed
|
257
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
258
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
259
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
260
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
261
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test2$/)
|
262
|
+
expect(last_command_started).to have_output(/INFO created change set: Test2$/)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
after(:each) { run_command("cfndk destroy -f -u=#{uuid}") }
|
266
|
+
end
|
267
|
+
context 'when env CFNDK_UUID=38437346-c75c-47c5-83b4-d504f85e275b' do
|
268
|
+
before(:each) { set_environment_variable('CFNDK_UUID', uuid) }
|
269
|
+
context 'with two stacks' do
|
270
|
+
yaml = <<-"YAML"
|
271
|
+
stacks:
|
272
|
+
Test:
|
273
|
+
template_file: vpc.yaml
|
274
|
+
parameter_input: vpc.json
|
275
|
+
parameters:
|
276
|
+
VpcName: sample<%= append_uuid%>
|
277
|
+
timeout_in_minutes: 2
|
278
|
+
Test2:
|
279
|
+
template_file: sg.yaml
|
280
|
+
parameter_input: sg.json
|
281
|
+
parameters:
|
282
|
+
VpcName: sample<%= append_uuid%>
|
283
|
+
depends:
|
284
|
+
- Test
|
285
|
+
YAML
|
286
|
+
before(:each) { write_file(file, yaml) }
|
287
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
288
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
289
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
290
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
291
|
+
before(:each) { run_command('cfndk changeset create') }
|
292
|
+
it do
|
293
|
+
aggregate_failures do
|
294
|
+
expect(last_command_started).to be_successfully_executed
|
295
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
296
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
297
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
298
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
299
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test2$/)
|
300
|
+
expect(last_command_started).to have_output(/INFO created change set: Test2$/)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
after(:each) { run_command('cfndk destroy -f') }
|
304
|
+
end
|
305
|
+
context 'when --stack-names=Test' do
|
306
|
+
yaml = <<-"YAML"
|
307
|
+
stacks:
|
308
|
+
Test:
|
309
|
+
template_file: vpc.yaml
|
310
|
+
parameter_input: vpc.json
|
311
|
+
parameters:
|
312
|
+
VpcName: sample<%= append_uuid%>
|
313
|
+
timeout_in_minutes: 2
|
314
|
+
Test2:
|
315
|
+
template_file: sg.yaml
|
316
|
+
parameter_input: sg.json
|
317
|
+
parameters:
|
318
|
+
VpcName: sample<%= append_uuid%>
|
319
|
+
depends:
|
320
|
+
- Test
|
321
|
+
YAML
|
322
|
+
before(:each) { write_file(file, yaml) }
|
323
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
324
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
325
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
326
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
327
|
+
before(:each) { run_command('cfndk changeset create --stack-names=Test') }
|
328
|
+
it do
|
329
|
+
aggregate_failures do
|
330
|
+
expect(last_command_started).to be_successfully_executed
|
331
|
+
expect(last_command_started).to have_output(/INFO create.../)
|
332
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
333
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
334
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
335
|
+
expect(last_command_started).not_to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
336
|
+
expect(last_command_started).not_to have_output(/INFO creating change set: Test2$/)
|
337
|
+
expect(last_command_started).not_to have_output(/INFO created change set: Test2$/)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
after(:each) { run_command('cfndk destroy -f') }
|
341
|
+
end
|
342
|
+
context 'when --stack-names=Test Test2' do
|
343
|
+
yaml = <<-"YAML"
|
344
|
+
stacks:
|
345
|
+
Test:
|
346
|
+
template_file: vpc.yaml
|
347
|
+
parameter_input: vpc.json
|
348
|
+
parameters:
|
349
|
+
VpcName: sample<%= append_uuid%>
|
350
|
+
timeout_in_minutes: 2
|
351
|
+
Test2:
|
352
|
+
template_file: sg.yaml
|
353
|
+
parameter_input: sg.json
|
354
|
+
parameters:
|
355
|
+
VpcName: sample<%= append_uuid%>
|
356
|
+
depends:
|
357
|
+
- Test
|
358
|
+
Test3:
|
359
|
+
template_file: iam.yaml
|
360
|
+
parameter_input: iam.json
|
361
|
+
parameters:
|
362
|
+
WebRoleName: WebhRole<%= append_uuid%>
|
363
|
+
capabilities:
|
364
|
+
- CAPABILITY_NAMED_IAM
|
365
|
+
timeout_in_minutes: 3
|
366
|
+
YAML
|
367
|
+
before(:each) { write_file(file, yaml) }
|
368
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
369
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
370
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
371
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
372
|
+
before(:each) { copy('%/iam.yaml', 'iam.yaml') }
|
373
|
+
before(:each) { copy('%/iam.json', 'iam.json') }
|
374
|
+
before(:each) { run_command('cfndk changeset create --stack-names=Test Test2') }
|
375
|
+
it do
|
376
|
+
aggregate_failures do
|
377
|
+
expect(last_command_started).to be_successfully_executed
|
378
|
+
expect(last_command_started).to have_output(/INFO create.../)
|
379
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
380
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test$/)
|
381
|
+
expect(last_command_started).to have_output(/INFO created change set: Test$/)
|
382
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
383
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test2$/)
|
384
|
+
expect(last_command_started).to have_output(/INFO created change set: Test2$/)
|
385
|
+
expect(last_command_started).not_to have_output(/INFO validate stack: Test3-#{uuid}$/)
|
386
|
+
expect(last_command_started).not_to have_output(/INFO creating change set: Test3$/)
|
387
|
+
expect(last_command_started).not_to have_output(/INFO created change set: Test3$/)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
after(:each) { run_command('cfndk destroy -f') }
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
context 'when -u 38437346-c75c-47c5-83b4-d504f85e275b and --change-set-uuid 38437346-c75c-47c5-83b4-d504f85e275c' do
|
395
|
+
yaml = <<-"YAML"
|
396
|
+
stacks:
|
397
|
+
Test:
|
398
|
+
template_file: vpc.yaml
|
399
|
+
parameter_input: vpc.json
|
400
|
+
parameters:
|
401
|
+
VpcName: sample<%= append_uuid%>
|
402
|
+
timeout_in_minutes: 2
|
403
|
+
Test2:
|
404
|
+
template_file: sg.yaml
|
405
|
+
parameter_input: sg.json
|
406
|
+
parameters:
|
407
|
+
VpcName: sample<%= append_uuid%>
|
408
|
+
depends:
|
409
|
+
- Test
|
410
|
+
YAML
|
411
|
+
before(:each) { write_file(file, yaml) }
|
412
|
+
before(:each) { copy('%/vpc.yaml', 'vpc.yaml') }
|
413
|
+
before(:each) { copy('%/vpc.json', 'vpc.json') }
|
414
|
+
before(:each) { copy('%/sg.yaml', 'sg.yaml') }
|
415
|
+
before(:each) { copy('%/sg.json', 'sg.json') }
|
416
|
+
before(:each) { run_command("cfndk changeset create -u=#{uuid} --change-set-uuid 38437346-c75c-47c5-83b4-d504f85e275c") }
|
417
|
+
it do
|
418
|
+
aggregate_failures do
|
419
|
+
expect(last_command_started).to be_successfully_executed
|
420
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test-#{uuid}$/)
|
421
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test-38437346-c75c-47c5-83b4-d504f85e275c$/)
|
422
|
+
expect(last_command_started).to have_output(/INFO created change set: Test-38437346-c75c-47c5-83b4-d504f85e275c$/)
|
423
|
+
expect(last_command_started).to have_output(/INFO validate stack: Test2-#{uuid}$/)
|
424
|
+
expect(last_command_started).to have_output(/INFO creating change set: Test2-38437346-c75c-47c5-83b4-d504f85e275c$/)
|
425
|
+
expect(last_command_started).to have_output(/INFO created change set: Test2-38437346-c75c-47c5-83b4-d504f85e275c$/)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
after(:each) { run_command("cfndk destroy -f -u=#{uuid}") }
|
429
|
+
end
|
430
|
+
end
|
431
|
+
end
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|