poolparty 1.4.6 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +2 -2
- data/bin/cloud-contract +6 -1
- data/bin/cloud-list +5 -6
- data/bin/cloud-vnc +39 -0
- data/examples/rds_cloud.rb +44 -0
- data/lib/cloud_providers/connections.rb +0 -1
- data/lib/cloud_providers/ec2/ec2.rb +86 -25
- data/lib/cloud_providers/ec2/ec2_instance.rb +6 -2
- data/lib/cloud_providers/ec2/helpers/ec2_helper.rb +19 -6
- data/lib/cloud_providers/ec2/helpers/elastic_load_balancer.rb +3 -3
- data/lib/cloud_providers/ec2/helpers/rds_instance.rb +110 -0
- data/lib/cloud_providers/remote_instance.rb +5 -3
- data/lib/poolparty/cloud.rb +8 -3
- data/lib/poolparty/pool.rb +12 -0
- data/test/fixtures/clouds/rds_cloud.rb +14 -0
- data/test/fixtures/clouds/rds_missing_params.rb +11 -0
- data/test/fixtures/ec2/ec2-describe-security-groups_response_body.xml +23 -0
- data/test/fixtures/ec2/rds-describe-db-instances-empty_response_body.xml +9 -0
- data/test/lib/poolparty/rds_test.rb +35 -0
- data/test/test_helper.rb +4 -4
- data/vendor/gems/amazon-ec2/ChangeLog +15 -0
- data/vendor/gems/amazon-ec2/README.rdoc +27 -24
- data/vendor/gems/amazon-ec2/README_dev.rdoc +0 -2
- data/vendor/gems/amazon-ec2/Rakefile +8 -39
- data/vendor/gems/amazon-ec2/VERSION +1 -1
- data/vendor/gems/amazon-ec2/amazon-ec2.gemspec +24 -16
- data/vendor/gems/amazon-ec2/bin/setup.rb +1 -0
- data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling/autoscaling.rb +6 -16
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/availability_zones.rb +8 -0
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/console.rb +2 -0
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/devpay.rb +18 -0
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/elastic_ips.rb +37 -32
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/images.rb +43 -27
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/instances.rb +136 -99
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/keypairs.rb +3 -17
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/security_groups.rb +4 -23
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/snapshots.rb +38 -17
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/volumes.rb +6 -21
- data/vendor/gems/amazon-ec2/lib/AWS/EC2.rb +2 -2
- data/vendor/gems/amazon-ec2/lib/AWS/ELB/load_balancers.rb +11 -38
- data/vendor/gems/amazon-ec2/lib/AWS/RDS/rds.rb +522 -0
- data/vendor/gems/amazon-ec2/lib/AWS/RDS.rb +73 -0
- data/vendor/gems/amazon-ec2/lib/AWS/exceptions.rb +103 -25
- data/vendor/gems/amazon-ec2/lib/AWS.rb +19 -9
- data/vendor/gems/amazon-ec2/perftools/ec2prof +0 -0
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.dot +130 -191
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.txt +100 -126
- data/vendor/gems/amazon-ec2/perftools/ec2prof.symbols +102 -129
- data/vendor/gems/amazon-ec2/test/test_Autoscaling_groups.rb +3 -2
- data/vendor/gems/amazon-ec2/test/test_EC2_images.rb +32 -0
- data/vendor/gems/amazon-ec2/test/test_EC2_instances.rb +204 -22
- data/vendor/gems/amazon-ec2/test/test_EC2_snapshots.rb +1 -1
- data/vendor/gems/amazon-ec2/test/test_ELB_load_balancers.rb +2 -2
- data/vendor/gems/amazon-ec2/test/test_RDS.rb +354 -0
- data/vendor/gems/amazon-ec2/wsdl/2009-10-31.ec2.wsdl +4261 -0
- data/vendor/gems/amazon-ec2/wsdl/2009-11-30.ec2.wsdl +4668 -0
- metadata +17 -2
|
@@ -111,6 +111,43 @@ context "EC2 instances " do
|
|
|
111
111
|
</RebootInstancesResponse>
|
|
112
112
|
RESPONSE
|
|
113
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
|
+
|
|
114
151
|
@terminate_instances_response_body = <<-RESPONSE
|
|
115
152
|
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
|
116
153
|
<instancesSet>
|
|
@@ -184,7 +221,7 @@ context "EC2 instances " do
|
|
|
184
221
|
|
|
185
222
|
|
|
186
223
|
specify "should be able to be run" do
|
|
187
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1'
|
|
224
|
+
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1').
|
|
188
225
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
189
226
|
|
|
190
227
|
@ec2.run_instances( :image_id => "ami-60a54009" ).should.be.an.instance_of Hash
|
|
@@ -194,8 +231,6 @@ context "EC2 instances " do
|
|
|
194
231
|
response.reservationId.should.equal "r-47a5402e"
|
|
195
232
|
response.ownerId.should.equal "495219933132"
|
|
196
233
|
|
|
197
|
-
response.groupSet.item[0].groupId.should.equal "default"
|
|
198
|
-
|
|
199
234
|
response.instancesSet.item.length.should.equal 3
|
|
200
235
|
|
|
201
236
|
response.instancesSet.item[0].instanceId.should.equal "i-2ba64342"
|
|
@@ -231,28 +266,93 @@ context "EC2 instances " do
|
|
|
231
266
|
|
|
232
267
|
|
|
233
268
|
specify "method 'run_instances' should reject invalid arguments" do
|
|
234
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1'
|
|
269
|
+
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1').
|
|
235
270
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
236
271
|
|
|
237
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)
|
|
238
286
|
lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(AWS::ArgumentError)
|
|
239
287
|
|
|
288
|
+
# :min_count
|
|
240
289
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
|
241
290
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(AWS::ArgumentError)
|
|
242
291
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(AWS::ArgumentError)
|
|
243
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)
|
|
244
294
|
|
|
295
|
+
# :max_count
|
|
245
296
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
|
246
297
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(AWS::ArgumentError)
|
|
247
298
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(AWS::ArgumentError)
|
|
248
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)
|
|
249
301
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :
|
|
253
|
-
|
|
254
|
-
|
|
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)
|
|
255
354
|
|
|
355
|
+
# :base64_encoded
|
|
256
356
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(AWS::ArgumentError)
|
|
257
357
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(AWS::ArgumentError)
|
|
258
358
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(AWS::ArgumentError)
|
|
@@ -260,29 +360,88 @@ context "EC2 instances " do
|
|
|
260
360
|
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(AWS::ArgumentError)
|
|
261
361
|
end
|
|
262
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
|
|
263
374
|
|
|
264
|
-
specify "should be able specify
|
|
265
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "
|
|
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').
|
|
266
377
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
267
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :
|
|
378
|
+
@ec2.run_instances( :image_id => "ami-60a54009", :additional_info => "foo" ).should.be.an.instance_of Hash
|
|
268
379
|
end
|
|
269
380
|
|
|
270
381
|
specify "should be able to call run_instances with :user_data and :base64_encoded => true (default is false)" do
|
|
271
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "UserData" => "Zm9v"
|
|
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").
|
|
272
389
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
273
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :
|
|
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
|
|
274
403
|
end
|
|
275
404
|
|
|
276
405
|
specify "should be able specify an kernel_id" do
|
|
277
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1',
|
|
406
|
+
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', 'KernelId' => 'kernfoo').
|
|
278
407
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
279
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :
|
|
408
|
+
@ec2.run_instances( :image_id => "ami-60a54009", :kernel_id => 'kernfoo' ).should.be.an.instance_of Hash
|
|
280
409
|
end
|
|
281
410
|
|
|
282
|
-
specify "should be able
|
|
283
|
-
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1',
|
|
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').
|
|
284
413
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
|
285
|
-
@ec2.run_instances( :image_id => "ami-60a54009", :
|
|
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
|
|
286
445
|
end
|
|
287
446
|
|
|
288
447
|
specify "should get no user data for when options has no user_data key" do
|
|
@@ -314,7 +473,6 @@ context "EC2 instances " do
|
|
|
314
473
|
response = @ec2.describe_instances
|
|
315
474
|
response.reservationSet.item[0].reservationId.should.equal "r-44a5402d"
|
|
316
475
|
response.reservationSet.item[0].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
|
|
317
|
-
response.reservationSet.item[0].groupSet.item[0].groupId.should.equal "default"
|
|
318
476
|
response.reservationSet.item[0].instancesSet.item[0].instanceId.should.equal "i-28a64341"
|
|
319
477
|
response.reservationSet.item[0].instancesSet.item[0].imageId.should.equal "ami-6ea54007"
|
|
320
478
|
response.reservationSet.item[0].instancesSet.item[0].instanceState.code.should.equal "0"
|
|
@@ -333,7 +491,6 @@ context "EC2 instances " do
|
|
|
333
491
|
response = @ec2.describe_instances( :instance_id => "i-28a64341" )
|
|
334
492
|
response.reservationSet.item[0].reservationId.should.equal "r-44a5402d"
|
|
335
493
|
response.reservationSet.item[0].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
|
|
336
|
-
response.reservationSet.item[0].groupSet.item[0].groupId.should.equal "default"
|
|
337
494
|
response.reservationSet.item[0].instancesSet.item[0].instanceId.should.equal "i-28a64341"
|
|
338
495
|
response.reservationSet.item[0].instancesSet.item[0].imageId.should.equal "ami-6ea54007"
|
|
339
496
|
response.reservationSet.item[0].instancesSet.item[0].instanceState.code.should.equal "0"
|
|
@@ -359,13 +516,38 @@ context "EC2 instances " do
|
|
|
359
516
|
end
|
|
360
517
|
|
|
361
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
|
+
|
|
362
545
|
specify "method terminate_instances should raise an exception when called without nil/empty string arguments" do
|
|
363
546
|
lambda { @ec2.terminate_instances() }.should.raise(AWS::ArgumentError)
|
|
364
547
|
lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
|
365
548
|
lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
|
366
549
|
end
|
|
367
550
|
|
|
368
|
-
|
|
369
551
|
specify "should be able to be terminated when provided with an :instance_id" do
|
|
370
552
|
@ec2.stubs(:make_request).with('TerminateInstances', {"InstanceId.1"=>"i-28a64341", "InstanceId.2"=>"i-21a64348"}).
|
|
371
553
|
returns stub(:body => @terminate_instances_response_body, :is_a? => true)
|
|
@@ -45,7 +45,7 @@ context "EC2 snaphots " do
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
specify "should be able to be described with describe_snapshots" do
|
|
48
|
-
@ec2.stubs(:make_request).with('DescribeSnapshots', {
|
|
48
|
+
@ec2.stubs(:make_request).with('DescribeSnapshots', {'SnapshotId.1' => 'snap-78a54011'}).
|
|
49
49
|
returns stub(:body => @describe_snapshots_response_body, :is_a? => true)
|
|
50
50
|
|
|
51
51
|
@ec2.describe_snapshots( :snapshot_id => "snap-78a54011" ).should.be.an.instance_of Hash
|
|
@@ -163,7 +163,7 @@ context "elb load balancers " do
|
|
|
163
163
|
specify "should be able to be register instances to load balancers with register_instances_with_load_balancer" do
|
|
164
164
|
@elb.stubs(:make_request).with('RegisterInstancesWithLoadBalancer', {
|
|
165
165
|
'LoadBalancerName' => 'Test Name',
|
|
166
|
-
'Instances.member.1' => 'i-6055fa09'
|
|
166
|
+
'Instances.member.1.InstanceId' => 'i-6055fa09'
|
|
167
167
|
}).returns stub(:body => @register_instances_with_load_balancer_response_body, :is_a? => true)
|
|
168
168
|
|
|
169
169
|
response = @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params)
|
|
@@ -175,7 +175,7 @@ context "elb load balancers " do
|
|
|
175
175
|
specify "method register_instances_with_load_balancer should reject bad arguments" do
|
|
176
176
|
@elb.stubs(:make_request).with('RegisterInstancesWithLoadBalancer', {
|
|
177
177
|
'LoadBalancerName' => 'Test Name',
|
|
178
|
-
'Instances.member.1' => 'i-6055fa09'
|
|
178
|
+
'Instances.member.1.InstanceId' => 'i-6055fa09'
|
|
179
179
|
}).returns stub(:body => @register_instances_with_load_balancer_response_body, :is_a? => true)
|
|
180
180
|
|
|
181
181
|
lambda { @elb.register_instances_with_load_balancer(@valid_register_instances_with_load_balancer_params) }.should.not.raise(AWS::ArgumentError)
|