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
@@ -1,40 +1,40 @@
|
|
1
1
|
describe 'Kumogata::Client#delete' do
|
2
2
|
it 'update a stack from Ruby template' do
|
3
3
|
run_client(:delete, :arguments => ['MyStack'], :options => {:force => true}) do |client, cf|
|
4
|
-
client.
|
5
|
-
client.
|
4
|
+
expect(client).to receive(:print_event_log).once
|
5
|
+
expect(client).to receive(:create_event_log).once
|
6
6
|
|
7
7
|
stack = make_double('stack') do |obj|
|
8
|
-
obj.
|
9
|
-
obj.
|
8
|
+
expect(obj).to receive(:delete).with(no_args())
|
9
|
+
expect(obj).to receive(:status).and_return(
|
10
10
|
'DELETE_COMPLETE', 'DELETE_COMPLETE', 'DELETE_COMPLETE')
|
11
11
|
end
|
12
12
|
|
13
13
|
stacks = make_double('stacks') do |obj|
|
14
|
-
obj.
|
14
|
+
expect(obj).to receive(:[])
|
15
15
|
.with('MyStack') { stack }
|
16
16
|
end
|
17
17
|
|
18
|
-
cf.
|
18
|
+
expect(cf).to receive(:stacks) { stacks }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'update a stack from Ruby template (detach)' do
|
23
23
|
out = run_client(:delete, :arguments => ['MyStack'], :options => {:force => true, :detach => true}) do |client, cf|
|
24
|
-
client.
|
25
|
-
client.
|
24
|
+
expect(client).not_to receive(:print_event_log)
|
25
|
+
expect(client).to receive(:create_event_log).once
|
26
26
|
|
27
27
|
stack = make_double('stack') do |obj|
|
28
|
-
obj.
|
29
|
-
obj.
|
28
|
+
expect(obj).to receive(:delete).with(no_args())
|
29
|
+
expect(obj).to receive(:status).once
|
30
30
|
end
|
31
31
|
|
32
32
|
stacks = make_double('stacks') do |obj|
|
33
|
-
obj.
|
33
|
+
expect(obj).to receive(:[])
|
34
34
|
.with('MyStack') { stack }
|
35
35
|
end
|
36
36
|
|
37
|
-
cf.
|
37
|
+
expect(cf).to receive(:stacks) { stacks }
|
38
38
|
end
|
39
39
|
|
40
40
|
expect(out).to be_nil
|
@@ -26,15 +26,15 @@ describe 'Kumogata::Client#export' do
|
|
26
26
|
|
27
27
|
template = run_client(:export, :arguments => ['MyStack']) do |client, cf|
|
28
28
|
stack = make_double('stack') do |obj|
|
29
|
-
obj.
|
30
|
-
obj.
|
29
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
30
|
+
expect(obj).to receive(:template) { json }
|
31
31
|
end
|
32
32
|
|
33
33
|
stacks = make_double('stacks') do |obj|
|
34
|
-
obj.
|
34
|
+
expect(obj).to receive(:[]).with('MyStack') { stack }
|
35
35
|
end
|
36
36
|
|
37
|
-
cf.
|
37
|
+
expect(cf).to receive(:stacks) { stacks }
|
38
38
|
end
|
39
39
|
|
40
40
|
expect(template).to eq((<<-EOS).chomp)
|
@@ -84,15 +84,15 @@ end
|
|
84
84
|
|
85
85
|
template = run_client(:export, :arguments => ['MyStack'], :options => {:format => :json}) do |client, cf|
|
86
86
|
stack = make_double('stack') do |obj|
|
87
|
-
obj.
|
88
|
-
obj.
|
87
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
88
|
+
expect(obj).to receive(:template) { json }
|
89
89
|
end
|
90
90
|
|
91
91
|
stacks = make_double('stacks') do |obj|
|
92
|
-
obj.
|
92
|
+
expect(obj).to receive(:[]).with('MyStack') { stack }
|
93
93
|
end
|
94
94
|
|
95
|
-
cf.
|
95
|
+
expect(cf).to receive(:stacks) { stacks }
|
96
96
|
end
|
97
97
|
|
98
98
|
expect(template).to eq((<<-EOS).chomp)
|
data/spec/kumogata_list_spec.rb
CHANGED
@@ -2,20 +2,20 @@ describe 'Kumogata::Client#list' do
|
|
2
2
|
it 'list stacks' do
|
3
3
|
json = run_client(:list) do |client, cf|
|
4
4
|
stack1 = make_double('stack1') do |obj|
|
5
|
-
obj.
|
6
|
-
obj.
|
7
|
-
obj.
|
8
|
-
obj.
|
5
|
+
expect(obj).to receive(:name) { 'stack1' }
|
6
|
+
expect(obj).to receive(:creation_time) { '2014-03-02 16:17:18 UTC' }
|
7
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
8
|
+
expect(obj).to receive(:description) { nil }
|
9
9
|
end
|
10
10
|
|
11
11
|
stack2 = make_double('stack2') do |obj|
|
12
|
-
obj.
|
13
|
-
obj.
|
14
|
-
obj.
|
15
|
-
obj.
|
12
|
+
expect(obj).to receive(:name) { 'stack2' }
|
13
|
+
expect(obj).to receive(:creation_time) { '2014-03-02 16:17:19 UTC' }
|
14
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
15
|
+
expect(obj).to receive(:description) { nil }
|
16
16
|
end
|
17
17
|
|
18
|
-
cf.
|
18
|
+
expect(cf).to receive(:stacks) { [stack1, stack2] }
|
19
19
|
end
|
20
20
|
|
21
21
|
expect(json).to eq((<<-EOS).chomp)
|
@@ -39,17 +39,17 @@ describe 'Kumogata::Client#list' do
|
|
39
39
|
it 'list a specified stack' do
|
40
40
|
json = run_client(:list, :arguments => ['stack1']) do |client, cf|
|
41
41
|
stack1 = make_double('stack1') do |obj|
|
42
|
-
obj.
|
43
|
-
obj.
|
44
|
-
obj.
|
45
|
-
obj.
|
42
|
+
expect(obj).to receive(:name).twice { 'stack1' }
|
43
|
+
expect(obj).to receive(:creation_time) { '2014-03-02 16:17:18 UTC' }
|
44
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
45
|
+
expect(obj).to receive(:description) { nil }
|
46
46
|
end
|
47
47
|
|
48
48
|
stack2 = make_double('stack2') do |obj|
|
49
|
-
obj.
|
49
|
+
expect(obj).to receive(:name) { 'stack2' }
|
50
50
|
end
|
51
51
|
|
52
|
-
cf.
|
52
|
+
expect(cf).to receive(:stacks) { [stack1, stack2] }
|
53
53
|
end
|
54
54
|
|
55
55
|
expect(json).to eq((<<-EOS).chomp)
|
@@ -3,28 +3,28 @@ describe 'Kumogata::Client#show_events' do
|
|
3
3
|
|
4
4
|
resources = run_client(:show_events, :arguments => ['MyStack']) do |client, cf|
|
5
5
|
event = make_double('event') do |obj|
|
6
|
-
obj.
|
7
|
-
obj.
|
8
|
-
obj.
|
9
|
-
obj.
|
10
|
-
obj.
|
11
|
-
obj.
|
12
|
-
obj.
|
13
|
-
obj.
|
14
|
-
obj.
|
15
|
-
obj.
|
6
|
+
expect(obj).to receive(:event_id) { "f45e6070-a4f7-11e3-9326-5088487c4896" }
|
7
|
+
expect(obj).to receive(:logical_resource_id) { "kumogata-f11118a4-a4f7-11e3-8183-98fe943e66ca" }
|
8
|
+
expect(obj).to receive(:physical_resource_id) { "arn:aws:cloudformation:ap-northeast-1:822997939312:stack/kumogata-f11118a4-a4f7-11e3-8183-98fe943e66ca/f1381a30-a4f7-11e3-a340-506cf9a1c096" }
|
9
|
+
expect(obj).to receive(:resource_properties) { nil }
|
10
|
+
expect(obj).to receive(:resource_status) { "CREATE_FAILED" }
|
11
|
+
expect(obj).to receive(:resource_status_reason) { "The following resource(s) failed to create: [myEC2Instance]. " }
|
12
|
+
expect(obj).to receive(:resource_type) { "AWS::CloudFormation::Stack" }
|
13
|
+
expect(obj).to receive(:stack_id) { "arn:aws:cloudformation:ap-northeast-1:822997939312:stack/kumogata-f11118a4-a4f7-11e3-8183-98fe943e66ca/f1381a30-a4f7-11e3-a340-506cf9a1c096" }
|
14
|
+
expect(obj).to receive(:stack_name) { "kumogata-f11118a4-a4f7-11e3-8183-98fe943e66ca" }
|
15
|
+
expect(obj).to receive(:timestamp) { "2014-03-06 06:24:21 UTC" }
|
16
16
|
end
|
17
17
|
|
18
18
|
stack = make_double('stack') do |obj|
|
19
|
-
obj.
|
20
|
-
obj.
|
19
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
20
|
+
expect(obj).to receive(:events).and_return([event])
|
21
21
|
end
|
22
22
|
|
23
23
|
stacks = make_double('stacks') do |obj|
|
24
|
-
obj.
|
24
|
+
expect(obj).to receive(:[]).with('MyStack') { stack }
|
25
25
|
end
|
26
26
|
|
27
|
-
cf.
|
27
|
+
expect(cf).to receive(:stacks) { stacks }
|
28
28
|
end
|
29
29
|
|
30
30
|
expect(resources).to eq((<<-EOS).chomp)
|
@@ -3,20 +3,20 @@ describe 'Kumogata::Client#show_outputs' do
|
|
3
3
|
|
4
4
|
outputs = run_client(:show_outputs, :arguments => ['MyStack']) do |client, cf|
|
5
5
|
output = make_double('output') do |obj|
|
6
|
-
obj.
|
7
|
-
obj.
|
6
|
+
expect(obj).to receive(:key) { 'AZ' }
|
7
|
+
expect(obj).to receive(:value) { 'ap-northeast-1a' }
|
8
8
|
end
|
9
9
|
|
10
10
|
stack = make_double('stack') do |obj|
|
11
|
-
obj.
|
12
|
-
obj.
|
11
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
12
|
+
expect(obj).to receive(:outputs) { [output] }
|
13
13
|
end
|
14
14
|
|
15
15
|
stacks = make_double('stacks') do |obj|
|
16
|
-
obj.
|
16
|
+
expect(obj).to receive(:[]).with('MyStack') { stack }
|
17
17
|
end
|
18
18
|
|
19
|
-
cf.
|
19
|
+
expect(cf).to receive(:stacks) { stacks }
|
20
20
|
end
|
21
21
|
|
22
22
|
expect(outputs).to eq((<<-EOS).chomp)
|
@@ -3,8 +3,8 @@ describe 'Kumogata::Client#show_resources' do
|
|
3
3
|
|
4
4
|
resources = run_client(:show_resources, :arguments => ['MyStack']) do |client, cf|
|
5
5
|
stack = make_double('stack') do |obj|
|
6
|
-
obj.
|
7
|
-
obj.
|
6
|
+
expect(obj).to receive(:status) { 'CREATE_COMPLETE' }
|
7
|
+
expect(obj).to receive(:resource_summaries).and_return([
|
8
8
|
{
|
9
9
|
:logical_resource_id => 'myEC2Instance',
|
10
10
|
:physical_resource_id => 'i-XXXXXXXX',
|
@@ -17,10 +17,10 @@ describe 'Kumogata::Client#show_resources' do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
stacks = make_double('stacks') do |obj|
|
20
|
-
obj.
|
20
|
+
expect(obj).to receive(:[]).with('MyStack') { stack }
|
21
21
|
end
|
22
22
|
|
23
|
-
cf.
|
23
|
+
expect(cf).to receive(:stacks) { stacks }
|
24
24
|
end
|
25
25
|
|
26
26
|
expect(resources).to eq((<<-EOS).chomp)
|
@@ -22,37 +22,94 @@ end
|
|
22
22
|
|
23
23
|
run_client(:update, :arguments => ['MyStack'], :template => template) do |client, cf|
|
24
24
|
json = eval_template(template).to_json
|
25
|
-
client.
|
26
|
-
client.
|
25
|
+
expect(client).to receive(:print_event_log).once
|
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) { 'UPDATE_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.
|
44
|
-
obj.
|
43
|
+
expect(obj).to receive(:update).with(:template => json)
|
44
|
+
expect(obj).to receive(:status).and_return(
|
45
45
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
46
|
-
obj.
|
47
|
-
obj.
|
46
|
+
expect(obj).to receive(:outputs) { [output] }
|
47
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
48
48
|
end
|
49
49
|
|
50
50
|
stacks = make_double('stacks') do |obj|
|
51
|
-
obj.
|
51
|
+
expect(obj).to receive(:[])
|
52
52
|
.with('MyStack') { stack }
|
53
53
|
end
|
54
54
|
|
55
|
-
cf.
|
55
|
+
expect(cf).to receive(:stacks) { stacks }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'update a stack from Ruby template (with capabilities option)' do
|
60
|
+
template = <<-EOS
|
61
|
+
Resources do
|
62
|
+
myEC2Instance do
|
63
|
+
Type "AWS::EC2::Instance"
|
64
|
+
Properties do
|
65
|
+
ImageId "ami-XXXXXXXX"
|
66
|
+
InstanceType "t1.micro"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
Outputs do
|
72
|
+
AZ do
|
73
|
+
Value do
|
74
|
+
Fn__GetAtt "myEC2Instance", "AvailabilityZone"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
EOS
|
79
|
+
|
80
|
+
run_client(:update, :arguments => ['MyStack'], :template => template, :options => {:capabilities => ['AWS::CloudFormation::Stack']}) do |client, cf|
|
81
|
+
json = eval_template(template).to_json
|
82
|
+
expect(client).to receive(:print_event_log).once
|
83
|
+
expect(client).to receive(:create_event_log).once
|
84
|
+
|
85
|
+
output = make_double('output') do |obj|
|
86
|
+
expect(obj).to receive(:key) { 'AZ' }
|
87
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
88
|
+
end
|
89
|
+
|
90
|
+
resource_summary = make_double('resource_summary') do |obj|
|
91
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
92
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
93
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
94
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
95
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
96
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
97
|
+
end
|
98
|
+
|
99
|
+
stack = make_double('stack') do |obj|
|
100
|
+
expect(obj).to receive(:update).with(:template => json, :capabilities => ['AWS::CloudFormation::Stack'])
|
101
|
+
expect(obj).to receive(:status).and_return(
|
102
|
+
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
103
|
+
expect(obj).to receive(:outputs) { [output] }
|
104
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
105
|
+
end
|
106
|
+
|
107
|
+
stacks = make_double('stacks') do |obj|
|
108
|
+
expect(obj).to receive(:[])
|
109
|
+
.with('MyStack') { stack }
|
110
|
+
end
|
111
|
+
|
112
|
+
expect(cf).to receive(:stacks) { stacks }
|
56
113
|
end
|
57
114
|
end
|
58
115
|
|
@@ -79,22 +136,22 @@ end
|
|
79
136
|
|
80
137
|
out = run_client(:update, :arguments => ['MyStack'], :template => template, :options => {:detach => true}) do |client, cf|
|
81
138
|
json = eval_template(template).to_json
|
82
|
-
client.
|
83
|
-
client.
|
139
|
+
expect(client).not_to receive(:print_event_log)
|
140
|
+
expect(client).to receive(:create_event_log).once
|
84
141
|
|
85
142
|
stack = make_double('stack') do |obj|
|
86
|
-
obj.
|
87
|
-
obj.
|
88
|
-
obj.
|
89
|
-
obj.
|
143
|
+
expect(obj).to receive(:update).with(:template => json)
|
144
|
+
expect(obj).to receive(:status).once
|
145
|
+
expect(obj).not_to receive(:outputs)
|
146
|
+
expect(obj).not_to receive(:resource_summaries)
|
90
147
|
end
|
91
148
|
|
92
149
|
stacks = make_double('stacks') do |obj|
|
93
|
-
obj.
|
150
|
+
expect(obj).to receive(:[])
|
94
151
|
.with('MyStack') { stack }
|
95
152
|
end
|
96
153
|
|
97
|
-
cf.
|
154
|
+
expect(cf).to receive(:stacks) { stacks }
|
98
155
|
end
|
99
156
|
|
100
157
|
expect(out).to be_nil
|
@@ -128,37 +185,37 @@ end
|
|
128
185
|
"DeletionPolicyUpdateKeyForKumogata" => "DeletionPolicyUpdateValueForKumogata1388534400"
|
129
186
|
}
|
130
187
|
json = template.to_json
|
131
|
-
client.
|
132
|
-
client.
|
188
|
+
expect(client).to receive(:print_event_log).once
|
189
|
+
expect(client).to receive(:create_event_log).once
|
133
190
|
|
134
191
|
output = make_double('output') do |obj|
|
135
|
-
obj.
|
136
|
-
obj.
|
192
|
+
expect(obj).to receive(:key) { 'AZ' }
|
193
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
137
194
|
end
|
138
195
|
|
139
196
|
resource_summary = make_double('resource_summary') do |obj|
|
140
|
-
obj.
|
141
|
-
obj.
|
142
|
-
obj.
|
143
|
-
obj.
|
144
|
-
obj.
|
145
|
-
obj.
|
197
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
198
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
199
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
200
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
201
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
202
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
146
203
|
end
|
147
204
|
|
148
205
|
stack = make_double('stack') do |obj|
|
149
|
-
obj.
|
150
|
-
obj.
|
206
|
+
expect(obj).to receive(:update).with(:template => json)
|
207
|
+
expect(obj).to receive(:status).and_return(
|
151
208
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
152
|
-
obj.
|
153
|
-
obj.
|
209
|
+
expect(obj).to receive(:outputs) { [output] }
|
210
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
154
211
|
end
|
155
212
|
|
156
213
|
stacks = make_double('stacks') do |obj|
|
157
|
-
obj.
|
214
|
+
expect(obj).to receive(:[])
|
158
215
|
.with('MyStack') { stack }
|
159
216
|
end
|
160
217
|
|
161
|
-
cf.
|
218
|
+
expect(cf).to receive(:stacks) { stacks }
|
162
219
|
end
|
163
220
|
end
|
164
221
|
end
|
@@ -207,53 +264,53 @@ end
|
|
207
264
|
|
208
265
|
run_client(:update, :arguments => ['MyStack'], :template => template) do |client, cf|
|
209
266
|
json = eval_template(template).to_json
|
210
|
-
client.
|
211
|
-
client.
|
267
|
+
expect(client).to receive(:print_event_log).once
|
268
|
+
expect(client).to receive(:create_event_log).once
|
212
269
|
|
213
270
|
output1 = make_double('output') do |obj|
|
214
|
-
obj.
|
215
|
-
obj.
|
271
|
+
expect(obj).to receive(:key) { 'AZ' }
|
272
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
216
273
|
end
|
217
274
|
|
218
275
|
output2 = make_double('output') do |obj|
|
219
|
-
obj.
|
220
|
-
obj.
|
276
|
+
expect(obj).to receive(:key) { 'Region' }
|
277
|
+
expect(obj).to receive(:value) { 'ap-northeast-1' }
|
221
278
|
end
|
222
279
|
|
223
280
|
resource_summary = make_double('resource_summary') do |obj|
|
224
|
-
obj.
|
225
|
-
obj.
|
226
|
-
obj.
|
227
|
-
obj.
|
228
|
-
obj.
|
229
|
-
obj.
|
281
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
282
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
283
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
284
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
285
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
286
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
230
287
|
end
|
231
288
|
|
232
289
|
stack = make_double('stack') do |obj|
|
233
|
-
obj.
|
234
|
-
obj.
|
290
|
+
expect(obj).to receive(:update).with(:template => json)
|
291
|
+
expect(obj).to receive(:status).and_return(
|
235
292
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
236
|
-
obj.
|
237
|
-
obj.
|
293
|
+
expect(obj).to receive(:outputs) { [output1, output2] }
|
294
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
238
295
|
end
|
239
296
|
|
240
297
|
stacks = make_double('stacks') do |obj|
|
241
|
-
obj.
|
298
|
+
expect(obj).to receive(:[])
|
242
299
|
.with('MyStack') { stack }
|
243
300
|
end
|
244
301
|
|
245
|
-
cf.
|
302
|
+
expect(cf).to receive(:stacks) { stacks }
|
246
303
|
|
247
304
|
process_status1 = double('process_status1')
|
248
305
|
process_status2 = double('process_status2')
|
249
306
|
|
250
|
-
Open3.
|
307
|
+
expect(Open3).not_to receive(:capture3)
|
251
308
|
|
252
|
-
client.instance_variable_get(:@post_processing)
|
253
|
-
.
|
309
|
+
expect(client.instance_variable_get(:@post_processing))
|
310
|
+
.not_to receive(:print_command_result)
|
254
311
|
|
255
|
-
client.instance_variable_get(:@post_processing)
|
256
|
-
.
|
312
|
+
expect(client.instance_variable_get(:@post_processing))
|
313
|
+
.not_to receive(:save_command_results)
|
257
314
|
end
|
258
315
|
end
|
259
316
|
|
@@ -293,52 +350,52 @@ end
|
|
293
350
|
|
294
351
|
run_client(:update, :arguments => ['MyStack'], :template => template) do |client, cf|
|
295
352
|
json = eval_template(template).to_json
|
296
|
-
client.
|
297
|
-
client.
|
353
|
+
expect(client).to receive(:print_event_log).once
|
354
|
+
expect(client).to receive(:create_event_log).once
|
298
355
|
|
299
356
|
output = make_double('output') do |obj|
|
300
|
-
obj.
|
301
|
-
obj.
|
357
|
+
expect(obj).to receive(:key) { 'PublicIp' }
|
358
|
+
expect(obj).to receive(:value) { '127.0.0.1' }
|
302
359
|
end
|
303
360
|
|
304
361
|
resource_summary = make_double('resource_summary') do |obj|
|
305
|
-
obj.
|
306
|
-
obj.
|
307
|
-
obj.
|
308
|
-
obj.
|
309
|
-
obj.
|
310
|
-
obj.
|
362
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
363
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
364
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
365
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
366
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
367
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
311
368
|
end
|
312
369
|
|
313
370
|
stack = make_double('stack') do |obj|
|
314
|
-
obj.
|
315
|
-
obj.
|
371
|
+
expect(obj).to receive(:update).with(:template => json)
|
372
|
+
expect(obj).to receive(:status).and_return(
|
316
373
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
317
|
-
obj.
|
318
|
-
obj.
|
374
|
+
expect(obj).to receive(:outputs) { [output] }
|
375
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
319
376
|
end
|
320
377
|
|
321
378
|
stacks = make_double('stacks') do |obj|
|
322
|
-
obj.
|
379
|
+
expect(obj).to receive(:[])
|
323
380
|
.with('MyStack') { stack }
|
324
381
|
end
|
325
382
|
|
326
|
-
cf.
|
383
|
+
expect(cf).to receive(:stacks) { stacks }
|
327
384
|
|
328
|
-
client.instance_variable_get(:@post_processing)
|
329
|
-
.
|
385
|
+
expect(client.instance_variable_get(:@post_processing))
|
386
|
+
.to receive(:run_ssh_command)
|
330
387
|
.with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user", "request_pty"=>true}, " ls\n", {"PublicIp"=>"127.0.0.1"})
|
331
388
|
.and_return(["file1\nfile2\n", "", 0])
|
332
389
|
|
333
|
-
client.instance_variable_get(:@post_processing)
|
334
|
-
.
|
390
|
+
expect(client.instance_variable_get(:@post_processing))
|
391
|
+
.to receive(:print_command).with('ssh_command')
|
335
392
|
|
336
|
-
client.instance_variable_get(:@post_processing)
|
337
|
-
.
|
393
|
+
expect(client.instance_variable_get(:@post_processing))
|
394
|
+
.to receive(:print_command_result)
|
338
395
|
.with("file1\nfile2\n", "", 0)
|
339
396
|
|
340
|
-
client.instance_variable_get(:@post_processing)
|
341
|
-
.
|
397
|
+
expect(client.instance_variable_get(:@post_processing))
|
398
|
+
.to receive(:save_command_results)
|
342
399
|
.with([{'ssh_command' => {'ExitStatus' => 0, 'StdOut' => "file1\nfile2\n", 'StdErr' => ""}}])
|
343
400
|
end
|
344
401
|
end
|
@@ -383,52 +440,52 @@ end
|
|
383
440
|
|
384
441
|
run_client(:update, :arguments => ['MyStack'], :template => template) do |client, cf|
|
385
442
|
json = eval_template(template).to_json
|
386
|
-
client.
|
387
|
-
client.
|
443
|
+
expect(client).to receive(:print_event_log).once
|
444
|
+
expect(client).to receive(:create_event_log).once
|
388
445
|
|
389
446
|
output = make_double('output') do |obj|
|
390
|
-
obj.
|
391
|
-
obj.
|
447
|
+
expect(obj).to receive(:key) { 'PublicIp' }
|
448
|
+
expect(obj).to receive(:value) { '127.0.0.1' }
|
392
449
|
end
|
393
450
|
|
394
451
|
resource_summary = make_double('resource_summary') do |obj|
|
395
|
-
obj.
|
396
|
-
obj.
|
397
|
-
obj.
|
398
|
-
obj.
|
399
|
-
obj.
|
400
|
-
obj.
|
452
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
453
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
454
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
455
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
456
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
457
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
401
458
|
end
|
402
459
|
|
403
460
|
stack = make_double('stack') do |obj|
|
404
|
-
obj.
|
405
|
-
obj.
|
461
|
+
expect(obj).to receive(:update).with(:template => json)
|
462
|
+
expect(obj).to receive(:status).and_return(
|
406
463
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
407
|
-
obj.
|
408
|
-
obj.
|
464
|
+
expect(obj).to receive(:outputs) { [output] }
|
465
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
409
466
|
end
|
410
467
|
|
411
468
|
stacks = make_double('stacks') do |obj|
|
412
|
-
obj.
|
469
|
+
expect(obj).to receive(:[])
|
413
470
|
.with('MyStack') { stack }
|
414
471
|
end
|
415
472
|
|
416
|
-
cf.
|
473
|
+
expect(cf).to receive(:stacks) { stacks }
|
417
474
|
|
418
|
-
client.instance_variable_get(:@post_processing)
|
419
|
-
.
|
475
|
+
expect(client.instance_variable_get(:@post_processing))
|
476
|
+
.to receive(:run_ssh_command)
|
420
477
|
.with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user", "request_pty"=>true}, " ls\n", {"PublicIp"=>"127-0-0-1"})
|
421
478
|
.and_return(["file1\nfile2\n", "", 0])
|
422
479
|
|
423
|
-
client.instance_variable_get(:@post_processing)
|
424
|
-
.
|
480
|
+
expect(client.instance_variable_get(:@post_processing))
|
481
|
+
.to receive(:print_command).with('ssh_command')
|
425
482
|
|
426
|
-
client.instance_variable_get(:@post_processing)
|
427
|
-
.
|
483
|
+
expect(client.instance_variable_get(:@post_processing))
|
484
|
+
.to receive(:print_command_result)
|
428
485
|
.with("file1\nfile2\n", "", 0)
|
429
486
|
|
430
|
-
client.instance_variable_get(:@post_processing)
|
431
|
-
.
|
487
|
+
expect(client.instance_variable_get(:@post_processing))
|
488
|
+
.to receive(:save_command_results)
|
432
489
|
.with([{'ssh_command' => {'ExitStatus' => 0, 'StdOut' => "file1\nfile2\n", 'StdErr' => ""}}])
|
433
490
|
end
|
434
491
|
end
|
@@ -479,70 +536,70 @@ end
|
|
479
536
|
|
480
537
|
run_client(:update, :arguments => ['MyStack'], :template => template) do |client, cf|
|
481
538
|
json = eval_template(template).to_json
|
482
|
-
client.
|
483
|
-
client.
|
539
|
+
expect(client).to receive(:print_event_log).once
|
540
|
+
expect(client).to receive(:create_event_log).once
|
484
541
|
|
485
542
|
output1 = make_double('output') do |obj|
|
486
|
-
obj.
|
487
|
-
obj.
|
543
|
+
expect(obj).to receive(:key) { 'AZ' }
|
544
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
488
545
|
end
|
489
546
|
|
490
547
|
output2 = make_double('output') do |obj|
|
491
|
-
obj.
|
492
|
-
obj.
|
548
|
+
expect(obj).to receive(:key) { 'Region' }
|
549
|
+
expect(obj).to receive(:value) { 'ap-northeast-1' }
|
493
550
|
end
|
494
551
|
|
495
552
|
resource_summary = make_double('resource_summary') do |obj|
|
496
|
-
obj.
|
497
|
-
obj.
|
498
|
-
obj.
|
499
|
-
obj.
|
500
|
-
obj.
|
501
|
-
obj.
|
553
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
554
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
555
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
556
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
557
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
558
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
502
559
|
end
|
503
560
|
|
504
561
|
stack = make_double('stack') do |obj|
|
505
|
-
obj.
|
506
|
-
obj.
|
562
|
+
expect(obj).to receive(:update).with(:template => json)
|
563
|
+
expect(obj).to receive(:status).and_return(
|
507
564
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
508
|
-
obj.
|
509
|
-
obj.
|
565
|
+
expect(obj).to receive(:outputs) { [output1, output2] }
|
566
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
510
567
|
end
|
511
568
|
|
512
569
|
stacks = make_double('stacks') do |obj|
|
513
|
-
obj.
|
570
|
+
expect(obj).to receive(:[])
|
514
571
|
.with('MyStack') { stack }
|
515
572
|
end
|
516
573
|
|
517
|
-
cf.
|
574
|
+
expect(cf).to receive(:stacks) { stacks }
|
518
575
|
|
519
576
|
|
520
|
-
process_status1 = make_double('process_status1') {|obj| obj.
|
521
|
-
process_status2 = make_double('process_status2') {|obj| obj.
|
577
|
+
process_status1 = make_double('process_status1') {|obj| expect(obj).to receive(:to_i).and_return(0) }
|
578
|
+
process_status2 = make_double('process_status2') {|obj| expect(obj).to receive(:to_i).and_return(0) }
|
522
579
|
|
523
|
-
client.instance_variable_get(:@post_processing)
|
524
|
-
.
|
580
|
+
expect(client.instance_variable_get(:@post_processing))
|
581
|
+
.to receive(:run_shell_command)
|
525
582
|
.with(" echo <%= Key \"AZ\" %>\n echo <%= Key \"Region\" %>\n", {"AZ"=>"ap-northeast-1b", "Region"=>"ap-northeast-1"})
|
526
583
|
.and_return(["ap-northeast-1b\nap-northeast-1\n", "", process_status1])
|
527
|
-
client.instance_variable_get(:@post_processing)
|
528
|
-
.
|
584
|
+
expect(client.instance_variable_get(:@post_processing))
|
585
|
+
.to receive(:run_shell_command)
|
529
586
|
.with(" echo <%= Key \"Region\" %>\n echo <%= Key \"AZ\" %>\n", {"AZ"=>"ap-northeast-1b", "Region"=>"ap-northeast-1"})
|
530
587
|
.and_return(["ap-northeast-1\nap-northeast-1b\n", "", process_status2])
|
531
588
|
|
532
|
-
client.instance_variable_get(:@post_processing)
|
533
|
-
.
|
534
|
-
client.instance_variable_get(:@post_processing)
|
535
|
-
.
|
589
|
+
expect(client.instance_variable_get(:@post_processing))
|
590
|
+
.to receive(:print_command).with('command_a')
|
591
|
+
expect(client.instance_variable_get(:@post_processing))
|
592
|
+
.to receive(:print_command).with('command_b')
|
536
593
|
|
537
|
-
client.instance_variable_get(:@post_processing)
|
538
|
-
.
|
594
|
+
expect(client.instance_variable_get(:@post_processing))
|
595
|
+
.to receive(:print_command_result)
|
539
596
|
.with("ap-northeast-1b\nap-northeast-1\n", "", process_status1)
|
540
|
-
client.instance_variable_get(:@post_processing)
|
541
|
-
.
|
597
|
+
expect(client.instance_variable_get(:@post_processing))
|
598
|
+
.to receive(:print_command_result)
|
542
599
|
.with("ap-northeast-1\nap-northeast-1b\n", "", process_status2)
|
543
600
|
|
544
|
-
client.instance_variable_get(:@post_processing)
|
545
|
-
.
|
601
|
+
expect(client.instance_variable_get(:@post_processing))
|
602
|
+
.to receive(:save_command_results)
|
546
603
|
.with([{'command_a' => {'ExitStatus' => 0, 'StdOut' => "ap-northeast-1b\nap-northeast-1\n", 'StdErr' => ""}},
|
547
604
|
{'command_b' => {'ExitStatus' => 0, 'StdOut' => "ap-northeast-1\nap-northeast-1b\n", 'StdErr' => ""}}])
|
548
605
|
end
|
@@ -594,53 +651,53 @@ end
|
|
594
651
|
|
595
652
|
run_client(:update, :arguments => ['MyStack'], :template => template) do |client, cf|
|
596
653
|
json = eval_template(template).to_json
|
597
|
-
client.
|
598
|
-
client.
|
654
|
+
expect(client).to receive(:print_event_log).once
|
655
|
+
expect(client).to receive(:create_event_log).once
|
599
656
|
|
600
657
|
output1 = make_double('output') do |obj|
|
601
|
-
obj.
|
602
|
-
obj.
|
658
|
+
expect(obj).to receive(:key) { 'AZ' }
|
659
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
603
660
|
end
|
604
661
|
|
605
662
|
output2 = make_double('output') do |obj|
|
606
|
-
obj.
|
607
|
-
obj.
|
663
|
+
expect(obj).to receive(:key) { 'Region' }
|
664
|
+
expect(obj).to receive(:value) { 'ap-northeast-1' }
|
608
665
|
end
|
609
666
|
|
610
667
|
resource_summary = make_double('resource_summary') do |obj|
|
611
|
-
obj.
|
612
|
-
obj.
|
613
|
-
obj.
|
614
|
-
obj.
|
615
|
-
obj.
|
616
|
-
obj.
|
668
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
669
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
670
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
671
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
672
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
673
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
617
674
|
end
|
618
675
|
|
619
676
|
stack = make_double('stack') do |obj|
|
620
|
-
obj.
|
621
|
-
obj.
|
677
|
+
expect(obj).to receive(:update).with(:template => json)
|
678
|
+
expect(obj).to receive(:status).and_return(
|
622
679
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
623
|
-
obj.
|
624
|
-
obj.
|
680
|
+
expect(obj).to receive(:outputs) { [output1, output2] }
|
681
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
625
682
|
end
|
626
683
|
|
627
684
|
stacks = make_double('stacks') do |obj|
|
628
|
-
obj.
|
685
|
+
expect(obj).to receive(:[])
|
629
686
|
.with('MyStack') { stack }
|
630
687
|
end
|
631
688
|
|
632
|
-
cf.
|
689
|
+
expect(cf).to receive(:stacks) { stacks }
|
633
690
|
|
634
691
|
process_status1 = double('process_status1')
|
635
692
|
process_status2 = double('process_status2')
|
636
693
|
|
637
|
-
Open3.
|
694
|
+
expect(Open3).not_to receive(:capture3)
|
638
695
|
|
639
|
-
client.instance_variable_get(:@post_processing)
|
640
|
-
.
|
696
|
+
expect(client.instance_variable_get(:@post_processing))
|
697
|
+
.not_to receive(:print_command_result)
|
641
698
|
|
642
|
-
client.instance_variable_get(:@post_processing)
|
643
|
-
.
|
699
|
+
expect(client.instance_variable_get(:@post_processing))
|
700
|
+
.not_to receive(:save_command_results)
|
644
701
|
end
|
645
702
|
end
|
646
703
|
|
@@ -675,37 +732,37 @@ end
|
|
675
732
|
|
676
733
|
run_client(:update, :arguments => ['MyStack'], :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}}) do |client, cf|
|
677
734
|
json = eval_template(template).to_json
|
678
|
-
client.
|
679
|
-
client.
|
735
|
+
expect(client).to receive(:print_event_log).once
|
736
|
+
expect(client).to receive(:create_event_log).once
|
680
737
|
|
681
738
|
output = make_double('output') do |obj|
|
682
|
-
obj.
|
683
|
-
obj.
|
739
|
+
expect(obj).to receive(:key) { 'AZ' }
|
740
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
684
741
|
end
|
685
742
|
|
686
743
|
resource_summary = make_double('resource_summary') do |obj|
|
687
|
-
obj.
|
688
|
-
obj.
|
689
|
-
obj.
|
690
|
-
obj.
|
691
|
-
obj.
|
692
|
-
obj.
|
744
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
745
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
746
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
747
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
748
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
749
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
693
750
|
end
|
694
751
|
|
695
752
|
stack = make_double('stack') do |obj|
|
696
|
-
obj.
|
697
|
-
obj.
|
753
|
+
expect(obj).to receive(:update).with(:template => json, :parameters=>{"InstanceType"=>"m1.large"})
|
754
|
+
expect(obj).to receive(:status).and_return(
|
698
755
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
699
|
-
obj.
|
700
|
-
obj.
|
756
|
+
expect(obj).to receive(:outputs) { [output] }
|
757
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
701
758
|
end
|
702
759
|
|
703
760
|
stacks = make_double('stacks') do |obj|
|
704
|
-
obj.
|
761
|
+
expect(obj).to receive(:[])
|
705
762
|
.with('MyStack') { stack }
|
706
763
|
end
|
707
764
|
|
708
|
-
cf.
|
765
|
+
expect(cf).to receive(:stacks) { stacks }
|
709
766
|
end
|
710
767
|
end
|
711
768
|
|
@@ -765,37 +822,37 @@ end
|
|
765
822
|
|
766
823
|
run_client(:update, :arguments => ['MyStack'], :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}, :encrypt_parameters => ['Password']}) do |client, cf|
|
767
824
|
json = eval_template(template, :add_encryption_password => true).to_json
|
768
|
-
client.
|
769
|
-
client.
|
825
|
+
expect(client).to receive(:print_event_log).once
|
826
|
+
expect(client).to receive(:create_event_log).once
|
770
827
|
|
771
828
|
output = make_double('output') do |obj|
|
772
|
-
obj.
|
773
|
-
obj.
|
829
|
+
expect(obj).to receive(:key) { 'AZ' }
|
830
|
+
expect(obj).to receive(:value) { 'ap-northeast-1b' }
|
774
831
|
end
|
775
832
|
|
776
833
|
resource_summary = make_double('resource_summary') do |obj|
|
777
|
-
obj.
|
778
|
-
obj.
|
779
|
-
obj.
|
780
|
-
obj.
|
781
|
-
obj.
|
782
|
-
obj.
|
834
|
+
expect(obj).to receive(:[]).with(:logical_resource_id) { 'myEC2Instance' }
|
835
|
+
expect(obj).to receive(:[]).with(:physical_resource_id) { 'i-XXXXXXXX' }
|
836
|
+
expect(obj).to receive(:[]).with(:resource_type) { 'AWS::EC2::Instance' }
|
837
|
+
expect(obj).to receive(:[]).with(:resource_status) { 'UPDATE_COMPLETE' }
|
838
|
+
expect(obj).to receive(:[]).with(:resource_status_reason) { nil }
|
839
|
+
expect(obj).to receive(:[]).with(:last_updated_timestamp) { '2014-03-02 04:35:12 UTC' }
|
783
840
|
end
|
784
841
|
|
785
842
|
stack = make_double('stack') do |obj|
|
786
|
-
obj.
|
787
|
-
obj.
|
843
|
+
expect(obj).to receive(:update).with(:template => json, :parameters=>{"InstanceType"=>"m1.large", "EncryptionPassword"=>"KioqKioqKioqKioqKioqKg=="})
|
844
|
+
expect(obj).to receive(:status).and_return(
|
788
845
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
789
|
-
obj.
|
790
|
-
obj.
|
846
|
+
expect(obj).to receive(:outputs) { [output] }
|
847
|
+
expect(obj).to receive(:resource_summaries) { [resource_summary] }
|
791
848
|
end
|
792
849
|
|
793
850
|
stacks = make_double('stacks') do |obj|
|
794
|
-
obj.
|
851
|
+
expect(obj).to receive(:[])
|
795
852
|
.with('MyStack') { stack }
|
796
853
|
end
|
797
854
|
|
798
|
-
cf.
|
855
|
+
expect(cf).to receive(:stacks) { stacks }
|
799
856
|
end
|
800
857
|
end
|
801
858
|
end
|