amazon-ec2 0.4.8 → 0.5.0
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/ChangeLog +7 -4
- data/README.rdoc +12 -12
- data/README_dev.rdoc +6 -0
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/amazon-ec2.gemspec +25 -18
- data/bin/ec2-gem-example.rb +3 -3
- data/bin/ec2-gem-profile.rb +2 -2
- data/bin/ec2sh +4 -4
- data/bin/setup.rb +4 -2
- data/lib/{EC2.rb → AWS.rb} +33 -67
- data/lib/AWS/EC2.rb +67 -0
- data/lib/AWS/EC2/availability_zones.rb +43 -0
- data/lib/AWS/EC2/console.rb +46 -0
- data/lib/AWS/EC2/elastic_ips.rb +154 -0
- data/lib/AWS/EC2/image_attributes.rb +168 -0
- data/lib/AWS/EC2/images.rb +136 -0
- data/lib/AWS/EC2/instances.rb +218 -0
- data/lib/AWS/EC2/keypairs.rb +96 -0
- data/lib/AWS/EC2/products.rb +45 -0
- data/lib/AWS/EC2/security_groups.rb +234 -0
- data/lib/AWS/EC2/snapshots.rb +96 -0
- data/lib/AWS/EC2/volumes.rb +172 -0
- data/lib/AWS/ELB.rb +67 -0
- data/lib/AWS/ELB/load_balancers.rb +198 -0
- data/lib/{EC2 → AWS}/exceptions.rb +21 -2
- data/lib/{EC2 → AWS}/responses.rb +4 -5
- data/perftools/ec2prof-results.txt +4 -4
- data/perftools/ec2prof.symbols +4 -4
- data/test/test_EC2.rb +14 -14
- data/test/test_EC2_availability_zones.rb +2 -2
- data/test/test_EC2_console.rb +5 -5
- data/test/test_EC2_elastic_ips.rb +13 -13
- data/test/test_EC2_image_attributes.rb +35 -35
- data/test/test_EC2_images.rb +7 -7
- data/test/test_EC2_instances.rb +35 -35
- data/test/test_EC2_keypairs.rb +10 -10
- data/test/test_EC2_products.rb +7 -7
- data/test/test_EC2_responses.rb +2 -2
- data/test/test_EC2_s3_xmlsimple.rb +2 -2
- data/test/test_EC2_security_groups.rb +13 -13
- data/test/test_EC2_snapshots.rb +2 -2
- data/test/test_EC2_volumes.rb +2 -2
- data/test/test_ELB_load_balancers.rb +239 -0
- data/test/test_helper.rb +1 -1
- metadata +24 -17
- data/lib/EC2/availability_zones.rb +0 -41
- data/lib/EC2/console.rb +0 -44
- data/lib/EC2/elastic_ips.rb +0 -153
- data/lib/EC2/image_attributes.rb +0 -166
- data/lib/EC2/images.rb +0 -134
- data/lib/EC2/instances.rb +0 -216
- data/lib/EC2/keypairs.rb +0 -94
- data/lib/EC2/products.rb +0 -43
- data/lib/EC2/security_groups.rb +0 -232
- data/lib/EC2/snapshots.rb +0 -94
- data/lib/EC2/volumes.rb +0 -170
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "EC2 availability zones" do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@describe_availability_zones_response_body = <<-RESPONSE
|
19
19
|
<DescribeAvailabilityZonesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01/">
|
data/test/test_EC2_console.rb
CHANGED
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "The EC2 console " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@get_console_output_response_body = <<-RESPONSE
|
19
19
|
<GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
@@ -45,9 +45,9 @@ context "The EC2 console " do
|
|
45
45
|
|
46
46
|
|
47
47
|
specify "method get_console_output should raise an exception when called without nil/empty string arguments" do
|
48
|
-
lambda { @ec2.get_console_output() }.should.raise(
|
49
|
-
lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(
|
50
|
-
lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(
|
48
|
+
lambda { @ec2.get_console_output() }.should.raise(AWS::ArgumentError)
|
49
|
+
lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(AWS::ArgumentError)
|
50
|
+
lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(AWS::ArgumentError)
|
51
51
|
end
|
52
52
|
|
53
53
|
|
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "EC2 elastic IP addresses " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@allocate_address_body = <<-RESPONSE
|
19
19
|
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
|
@@ -68,10 +68,10 @@ context "EC2 elastic IP addresses " do
|
|
68
68
|
# @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
|
69
69
|
# returns stub(:body => @create_keypair_response_body, :is_a? => true)
|
70
70
|
#
|
71
|
-
# lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(
|
72
|
-
# lambda { @ec2.create_keypair() }.should.raise(
|
73
|
-
# lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(
|
74
|
-
# lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(
|
71
|
+
# lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
|
72
|
+
# lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError)
|
73
|
+
# lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
|
74
|
+
# lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
|
75
75
|
#end
|
76
76
|
|
77
77
|
|
@@ -113,10 +113,10 @@ context "EC2 elastic IP addresses " do
|
|
113
113
|
@ec2.stubs(:make_request).with('AssociateAddress', {"InstanceId" => "i-2ea64347", "PublicIp"=>"67.202.55.255"}).
|
114
114
|
returns stub(:body => @associate_address_response_body, :is_a? => true)
|
115
115
|
|
116
|
-
lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(
|
117
|
-
lambda { @ec2.associate_address() }.should.raise(
|
118
|
-
lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(
|
119
|
-
lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(
|
116
|
+
lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError)
|
117
|
+
lambda { @ec2.associate_address() }.should.raise(AWS::ArgumentError)
|
118
|
+
lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
119
|
+
lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError)
|
120
120
|
end
|
121
121
|
|
122
122
|
|
@@ -135,9 +135,9 @@ context "EC2 elastic IP addresses " do
|
|
135
135
|
@ec2.stubs(:make_request).with('DisassociateAddress', {'PublicIp' => '67.202.55.255'}).
|
136
136
|
returns stub(:body => @disassociate_address_response_body, :is_a? => true)
|
137
137
|
|
138
|
-
lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(
|
139
|
-
lambda { @ec2.disassociate_address() }.should.raise(
|
140
|
-
lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(
|
138
|
+
lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError)
|
139
|
+
lambda { @ec2.disassociate_address() }.should.raise(AWS::ArgumentError)
|
140
|
+
lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError)
|
141
141
|
end
|
142
142
|
|
143
143
|
|
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "EC2 image_attributes " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@modify_image_attribute_response_body = <<-RESPONSE
|
19
19
|
<ModifyImageAttributeResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
|
@@ -130,33 +130,33 @@ context "EC2 image_attributes " do
|
|
130
130
|
|
131
131
|
specify "should raise an exception when modify_image_attribute is called with incorrect arguments" do
|
132
132
|
# method args can't be nil or empty
|
133
|
-
lambda { @ec2.modify_image_attribute() }.should.raise(
|
134
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(
|
133
|
+
lambda { @ec2.modify_image_attribute() }.should.raise(AWS::ArgumentError)
|
134
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
|
135
135
|
|
136
136
|
# :image_id option must be not be empty or nil
|
137
|
-
lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(
|
138
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(
|
137
|
+
lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
138
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
139
139
|
|
140
140
|
# :attribute currently has two options which are 'launchPermission' and 'productCodes, it should fail with any other value, nil, or empty
|
141
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(
|
142
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(
|
143
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(
|
141
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
142
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
143
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
144
144
|
|
145
145
|
# :attribute => 'launchPermission' option should fail if neither :group nor :user_id are also provided
|
146
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(
|
147
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(
|
148
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(
|
149
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(
|
150
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(
|
146
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(AWS::ArgumentError)
|
147
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(AWS::ArgumentError)
|
148
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(AWS::ArgumentError)
|
149
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(AWS::ArgumentError)
|
150
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(AWS::ArgumentError)
|
151
151
|
|
152
152
|
# :attribute => 'productCodes' option should fail if :product_code isn't also provided
|
153
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(
|
154
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(
|
153
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(AWS::ArgumentError)
|
154
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(AWS::ArgumentError)
|
155
155
|
|
156
156
|
# :operation_type currently has two options which are 'add' and 'remove', and it should fail with any other, nil or empty
|
157
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(
|
158
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(
|
159
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(
|
157
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
158
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
159
|
+
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
160
160
|
end
|
161
161
|
|
162
162
|
|
@@ -191,22 +191,22 @@ context "EC2 image_attributes " do
|
|
191
191
|
|
192
192
|
specify "should raise an exception when describe_image_attribute is called with incorrect arguments" do
|
193
193
|
# method args can't be nil or empty
|
194
|
-
lambda { @ec2.describe_image_attribute() }.should.raise(
|
195
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(
|
194
|
+
lambda { @ec2.describe_image_attribute() }.should.raise(AWS::ArgumentError)
|
195
|
+
lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
|
196
196
|
|
197
197
|
# :image_id option must be not be empty or nil w/ launchPermission
|
198
|
-
lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(
|
199
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(
|
198
|
+
lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
199
|
+
lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
200
200
|
|
201
201
|
# :image_id option must be not be empty or nil w/ productCodes
|
202
|
-
lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(
|
203
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(
|
202
|
+
lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(AWS::ArgumentError)
|
203
|
+
lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(AWS::ArgumentError)
|
204
204
|
|
205
205
|
# :attribute currently has two options which are 'launchPermission' and 'productCodes', it should fail with any other values,
|
206
206
|
# nil, or empty
|
207
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(
|
208
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(
|
209
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(
|
207
|
+
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError)
|
208
|
+
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError)
|
209
|
+
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError)
|
210
210
|
end
|
211
211
|
|
212
212
|
|
@@ -221,17 +221,17 @@ context "EC2 image_attributes " do
|
|
221
221
|
|
222
222
|
specify "should raise an exception when reset_image_attribute is called with incorrect arguments" do
|
223
223
|
# method args can't be nil or empty
|
224
|
-
lambda { @ec2.reset_image_attribute() }.should.raise(
|
225
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(
|
224
|
+
lambda { @ec2.reset_image_attribute() }.should.raise(AWS::ArgumentError)
|
225
|
+
lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
|
226
226
|
|
227
227
|
# :image_id option must be not be empty or nil
|
228
|
-
lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(
|
229
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(
|
228
|
+
lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
229
|
+
lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
230
230
|
|
231
231
|
# :attribute currently has one option which is 'launchPermission', it should fail with any other value, nil, or empty
|
232
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(
|
233
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(
|
234
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(
|
232
|
+
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError)
|
233
|
+
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError)
|
234
|
+
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError)
|
235
235
|
end
|
236
236
|
|
237
237
|
|
data/test/test_EC2_images.rb
CHANGED
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "An EC2 image " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@register_image_response_body = <<-RESPONSE
|
19
19
|
<RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
@@ -65,8 +65,8 @@ context "An EC2 image " do
|
|
65
65
|
|
66
66
|
|
67
67
|
specify "method register_image should raise an exception when called without nil/empty string arguments" do
|
68
|
-
lambda { @ec2.register_image() }.should.raise(
|
69
|
-
lambda { @ec2.register_image(:image_location => "") }.should.raise(
|
68
|
+
lambda { @ec2.register_image() }.should.raise(AWS::ArgumentError)
|
69
|
+
lambda { @ec2.register_image(:image_location => "") }.should.raise(AWS::ArgumentError)
|
70
70
|
end
|
71
71
|
|
72
72
|
|
@@ -188,9 +188,9 @@ context "An EC2 image " do
|
|
188
188
|
|
189
189
|
|
190
190
|
specify "method deregister_image should raise an exception when called without nil/empty string arguments" do
|
191
|
-
lambda { @ec2.deregister_image() }.should.raise(
|
192
|
-
lambda { @ec2.deregister_image( :image_id => nil ) }.should.raise(
|
193
|
-
lambda { @ec2.deregister_image( :image_id => "" ) }.should.raise(
|
191
|
+
lambda { @ec2.deregister_image() }.should.raise(AWS::ArgumentError)
|
192
|
+
lambda { @ec2.deregister_image( :image_id => nil ) }.should.raise(AWS::ArgumentError)
|
193
|
+
lambda { @ec2.deregister_image( :image_id => "" ) }.should.raise(AWS::ArgumentError)
|
194
194
|
end
|
195
195
|
|
196
196
|
|
data/test/test_EC2_instances.rb
CHANGED
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "EC2 instances " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@run_instances_response_body = <<-RESPONSE
|
19
19
|
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-08-29">
|
@@ -193,30 +193,30 @@ context "EC2 instances " do
|
|
193
193
|
@ec2.stubs(:make_request).with('RunInstances', "ImageId" => "ami-60a54009", "MinCount" => '1', "MaxCount" => '1', "AddressingType" => 'public', 'InstanceType' => 'm1.small').
|
194
194
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
195
195
|
|
196
|
-
lambda { @ec2.run_instances() }.should.raise(
|
197
|
-
lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(
|
198
|
-
|
199
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(
|
200
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(
|
201
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(
|
202
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(
|
203
|
-
|
204
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(
|
205
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(
|
206
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(
|
207
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(
|
208
|
-
|
209
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "public" ) }.should.not.raise(
|
210
|
-
#lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "direct" ) }.should.not.raise(
|
211
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.raise(
|
212
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(
|
213
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(
|
214
|
-
|
215
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(
|
216
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(
|
217
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(
|
218
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(
|
219
|
-
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(
|
196
|
+
lambda { @ec2.run_instances() }.should.raise(AWS::ArgumentError)
|
197
|
+
lambda { @ec2.run_instances( :image_id => "" ) }.should.raise(AWS::ArgumentError)
|
198
|
+
|
199
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
200
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => 0 ) }.should.raise(AWS::ArgumentError)
|
201
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => nil ) }.should.raise(AWS::ArgumentError)
|
202
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :min_count => "" ) }.should.raise(AWS::ArgumentError)
|
203
|
+
|
204
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 1 ) }.should.not.raise(AWS::ArgumentError)
|
205
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => 0 ) }.should.raise(AWS::ArgumentError)
|
206
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => nil ) }.should.raise(AWS::ArgumentError)
|
207
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :max_count => "" ) }.should.raise(AWS::ArgumentError)
|
208
|
+
|
209
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "public" ) }.should.not.raise(AWS::ArgumentError)
|
210
|
+
#lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "direct" ) }.should.not.raise(AWS::ArgumentError)
|
211
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => nil ) }.should.raise(AWS::ArgumentError)
|
212
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "" ) }.should.raise(AWS::ArgumentError)
|
213
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :addressing_type => "foo" ) }.should.raise(AWS::ArgumentError)
|
214
|
+
|
215
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => true ) }.should.not.raise(AWS::ArgumentError)
|
216
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => false ) }.should.not.raise(AWS::ArgumentError)
|
217
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => nil ) }.should.raise(AWS::ArgumentError)
|
218
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "" ) }.should.raise(AWS::ArgumentError)
|
219
|
+
lambda { @ec2.run_instances( :image_id => "ami-60a54009", :base64_encoded => "foo" ) }.should.raise(AWS::ArgumentError)
|
220
220
|
end
|
221
221
|
|
222
222
|
|
@@ -243,15 +243,15 @@ context "EC2 instances " do
|
|
243
243
|
returns stub(:body => @run_instances_response_body, :is_a? => true)
|
244
244
|
@ec2.run_instances( :image_id => "ami-60a54009", :min_count => 1, :max_count => 1, :group_id => [], :user_data => "foo", :base64_encoded => false ).should.be.an.instance_of Hash
|
245
245
|
end
|
246
|
-
|
246
|
+
|
247
247
|
specify "should get no user data for when options has no user_data key" do
|
248
248
|
@ec2.extract_user_data({}).should == nil
|
249
249
|
end
|
250
|
-
|
250
|
+
|
251
251
|
specify "should get plain string user data when options has user_data and no base64 key" do
|
252
252
|
@ec2.extract_user_data({:user_data => "foo\nbar"}).should == "foo\nbar"
|
253
253
|
end
|
254
|
-
|
254
|
+
|
255
255
|
specify "should strip new lines and base64 encode when options has both user_data and base64" do
|
256
256
|
@ec2.extract_user_data({:user_data => "binary\ndata\nhere\n", :base64_encoded => true}).should == "YmluYXJ5CmRhdGEKaGVyZQo="
|
257
257
|
end
|
@@ -305,9 +305,9 @@ context "EC2 instances " do
|
|
305
305
|
|
306
306
|
|
307
307
|
specify "method reboot_instances should raise an exception when called without nil/empty string arguments" do
|
308
|
-
lambda { @ec2.reboot_instances() }.should.raise(
|
309
|
-
lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(
|
310
|
-
lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(
|
308
|
+
lambda { @ec2.reboot_instances() }.should.raise(AWS::ArgumentError)
|
309
|
+
lambda { @ec2.reboot_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
310
|
+
lambda { @ec2.reboot_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
311
311
|
end
|
312
312
|
|
313
313
|
|
@@ -319,9 +319,9 @@ context "EC2 instances " do
|
|
319
319
|
|
320
320
|
|
321
321
|
specify "method terminate_instances should raise an exception when called without nil/empty string arguments" do
|
322
|
-
lambda { @ec2.terminate_instances() }.should.raise(
|
323
|
-
lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(
|
324
|
-
lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(
|
322
|
+
lambda { @ec2.terminate_instances() }.should.raise(AWS::ArgumentError)
|
323
|
+
lambda { @ec2.terminate_instances( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
324
|
+
lambda { @ec2.terminate_instances( :instance_id => "" ) }.should.raise(AWS::ArgumentError)
|
325
325
|
end
|
326
326
|
|
327
327
|
|
data/test/test_EC2_keypairs.rb
CHANGED
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "EC2 keypairs " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@create_keypair_response_body = <<-RESPONSE
|
19
19
|
<CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
@@ -83,10 +83,10 @@ context "EC2 keypairs " do
|
|
83
83
|
@ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
|
84
84
|
returns stub(:body => @create_keypair_response_body, :is_a? => true)
|
85
85
|
|
86
|
-
lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(
|
87
|
-
lambda { @ec2.create_keypair() }.should.raise(
|
88
|
-
lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(
|
89
|
-
lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(
|
86
|
+
lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
|
87
|
+
lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError)
|
88
|
+
lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
|
89
|
+
lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
|
90
90
|
end
|
91
91
|
|
92
92
|
|
@@ -113,10 +113,10 @@ context "EC2 keypairs " do
|
|
113
113
|
@ec2.stubs(:make_request).with('DeleteKeyPair', {"KeyName"=>"example-key-name"}).
|
114
114
|
returns stub(:body => @delete_keypair_body, :is_a? => true)
|
115
115
|
|
116
|
-
lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(
|
117
|
-
lambda { @ec2.delete_keypair() }.should.raise(
|
118
|
-
lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(
|
119
|
-
lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(
|
116
|
+
lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
|
117
|
+
lambda { @ec2.delete_keypair() }.should.raise(AWS::ArgumentError)
|
118
|
+
lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
|
119
|
+
lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
|
120
120
|
end
|
121
121
|
|
122
122
|
|
data/test/test_EC2_products.rb
CHANGED
@@ -12,8 +12,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
12
12
|
|
13
13
|
context "An EC2 instance " do
|
14
14
|
|
15
|
-
|
16
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
15
|
+
before do
|
16
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
17
|
|
18
18
|
@confirm_product_instance_response_body = <<-RESPONSE
|
19
19
|
<ConfirmProductInstanceResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
@@ -37,11 +37,11 @@ context "An EC2 instance " do
|
|
37
37
|
|
38
38
|
|
39
39
|
specify "method get_console_output should raise an exception when called without nil/empty string arguments" do
|
40
|
-
lambda { @ec2.confirm_product_instance() }.should.raise(
|
41
|
-
lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(
|
42
|
-
lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => "") }.should.raise(
|
43
|
-
lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(
|
44
|
-
lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(
|
40
|
+
lambda { @ec2.confirm_product_instance() }.should.raise(AWS::ArgumentError)
|
41
|
+
lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(AWS::ArgumentError)
|
42
|
+
lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => "") }.should.raise(AWS::ArgumentError)
|
43
|
+
lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(AWS::ArgumentError)
|
44
|
+
lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(AWS::ArgumentError)
|
45
45
|
end
|
46
46
|
|
47
47
|
|
data/test/test_EC2_responses.rb
CHANGED
@@ -13,14 +13,14 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
13
13
|
context "The Response classes " do
|
14
14
|
|
15
15
|
|
16
|
-
|
16
|
+
before do
|
17
17
|
@http_xml = <<-RESPONSE
|
18
18
|
<RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
19
19
|
<return>true</return>
|
20
20
|
</RebootInstancesResponse>
|
21
21
|
RESPONSE
|
22
22
|
|
23
|
-
@response =
|
23
|
+
@response = AWS::Response.parse(:xml => @http_xml)
|
24
24
|
end
|
25
25
|
|
26
26
|
|
@@ -16,8 +16,8 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
16
16
|
|
17
17
|
context "EC2 aws-s3 compat test" do
|
18
18
|
|
19
|
-
|
20
|
-
@ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
19
|
+
before do
|
20
|
+
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
21
21
|
|
22
22
|
@describe_instances_response_body = <<-RESPONSE
|
23
23
|
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-08-29">
|