poolparty 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -3
- data/lib/poolparty/chef_solo.rb +0 -1
- metadata +12 -69
- data/vendor/gems/amazon-ec2/ChangeLog +0 -304
- data/vendor/gems/amazon-ec2/LICENSE +0 -66
- data/vendor/gems/amazon-ec2/README.rdoc +0 -359
- data/vendor/gems/amazon-ec2/README_dev.rdoc +0 -10
- data/vendor/gems/amazon-ec2/Rakefile +0 -70
- data/vendor/gems/amazon-ec2/VERSION +0 -1
- data/vendor/gems/amazon-ec2/amazon-ec2.gemspec +0 -142
- data/vendor/gems/amazon-ec2/bin/ec2-gem-example.rb +0 -137
- data/vendor/gems/amazon-ec2/bin/ec2-gem-profile.rb +0 -10
- data/vendor/gems/amazon-ec2/bin/ec2sh +0 -62
- data/vendor/gems/amazon-ec2/bin/setup.rb +0 -29
- data/vendor/gems/amazon-ec2/deps.rip +0 -1
- data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling/autoscaling.rb +0 -273
- data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling.rb +0 -70
- data/vendor/gems/amazon-ec2/lib/AWS/Cloudwatch/monitoring.rb +0 -80
- data/vendor/gems/amazon-ec2/lib/AWS/Cloudwatch.rb +0 -32
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/availability_zones.rb +0 -29
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/console.rb +0 -25
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/devpay.rb +0 -18
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/elastic_ips.rb +0 -86
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/image_attributes.rb +0 -133
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/images.rb +0 -117
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/instances.rb +0 -249
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/keypairs.rb +0 -47
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/products.rb +0 -21
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/security_groups.rb +0 -164
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/snapshots.rb +0 -80
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/volumes.rb +0 -100
- data/vendor/gems/amazon-ec2/lib/AWS/EC2.rb +0 -33
- data/vendor/gems/amazon-ec2/lib/AWS/ELB/load_balancers.rb +0 -178
- data/vendor/gems/amazon-ec2/lib/AWS/ELB.rb +0 -71
- data/vendor/gems/amazon-ec2/lib/AWS/RDS/rds.rb +0 -522
- data/vendor/gems/amazon-ec2/lib/AWS/RDS.rb +0 -73
- data/vendor/gems/amazon-ec2/lib/AWS/exceptions.rb +0 -200
- data/vendor/gems/amazon-ec2/lib/AWS/responses.rb +0 -21
- data/vendor/gems/amazon-ec2/lib/AWS.rb +0 -304
- data/vendor/gems/amazon-ec2/perftools/ec2prof +0 -0
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.dot +0 -132
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.txt +0 -100
- data/vendor/gems/amazon-ec2/perftools/ec2prof.symbols +0 -102
- data/vendor/gems/amazon-ec2/test/test_Autoscaling_groups.rb +0 -337
- data/vendor/gems/amazon-ec2/test/test_EC2.rb +0 -68
- data/vendor/gems/amazon-ec2/test/test_EC2_availability_zones.rb +0 -49
- data/vendor/gems/amazon-ec2/test/test_EC2_console.rb +0 -54
- data/vendor/gems/amazon-ec2/test/test_EC2_elastic_ips.rb +0 -144
- data/vendor/gems/amazon-ec2/test/test_EC2_image_attributes.rb +0 -238
- data/vendor/gems/amazon-ec2/test/test_EC2_images.rb +0 -229
- data/vendor/gems/amazon-ec2/test/test_EC2_instances.rb +0 -611
- data/vendor/gems/amazon-ec2/test/test_EC2_keypairs.rb +0 -123
- data/vendor/gems/amazon-ec2/test/test_EC2_products.rb +0 -48
- data/vendor/gems/amazon-ec2/test/test_EC2_responses.rb +0 -53
- data/vendor/gems/amazon-ec2/test/test_EC2_s3_xmlsimple.rb +0 -80
- data/vendor/gems/amazon-ec2/test/test_EC2_security_groups.rb +0 -205
- data/vendor/gems/amazon-ec2/test/test_EC2_snapshots.rb +0 -83
- data/vendor/gems/amazon-ec2/test/test_EC2_volumes.rb +0 -142
- data/vendor/gems/amazon-ec2/test/test_ELB_load_balancers.rb +0 -239
- data/vendor/gems/amazon-ec2/test/test_RDS.rb +0 -354
- data/vendor/gems/amazon-ec2/test/test_helper.rb +0 -23
- data/vendor/gems/amazon-ec2/wsdl/2007-08-29.ec2.wsdl +0 -1269
- data/vendor/gems/amazon-ec2/wsdl/2008-02-01.ec2.wsdl +0 -1614
- data/vendor/gems/amazon-ec2/wsdl/2008-05-05.ec2.wsdl +0 -2052
- data/vendor/gems/amazon-ec2/wsdl/2008-12-01.ec2.wsdl +0 -2354
- data/vendor/gems/amazon-ec2/wsdl/2009-10-31.ec2.wsdl +0 -4261
- data/vendor/gems/amazon-ec2/wsdl/2009-11-30.ec2.wsdl +0 -4668
@@ -1,611 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Amazon Web Services EC2 Query API Ruby library
|
3
|
-
#
|
4
|
-
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
|
-
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
|
-
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
|
-
#++
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
12
|
-
|
13
|
-
context "EC2 instances " do
|
14
|
-
|
15
|
-
before do
|
16
|
-
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
|
-
|
18
|
-
@run_instances_response_body = <<-RESPONSE
|
19
|
-
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-08-29">
|
20
|
-
<reservationId>r-47a5402e</reservationId>
|
21
|
-
<ownerId>495219933132</ownerId>
|
22
|
-
<groupSet>
|
23
|
-
<item>
|
24
|
-
<groupId>default</groupId>
|
25
|
-
</item>
|
26
|
-
</groupSet>
|
27
|
-
<instancesSet>
|
28
|
-
<item>
|
29
|
-
<instanceId>i-2ba64342</instanceId>
|
30
|
-
<imageId>ami-60a54009</imageId>
|
31
|
-
<instanceState>
|
32
|
-
<code>0</code>
|
33
|
-
<name>pending</name>
|
34
|
-
</instanceState>
|
35
|
-
<privateDnsName></privateDnsName>
|
36
|
-
<dnsName></dnsName>
|
37
|
-
<keyName>example-key-name</keyName>
|
38
|
-
<amiLaunchIndex>0</amiLaunchIndex>
|
39
|
-
<instanceType>m1.small</instanceType>
|
40
|
-
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
|
41
|
-
</item>
|
42
|
-
<item>
|
43
|
-
<instanceId>i-2bc64242</instanceId>
|
44
|
-
<imageId>ami-60a54009</imageId>
|
45
|
-
<instanceState>
|
46
|
-
<code>0</code>
|
47
|
-
<name>pending</name>
|
48
|
-
</instanceState>
|
49
|
-
<privateDnsName></privateDnsName>
|
50
|
-
<dnsName></dnsName>
|
51
|
-
<keyName>example-key-name</keyName>
|
52
|
-
<amiLaunchIndex>1</amiLaunchIndex>
|
53
|
-
<instanceType>m1.small</instanceType>
|
54
|
-
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
|
55
|
-
</item>
|
56
|
-
<item>
|
57
|
-
<instanceId>i-2be64332</instanceId>
|
58
|
-
<imageId>ami-60a54009</imageId>
|
59
|
-
<instanceState>
|
60
|
-
<code>0</code>
|
61
|
-
<name>pending</name>
|
62
|
-
</instanceState>
|
63
|
-
<privateDnsName></privateDnsName>
|
64
|
-
<dnsName></dnsName>
|
65
|
-
<keyName>example-key-name</keyName>
|
66
|
-
<amiLaunchIndex>2</amiLaunchIndex>
|
67
|
-
<instanceType>m1.small</instanceType>
|
68
|
-
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
|
69
|
-
</item>
|
70
|
-
</instancesSet>
|
71
|
-
</RunInstancesResponse>
|
72
|
-
RESPONSE
|
73
|
-
|
74
|
-
@describe_instances_response_body = <<-RESPONSE
|
75
|
-
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-08-29">
|
76
|
-
<reservationSet>
|
77
|
-
<item>
|
78
|
-
<reservationId>r-44a5402d</reservationId>
|
79
|
-
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
|
80
|
-
<groupSet>
|
81
|
-
<item>
|
82
|
-
<groupId>default</groupId>
|
83
|
-
</item>
|
84
|
-
</groupSet>
|
85
|
-
<instancesSet>
|
86
|
-
<item>
|
87
|
-
<instanceId>i-28a64341</instanceId>
|
88
|
-
<imageId>ami-6ea54007</imageId>
|
89
|
-
<instanceState>
|
90
|
-
<code>0</code>
|
91
|
-
<name>running</name>
|
92
|
-
</instanceState>
|
93
|
-
<privateDnsName>domU-12-31-35-00-1E-01.z-2.compute-1.internal</privateDnsName>
|
94
|
-
<dnsName>ec2-72-44-33-4.z-2.compute-1.amazonaws.com</dnsName>
|
95
|
-
<keyName>example-key-name</keyName>
|
96
|
-
<productCodesSet>
|
97
|
-
<item><productCode>774F4FF8</productCode></item>
|
98
|
-
</productCodesSet>
|
99
|
-
<instanceType>m1.small</instanceType>
|
100
|
-
<launchTime>2007-08-07T11:54:42.000Z</launchTime>
|
101
|
-
</item>
|
102
|
-
</instancesSet>
|
103
|
-
</item>
|
104
|
-
</reservationSet>
|
105
|
-
</DescribeInstancesResponse>
|
106
|
-
RESPONSE
|
107
|
-
|
108
|
-
@reboot_instances_response_body = <<-RESPONSE
|
109
|
-
<RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
110
|
-
<return>true</return>
|
111
|
-
</RebootInstancesResponse>
|
112
|
-
RESPONSE
|
113
|
-
|
114
|
-
@start_instances_response_body = <<-RESPONSE
|
115
|
-
<StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-10-31/">
|
116
|
-
<instancesSet>
|
117
|
-
<item>
|
118
|
-
<instanceId>i-10a64379</instanceId>
|
119
|
-
<currentState>
|
120
|
-
<code>0</code>
|
121
|
-
<name>pending</name>
|
122
|
-
</currentState>
|
123
|
-
<previousState>
|
124
|
-
<code>80</code>
|
125
|
-
<name>stopped</name>
|
126
|
-
</previousState>
|
127
|
-
</item>
|
128
|
-
</instancesSet>
|
129
|
-
</StartInstancesResponse>
|
130
|
-
RESPONSE
|
131
|
-
|
132
|
-
|
133
|
-
@stop_instances_response_body = <<-RESPONSE
|
134
|
-
<StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-10-31/">
|
135
|
-
<instancesSet>
|
136
|
-
<item>
|
137
|
-
<instanceId>i-28a64341</instanceId>
|
138
|
-
<currentState>
|
139
|
-
<code>64</code>
|
140
|
-
<name>stopping</name>
|
141
|
-
</currentState>
|
142
|
-
<previousState>
|
143
|
-
<code>16</code>
|
144
|
-
<name>running</name>
|
145
|
-
</previousState>
|
146
|
-
</item>
|
147
|
-
</instancesSet>
|
148
|
-
</StopInstancesResponse>
|
149
|
-
RESPONSE
|
150
|
-
|
151
|
-
@terminate_instances_response_body = <<-RESPONSE
|
152
|
-
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
153
|
-
<instancesSet>
|
154
|
-
<item>
|
155
|
-
<instanceId>i-28a64341</instanceId>
|
156
|
-
<shutdownState>
|
157
|
-
<code>32</code>
|
158
|
-
<name>shutting-down</name>
|
159
|
-
</shutdownState>
|
160
|
-
<previousState>
|
161
|
-
<code>0</code>
|
162
|
-
<name>pending</name>
|
163
|
-
</previousState>
|
164
|
-
</item>
|
165
|
-
<item>
|
166
|
-
<instanceId>i-21a64348</instanceId>
|
167
|
-
<shutdownState>
|
168
|
-
<code>32</code>
|
169
|
-
<name>shutting-down</name>
|
170
|
-
</shutdownState>
|
171
|
-
<previousState>
|
172
|
-
<code>0</code>
|
173
|
-
<name>pending</name>
|
174
|
-
</previousState>
|
175
|
-
</item>
|
176
|
-
</instancesSet>
|
177
|
-
</TerminateInstancesResponse>
|
178
|
-
RESPONSE
|
179
|
-
|
180
|
-
@monitor_instances_response_body = <<-RESPONSE
|
181
|
-
<MonitorInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-07-15/">
|
182
|
-
<requestId>fe62a64c-49fb-4a3c-8d9b-61aba146d390</requestId>
|
183
|
-
<instancesSet>
|
184
|
-
<item>
|
185
|
-
<instanceId>i-138fc47a</instanceId>
|
186
|
-
<monitoring>
|
187
|
-
<state>pending</state>
|
188
|
-
</monitoring>
|
189
|
-
</item>
|
190
|
-
<item>
|
191
|
-
<instanceId>i-33457a5a</instanceId>
|
192
|
-
<monitoring>
|
193
|
-
<state>pending</state>
|
194
|
-
</monitoring>
|
195
|
-
</item>
|
196
|
-
</instancesSet>
|
197
|
-
</MonitorInstancesResponse>
|
198
|
-
RESPONSE
|
199
|
-
|
200
|
-
@unmonitor_instances_response_body = <<-RESPONSE
|
201
|
-
<UnmonitorInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-07-15/">
|
202
|
-
<requestId>7dbc5095-f3ae-46d8-a5b1-19df118ceb05</requestId>
|
203
|
-
<instancesSet>
|
204
|
-
<item>
|
205
|
-
<instanceId>i-138fc47a</instanceId>
|
206
|
-
<monitoring>
|
207
|
-
<state>disabling</state>
|
208
|
-
</monitoring>
|
209
|
-
</item>
|
210
|
-
<item>
|
211
|
-
<instanceId>i-33457a5a</instanceId>
|
212
|
-
<monitoring>
|
213
|
-
<state>disabling</state>
|
214
|
-
</monitoring>
|
215
|
-
</item>
|
216
|
-
</instancesSet>
|
217
|
-
</UnmonitorInstancesResponse>
|
218
|
-
|
219
|
-
RESPONSE
|
220
|
-
end
|
221
|
-
|
222
|
-
|
223
|
-
specify "should be able to be run" do
|
224
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1').
|
225
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
226
|
-
|
227
|
-
@ec2.run_instances( :image_id => "ami-60a54009" ).should.be.an.instance_of Hash
|
228
|
-
|
229
|
-
response = @ec2.run_instances( :image_id => "ami-60a54009" )
|
230
|
-
|
231
|
-
response.reservationId.should.equal "r-47a5402e"
|
232
|
-
response.ownerId.should.equal "495219933132"
|
233
|
-
|
234
|
-
response.instancesSet.item.length.should.equal 3
|
235
|
-
|
236
|
-
response.instancesSet.item[0].instanceId.should.equal "i-2ba64342"
|
237
|
-
response.instancesSet.item[0].imageId.should.equal "ami-60a54009"
|
238
|
-
response.instancesSet.item[0].instanceState.code.should.equal "0"
|
239
|
-
response.instancesSet.item[0].instanceState.name.should.equal "pending"
|
240
|
-
response.instancesSet.item[0].privateDnsName
|
241
|
-
response.instancesSet.item[0].dnsName.should.be.nil
|
242
|
-
response.instancesSet.item[0].keyName.should.equal "example-key-name"
|
243
|
-
response.instancesSet.item[0].instanceType.should.equal "m1.small"
|
244
|
-
response.instancesSet.item[0].launchTime.should.equal "2007-08-07T11:51:50.000Z"
|
245
|
-
|
246
|
-
response.instancesSet.item[1].instanceId.should.equal "i-2bc64242"
|
247
|
-
response.instancesSet.item[1].imageId.should.equal "ami-60a54009"
|
248
|
-
response.instancesSet.item[1].instanceState.code.should.equal "0"
|
249
|
-
response.instancesSet.item[1].instanceState.name.should.equal "pending"
|
250
|
-
response.instancesSet.item[1].privateDnsName
|
251
|
-
response.instancesSet.item[1].dnsName.should.be.nil
|
252
|
-
response.instancesSet.item[1].keyName.should.equal "example-key-name"
|
253
|
-
response.instancesSet.item[1].instanceType.should.equal "m1.small"
|
254
|
-
response.instancesSet.item[1].launchTime.should.equal "2007-08-07T11:51:50.000Z"
|
255
|
-
|
256
|
-
response.instancesSet.item[2].instanceId.should.equal "i-2be64332"
|
257
|
-
response.instancesSet.item[2].imageId.should.equal "ami-60a54009"
|
258
|
-
response.instancesSet.item[2].instanceState.code.should.equal "0"
|
259
|
-
response.instancesSet.item[2].instanceState.name.should.equal "pending"
|
260
|
-
response.instancesSet.item[2].privateDnsName
|
261
|
-
response.instancesSet.item[2].dnsName.should.be.nil
|
262
|
-
response.instancesSet.item[2].keyName.should.equal "example-key-name"
|
263
|
-
response.instancesSet.item[2].instanceType.should.equal "m1.small"
|
264
|
-
response.instancesSet.item[2].launchTime.should.equal "2007-08-07T11:51:50.000Z"
|
265
|
-
end
|
266
|
-
|
267
|
-
|
268
|
-
specify "method 'run_instances' should reject invalid arguments" do
|
269
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1').
|
270
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
271
|
-
|
272
|
-
lambda { @ec2.run_instances() }.should.raise(AWS::ArgumentError)
|
273
|
-
|
274
|
-
# :addressing_type is deprecated
|
275
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.not.raise(AWS::ArgumentError)
|
276
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(AWS::ArgumentError)
|
277
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(AWS::ArgumentError)
|
278
|
-
|
279
|
-
# :group_id is deprecated
|
280
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => nil ) }.should.not.raise(AWS::ArgumentError)
|
281
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => "" ) }.should.raise(AWS::ArgumentError)
|
282
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :group_id => "foo" ) }.should.raise(AWS::ArgumentError)
|
283
|
-
|
284
|
-
# :image_id
|
285
|
-
lambda { @ec2.run_instances( :image_id => nil ) }.should.raise(AWS::ArgumentError)
|
286
|
-
lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(AWS::ArgumentError)
|
287
|
-
|
288
|
-
# :min_count
|
289
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
290
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(AWS::ArgumentError)
|
291
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(AWS::ArgumentError)
|
292
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(AWS::ArgumentError)
|
293
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "foo" ) }.should.raise(AWS::ArgumentError)
|
294
|
-
|
295
|
-
# :max_count
|
296
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
297
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(AWS::ArgumentError)
|
298
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(AWS::ArgumentError)
|
299
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(AWS::ArgumentError)
|
300
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "foo" ) }.should.raise(AWS::ArgumentError)
|
301
|
-
|
302
|
-
# :min_count & :max_count
|
303
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
304
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 2, :max_count => 1 ) }.should.raise(AWS::ArgumentError)
|
305
|
-
|
306
|
-
# :instance_type
|
307
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceType" => 'm1.small').
|
308
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
309
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_type => "m1.small" ) }.should.not.raise(AWS::ArgumentError)
|
310
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_type => "m1.notarealsize" ) }.should.raise(AWS::ArgumentError)
|
311
|
-
|
312
|
-
# :monitoring_enabled
|
313
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Monitoring.Enabled" => 'true').
|
314
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
315
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => true ) }.should.not.raise(AWS::ArgumentError)
|
316
|
-
|
317
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Monitoring.Enabled" => 'false').
|
318
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
319
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => false ) }.should.not.raise(AWS::ArgumentError)
|
320
|
-
|
321
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Monitoring.Enabled" => 'false').
|
322
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
323
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => "foo" ) }.should.raise(AWS::ArgumentError)
|
324
|
-
|
325
|
-
# :disable_api_termination
|
326
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "DisableApiTermination" => 'true').
|
327
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
328
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => true ) }.should.not.raise(AWS::ArgumentError)
|
329
|
-
|
330
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "DisableApiTermination" => 'false').
|
331
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
332
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => false ) }.should.not.raise(AWS::ArgumentError)
|
333
|
-
|
334
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "DisableApiTermination" => 'false').
|
335
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
336
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => "foo" ) }.should.raise(AWS::ArgumentError)
|
337
|
-
|
338
|
-
# :instance_initiated_shutdown_behavior
|
339
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'stop').
|
340
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
341
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'stop' ) }.should.not.raise(AWS::ArgumentError)
|
342
|
-
|
343
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'terminate').
|
344
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
345
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'terminate' ) }.should.not.raise(AWS::ArgumentError)
|
346
|
-
|
347
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'stop').
|
348
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
349
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => "foo" ) }.should.raise(AWS::ArgumentError)
|
350
|
-
|
351
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceInitiatedShutdownBehavior" => 'stop').
|
352
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
353
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => true ) }.should.raise(AWS::ArgumentError)
|
354
|
-
|
355
|
-
# :base64_encoded
|
356
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(AWS::ArgumentError)
|
357
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(AWS::ArgumentError)
|
358
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(AWS::ArgumentError)
|
359
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(AWS::ArgumentError)
|
360
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(AWS::ArgumentError)
|
361
|
-
end
|
362
|
-
|
363
|
-
specify "should be able specify a key_name" do
|
364
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "KeyName" => 'foo').
|
365
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
366
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :key_name => "foo" ).should.be.an.instance_of Hash
|
367
|
-
end
|
368
|
-
|
369
|
-
specify "should be able specify a security_group" do
|
370
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "SecurityGroup.1" => 'foo', "SecurityGroup.2" => 'bar').
|
371
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
372
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :security_group => ["foo","bar"] ).should.be.an.instance_of Hash
|
373
|
-
end
|
374
|
-
|
375
|
-
specify "should be able specify additional_info" do
|
376
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "AdditionalInfo" => 'foo').
|
377
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
378
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :additional_info => "foo" ).should.be.an.instance_of Hash
|
379
|
-
end
|
380
|
-
|
381
|
-
specify "should be able to call run_instances with :user_data and :base64_encoded => true (default is false)" do
|
382
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "UserData" => "Zm9v").
|
383
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
384
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :user_data => "foo", :base64_encoded => true ).should.be.an.instance_of Hash
|
385
|
-
end
|
386
|
-
|
387
|
-
specify "should be able to call run_instances with :user_data and :base64_encoded => false" do
|
388
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "UserData" => "foo").
|
389
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
390
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :user_data => "foo", :base64_encoded => false ).should.be.an.instance_of Hash
|
391
|
-
end
|
392
|
-
|
393
|
-
specify "should be able specify instance_type" do
|
394
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "InstanceType" => 'm1.small').
|
395
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
396
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :instance_type => "m1.small" ).should.be.an.instance_of Hash
|
397
|
-
end
|
398
|
-
|
399
|
-
specify "should be able specify an availability_zone (Placement.AvailabilityZone)" do
|
400
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "Placement.AvailabilityZone" => "zone123").
|
401
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
402
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :availability_zone => "zone123" ).should.be.an.instance_of Hash
|
403
|
-
end
|
404
|
-
|
405
|
-
specify "should be able specify an kernel_id" do
|
406
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'KernelId' => 'kernfoo').
|
407
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
408
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :kernel_id => 'kernfoo' ).should.be.an.instance_of Hash
|
409
|
-
end
|
410
|
-
|
411
|
-
specify "should be able specify an ramdisk_id" do
|
412
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'RamdiskId' => 'foo').
|
413
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
414
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :ramdisk_id => 'foo' ).should.be.an.instance_of Hash
|
415
|
-
end
|
416
|
-
|
417
|
-
specify "should be able specify monitoring_enabled" do
|
418
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'Monitoring.Enabled' => 'true').
|
419
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
420
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :monitoring_enabled => true ).should.be.an.instance_of Hash
|
421
|
-
end
|
422
|
-
|
423
|
-
specify "should be able specify an subnet_id" do
|
424
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'SubnetId' => 'foo').
|
425
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
426
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :subnet_id => 'foo' ).should.be.an.instance_of Hash
|
427
|
-
end
|
428
|
-
|
429
|
-
specify "should be able specify disable_api_termination" do
|
430
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'DisableApiTermination' => 'true').
|
431
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
432
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :disable_api_termination => true ).should.be.an.instance_of Hash
|
433
|
-
end
|
434
|
-
|
435
|
-
specify "should be able specify instance_initiated_shutdown_behavior" do
|
436
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'InstanceInitiatedShutdownBehavior' => 'stop').
|
437
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
438
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :instance_initiated_shutdown_behavior => 'stop' ).should.be.an.instance_of Hash
|
439
|
-
end
|
440
|
-
|
441
|
-
specify "should be able specify block_device_mapping" do
|
442
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'BlockDeviceMapping.1.DeviceName' => '/dev/sdh', 'BlockDeviceMapping.1.VirtualName' => 'foo', 'BlockDeviceMapping.1.Ebs.SnapshotId' => 'foosnap', 'BlockDeviceMapping.1.Ebs.VolumeSize' => 'foovolsize', 'BlockDeviceMapping.1.Ebs.DeleteOnTermination' => 'true', 'BlockDeviceMapping.2.DeviceName' => '/dev/sdi', 'BlockDeviceMapping.2.VirtualName' => 'foo2', 'BlockDeviceMapping.2.Ebs.SnapshotId' => 'foosnap2', 'BlockDeviceMapping.2.Ebs.VolumeSize' => 'foovolsize2', 'BlockDeviceMapping.2.Ebs.DeleteOnTermination' => 'false').
|
443
|
-
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
444
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :block_device_mapping => [{:device_name => '/dev/sdh', :virtual_name => 'foo', :ebs_snapshot_id => 'foosnap', :ebs_volume_size => 'foovolsize', :ebs_delete_on_termination => true},{:device_name => '/dev/sdi', :virtual_name => 'foo2', :ebs_snapshot_id => 'foosnap2', :ebs_volume_size => 'foovolsize2', :ebs_delete_on_termination => false}] ).should.be.an.instance_of Hash
|
445
|
-
end
|
446
|
-
|
447
|
-
specify "should get no user data for when options has no user_data key" do
|
448
|
-
@ec2.extract_user_data({}).should == nil
|
449
|
-
end
|
450
|
-
|
451
|
-
specify "should get plain string user data when options has user_data and no base64 key" do
|
452
|
-
@ec2.extract_user_data({:user_data => "foo\nbar"}).should == "foo\nbar"
|
453
|
-
end
|
454
|
-
|
455
|
-
specify "should strip new lines and base64 encode when options has both user_data and base64" do
|
456
|
-
@ec2.extract_user_data({:user_data => "binary\ndata\nhere\n", :base64_encoded => true}).should == "YmluYXJ5CmRhdGEKaGVyZQo="
|
457
|
-
end
|
458
|
-
|
459
|
-
|
460
|
-
specify "should be able to be described and return the correct Ruby response class" do
|
461
|
-
@ec2.stubs(:make_request).with('DescribeInstances', {}).
|
462
|
-
returns stub(:body => @describe_instances_response_body, :is_a? => true)
|
463
|
-
@ec2.describe_instances.should.be.an.instance_of Hash
|
464
|
-
response = @ec2.describe_instances
|
465
|
-
response.reservationSet.item[0].reservationId.should.equal "r-44a5402d"
|
466
|
-
end
|
467
|
-
|
468
|
-
|
469
|
-
specify "should be able to be described with no params and return an array of Items" do
|
470
|
-
@ec2.stubs(:make_request).with('DescribeInstances', {}).
|
471
|
-
returns stub(:body => @describe_instances_response_body, :is_a? => true)
|
472
|
-
@ec2.describe_instances.reservationSet.item.length.should.equal 1
|
473
|
-
response = @ec2.describe_instances
|
474
|
-
response.reservationSet.item[0].reservationId.should.equal "r-44a5402d"
|
475
|
-
response.reservationSet.item[0].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
|
476
|
-
response.reservationSet.item[0].instancesSet.item[0].instanceId.should.equal "i-28a64341"
|
477
|
-
response.reservationSet.item[0].instancesSet.item[0].imageId.should.equal "ami-6ea54007"
|
478
|
-
response.reservationSet.item[0].instancesSet.item[0].instanceState.code.should.equal "0"
|
479
|
-
response.reservationSet.item[0].instancesSet.item[0].instanceState.name.should.equal "running"
|
480
|
-
response.reservationSet.item[0].instancesSet.item[0].privateDnsName.should.equal "domU-12-31-35-00-1E-01.z-2.compute-1.internal"
|
481
|
-
response.reservationSet.item[0].instancesSet.item[0].dnsName.should.equal "ec2-72-44-33-4.z-2.compute-1.amazonaws.com"
|
482
|
-
response.reservationSet.item[0].instancesSet.item[0].keyName.should.equal "example-key-name"
|
483
|
-
response.reservationSet.item[0].instancesSet.item[0].productCodesSet.item[0].productCode.should.equal "774F4FF8"
|
484
|
-
end
|
485
|
-
|
486
|
-
|
487
|
-
specify "should be able to be described with params of Array of :instance_id's and return an array of Items" do
|
488
|
-
@ec2.stubs(:make_request).with('DescribeInstances', {"InstanceId.1" => "i-28a64341"}).
|
489
|
-
returns stub(:body => @describe_instances_response_body, :is_a? => true)
|
490
|
-
@ec2.describe_instances( :instance_id => "i-28a64341" ).reservationSet.item.length.should.equal 1
|
491
|
-
response = @ec2.describe_instances( :instance_id => "i-28a64341" )
|
492
|
-
response.reservationSet.item[0].reservationId.should.equal "r-44a5402d"
|
493
|
-
response.reservationSet.item[0].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
|
494
|
-
response.reservationSet.item[0].instancesSet.item[0].instanceId.should.equal "i-28a64341"
|
495
|
-
response.reservationSet.item[0].instancesSet.item[0].imageId.should.equal "ami-6ea54007"
|
496
|
-
response.reservationSet.item[0].instancesSet.item[0].instanceState.code.should.equal "0"
|
497
|
-
response.reservationSet.item[0].instancesSet.item[0].instanceState.name.should.equal "running"
|
498
|
-
response.reservationSet.item[0].instancesSet.item[0].privateDnsName.should.equal "domU-12-31-35-00-1E-01.z-2.compute-1.internal"
|
499
|
-
response.reservationSet.item[0].instancesSet.item[0].dnsName.should.equal "ec2-72-44-33-4.z-2.compute-1.amazonaws.com"
|
500
|
-
response.reservationSet.item[0].instancesSet.item[0].keyName.should.equal "example-key-name"
|
501
|
-
response.reservationSet.item[0].instancesSet.item[0].productCodesSet.item[0].productCode.should.equal "774F4FF8"
|
502
|
-
end
|
503
|
-
|
504
|
-
|
505
|
-
specify "method reboot_instances should raise an exception when called without nil/empty string arguments" do
|
506
|
-
lambda { @ec2.reboot_instances() }.should.raise(AWS::ArgumentError)
|
507
|
-
lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
508
|
-
lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
509
|
-
end
|
510
|
-
|
511
|
-
|
512
|
-
specify "should be able to be rebooted when provided with an :instance_id" do
|
513
|
-
@ec2.expects(:make_request).with('RebootInstances', {"InstanceId.1"=>"i-2ea64347", "InstanceId.2"=>"i-21a64348"}).
|
514
|
-
returns stub(:body => @reboot_instances_response_body, :is_a? => true)
|
515
|
-
@ec2.reboot_instances( :instance_id => ["i-2ea64347", "i-21a64348"] ).class.should.equal Hash
|
516
|
-
end
|
517
|
-
|
518
|
-
|
519
|
-
specify "method start_instances should raise an exception when called without nil/empty string arguments" do
|
520
|
-
lambda { @ec2.start_instances() }.should.raise(AWS::ArgumentError)
|
521
|
-
lambda { @ec2.start_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
522
|
-
lambda { @ec2.start_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
523
|
-
end
|
524
|
-
|
525
|
-
|
526
|
-
specify "should be able to be started when provided with an :instance_id" do
|
527
|
-
@ec2.stubs(:make_request).with('StartInstances', {"InstanceId.1"=>"i-28a64341", "InstanceId.2"=>"i-21a64348"}).
|
528
|
-
returns stub(:body => @start_instances_response_body, :is_a? => true)
|
529
|
-
@ec2.start_instances( :instance_id => ["i-28a64341", "i-21a64348"] ).class.should.equal Hash
|
530
|
-
end
|
531
|
-
|
532
|
-
|
533
|
-
specify "method stop_instances should raise an exception when called without nil/empty string arguments" do
|
534
|
-
lambda { @ec2.stop_instances() }.should.raise(AWS::ArgumentError)
|
535
|
-
lambda { @ec2.stop_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
536
|
-
lambda { @ec2.stop_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
537
|
-
end
|
538
|
-
|
539
|
-
specify "should be able to be stopped when provided with an :instance_id" do
|
540
|
-
@ec2.stubs(:make_request).with('StopInstances', {"InstanceId.1"=>"i-28a64341", "InstanceId.2"=>"i-21a64348"}).
|
541
|
-
returns stub(:body => @stop_instances_response_body, :is_a? => true)
|
542
|
-
@ec2.stop_instances( :instance_id => ["i-28a64341", "i-21a64348"] ).class.should.equal Hash
|
543
|
-
end
|
544
|
-
|
545
|
-
specify "method terminate_instances should raise an exception when called without nil/empty string arguments" do
|
546
|
-
lambda { @ec2.terminate_instances() }.should.raise(AWS::ArgumentError)
|
547
|
-
lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
548
|
-
lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
549
|
-
end
|
550
|
-
|
551
|
-
specify "should be able to be terminated when provided with an :instance_id" do
|
552
|
-
@ec2.stubs(:make_request).with('TerminateInstances', {"InstanceId.1"=>"i-28a64341", "InstanceId.2"=>"i-21a64348"}).
|
553
|
-
returns stub(:body => @terminate_instances_response_body, :is_a? => true)
|
554
|
-
@ec2.terminate_instances( :instance_id => ["i-28a64341", "i-21a64348"] ).class.should.equal Hash
|
555
|
-
|
556
|
-
@response = @ec2.terminate_instances( :instance_id => ["i-28a64341", "i-21a64348"] )
|
557
|
-
|
558
|
-
@response.instancesSet.item[0].instanceId.should.equal "i-28a64341"
|
559
|
-
@response.instancesSet.item[0].shutdownState.code.should.equal "32"
|
560
|
-
@response.instancesSet.item[0].shutdownState.name.should.equal "shutting-down"
|
561
|
-
@response.instancesSet.item[0].previousState.code.should.equal "0"
|
562
|
-
@response.instancesSet.item[0].previousState.name.should.equal "pending"
|
563
|
-
|
564
|
-
@response.instancesSet.item[1].instanceId.should.equal "i-21a64348"
|
565
|
-
@response.instancesSet.item[1].shutdownState.code.should.equal "32"
|
566
|
-
@response.instancesSet.item[1].shutdownState.name.should.equal "shutting-down"
|
567
|
-
@response.instancesSet.item[1].previousState.code.should.equal "0"
|
568
|
-
@response.instancesSet.item[1].previousState.name.should.equal "pending"
|
569
|
-
end
|
570
|
-
|
571
|
-
specify "method monitor_instances should raise an exception when called without nil/empty string arguments" do
|
572
|
-
lambda { @ec2.monitor_instances() }.should.raise(AWS::ArgumentError)
|
573
|
-
lambda { @ec2.monitor_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
574
|
-
lambda { @ec2.monitor_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
575
|
-
end
|
576
|
-
|
577
|
-
specify "should be able to be monitored when provided with an :instance_id" do
|
578
|
-
@ec2.stubs(:make_request).with('MonitorInstances', {"InstanceId.1"=>"i-138fc47a", "InstanceId.2"=>"i-33457a5a"}).
|
579
|
-
returns stub(:body => @monitor_instances_response_body, :is_a? => true)
|
580
|
-
@ec2.monitor_instances( :instance_id => ["i-138fc47a", "i-33457a5a"] ).class.should.equal Hash
|
581
|
-
|
582
|
-
@response = @ec2.monitor_instances( :instance_id => ["i-138fc47a", "i-33457a5a"] )
|
583
|
-
|
584
|
-
@response.instancesSet.item[0].instanceId.should.equal "i-138fc47a"
|
585
|
-
@response.instancesSet.item[0].monitoring.state.should.equal "pending"
|
586
|
-
|
587
|
-
@response.instancesSet.item[1].instanceId.should.equal "i-33457a5a"
|
588
|
-
@response.instancesSet.item[1].monitoring.state.should.equal "pending"
|
589
|
-
end
|
590
|
-
|
591
|
-
specify "method unmonitor_instances should raise an exception when called without nil/empty string arguments" do
|
592
|
-
lambda { @ec2.unmonitor_instances() }.should.raise(AWS::ArgumentError)
|
593
|
-
lambda { @ec2.unmonitor_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
594
|
-
lambda { @ec2.unmonitor_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
595
|
-
end
|
596
|
-
|
597
|
-
specify "should be able to be unmonitored when provided with an :instance_id" do
|
598
|
-
@ec2.stubs(:make_request).with('UnmonitorInstances', {"InstanceId.1"=>"i-138fc47a", "InstanceId.2"=>"i-33457a5a"}).
|
599
|
-
returns stub(:body => @unmonitor_instances_response_body, :is_a? => true)
|
600
|
-
@ec2.unmonitor_instances( :instance_id => ["i-138fc47a", "i-33457a5a"] ).class.should.equal Hash
|
601
|
-
|
602
|
-
@response = @ec2.unmonitor_instances( :instance_id => ["i-138fc47a", "i-33457a5a"] )
|
603
|
-
|
604
|
-
@response.instancesSet.item[0].instanceId.should.equal "i-138fc47a"
|
605
|
-
@response.instancesSet.item[0].monitoring.state.should.equal "disabling"
|
606
|
-
|
607
|
-
@response.instancesSet.item[1].instanceId.should.equal "i-33457a5a"
|
608
|
-
@response.instancesSet.item[1].monitoring.state.should.equal "disabling"
|
609
|
-
end
|
610
|
-
|
611
|
-
end
|