aws 2.8.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/right_aws'
@@ -0,0 +1,241 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require 'pp'
3
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
4
+
5
+ class TestEc2 < Test::Unit::TestCase
6
+
7
+ # Some of RightEc2 instance methods concerning instance launching and image registration
8
+ # are not tested here due to their potentially risk.
9
+
10
+ def setup
11
+ TestCredentials.get_credentials
12
+ @ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id,
13
+ TestCredentials.aws_secret_access_key)
14
+ @key = 'right_ec2_awesome_test_key'
15
+ @group = 'right_ec2_awesome_test_security_group'
16
+ end
17
+
18
+ def test_001_describe_availability_zones
19
+ TestCredentials.get_credentials
20
+ @ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id,
21
+ TestCredentials.aws_secret_access_key)
22
+ zones = @ec2.describe_availability_zones
23
+ puts zones.inspect
24
+ assert zones.is_a? Array
25
+ assert zones.size > 3
26
+ zones.each do |z|
27
+ puts z[:zone_name]
28
+ end
29
+ assert zones[0][:zone_name] == "us-east-1a"
30
+ end
31
+
32
+ def test_01_create_describe_key_pairs
33
+ new_key = @ec2.create_key_pair(@key)
34
+ assert new_key[:aws_material][/BEGIN RSA PRIVATE KEY/], "New key material is absent"
35
+ keys = @ec2.describe_key_pairs
36
+ assert keys.map { |key| key[:aws_key_name] }.include?(@key), "#{@key} must exist"
37
+ end
38
+
39
+ def test_02_create_security_group
40
+ assert @ec2.create_security_group(@group, 'My awesone test group'), 'Create_security_group fail'
41
+ group = @ec2.describe_security_groups([@group])[0]
42
+ assert_equal @group, group[:aws_group_name], 'Group must be created but does not exist'
43
+ end
44
+
45
+ def test_03_perms_add
46
+ assert @ec2.authorize_security_group_named_ingress(@group, TestCredentials.account_number, 'default')
47
+ assert @ec2.authorize_security_group_IP_ingress(@group, 80, 80, 'udp', '192.168.1.0/8')
48
+ end
49
+
50
+ def test_04_check_new_perms_exist
51
+ assert_equal 2, @ec2.describe_security_groups([@group])[0][:aws_perms].size
52
+ end
53
+
54
+ def test_05_perms_remove
55
+ assert @ec2.revoke_security_group_IP_ingress(@group, 80, 80, 'udp', '192.168.1.0/8')
56
+ assert @ec2.revoke_security_group_named_ingress(@group,
57
+ TestCredentials.account_number, 'default')
58
+ end
59
+
60
+ def test_06_describe_images
61
+ images = describe_images
62
+ # unknown image
63
+ assert_raise(Aws::AwsError) { @ec2.describe_images(['ami-ABCDEFGH']) }
64
+ end
65
+
66
+ def test_07_describe_instanses
67
+ assert @ec2.describe_instances
68
+ # unknown image
69
+ assert_raise(Aws::AwsError) { @ec2.describe_instances(['i-ABCDEFGH']) }
70
+ end
71
+
72
+ def test_08_delete_security_group
73
+ assert @ec2.delete_security_group(@group), 'Delete_security_group fail'
74
+ end
75
+
76
+ def test_09_delete_key_pair
77
+ assert @ec2.delete_key_pair(@key), 'Delete_key_pair fail'
78
+ ## Hmmm... Amazon does not through the exception any more. It now just returns a 'true' if the key does not exist any more...
79
+ ## # key must be deleted already
80
+ ## assert_raise(Aws::AwsError) { @ec2.delete_key_pair(@key) }
81
+ end
82
+
83
+ def test_10_signature_version_0
84
+ ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '0')
85
+ images = ec2.describe_images
86
+ assert images.size>0, 'Amazon must have at least some public images'
87
+ # check that the request has correct signature version
88
+ assert ec2.last_request.path.include?('SignatureVersion=0')
89
+ end
90
+
91
+ def test_11_regions
92
+ regions = nil
93
+ assert_nothing_raised do
94
+ regions = @ec2.describe_regions
95
+ end
96
+ # check we got more that 0 regions
97
+ assert regions.size > 0
98
+ # check an access to regions
99
+ regions.each do |region|
100
+ regional_ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :region => region)
101
+ # do we have a correct endpoint server?
102
+ assert_equal "#{region}.ec2.amazonaws.com", regional_ec2.params[:server]
103
+ # get a list of images from every region
104
+ images = nil
105
+ assert_nothing_raised do
106
+ images = regional_ec2.describe_regions
107
+ end
108
+ # every region must have images
109
+ assert images.size > 0
110
+ end
111
+ end
112
+
113
+ def test_12_endpoint_url
114
+ ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :endpoint_url => 'a://b.c:0/d/', :region => 'z')
115
+ # :endpoint_url has a priority hence :region should be ommitted
116
+ assert_equal 'a', ec2.params[:protocol]
117
+ assert_equal 'b.c', ec2.params[:server]
118
+ assert_equal '/d/', ec2.params[:service]
119
+ assert_equal 0, ec2.params[:port]
120
+ assert_nil ec2.params[:region]
121
+ end
122
+
123
+ def test_13a_create_describe_delete_tag
124
+ images = describe_images
125
+ resource_id = images.first[:aws_id]
126
+
127
+ assert @ec2.create_tag(resource_id, 'testkey', 'testvalue').inspect, "Could not add a tag to #{resource_id}"
128
+ assert_equal(
129
+ [{:aws_resource_id=>resource_id, :aws_resource_type=>"image", :aws_key=>"testkey", :aws_value=>"testvalue"}],
130
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id)
131
+ )
132
+ assert_equal(
133
+ [],
134
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => '__blah__')
135
+ )
136
+
137
+ assert @ec2.delete_tag(resource_id, 'testkey').inspect, "Could not delete tag 'testkey' from #{resource_id}"
138
+ sleep 1 # :(
139
+ assert_equal(
140
+ [],
141
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id)
142
+ )
143
+ end
144
+
145
+ def test_13b_create_describe_delete_tag_by_value
146
+ images = describe_images
147
+ resource_id = images.first[:aws_id]
148
+
149
+ assert @ec2.create_tag(resource_id, 'testkey', 'testvalue').inspect, "Could not add a tag to #{resource_id}"
150
+ assert_equal(
151
+ [{:aws_resource_id=>resource_id, :aws_resource_type=>"image", :aws_key=>"testkey", :aws_value=>"testvalue"}],
152
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id, 'Filter.2.Name' => 'key', 'Filter.2.Value.1' => 'testkey')
153
+ )
154
+ assert_equal(
155
+ [],
156
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id, 'Filter.2.Name' => 'key', 'Filter.2.Value.1' => '__blah__')
157
+ )
158
+
159
+ assert @ec2.delete_tag(resource_id, 'testkey', 'testvalue').inspect, "Could not delete tag 'testkey' from #{resource_id}"
160
+ sleep 1 # :(
161
+ assert_equal(
162
+ [],
163
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id, 'Filter.2.Name' => 'key', 'Filter.2.Value.1' => 'testkey')
164
+ )
165
+ end
166
+
167
+ def test_13c_delete_tag_with_empty_or_nil_value
168
+ images = describe_images
169
+ resource_id = images.first[:aws_id]
170
+
171
+ assert @ec2.create_tag(resource_id, 'testkey', 'testvalue').inspect, "Could not add a tag to #{resource_id}"
172
+ assert_equal(
173
+ [{:aws_resource_id=>resource_id, :aws_resource_type=>"image", :aws_key=>"testkey", :aws_value=>"testvalue"}],
174
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id)
175
+ )
176
+
177
+ # Delete a tag with an empty string value...
178
+ assert @ec2.delete_tag(resource_id, 'testkey', '').inspect, "Could not delete tag 'testkey' from #{resource_id}"
179
+ sleep 1 # :(
180
+ # ... does nothing
181
+ assert_equal(
182
+ [{:aws_resource_id=>resource_id, :aws_resource_type=>"image", :aws_key=>"testkey", :aws_value=>"testvalue"}],
183
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id)
184
+ )
185
+
186
+ # Delete a tag with value = nil...
187
+ assert @ec2.delete_tag(resource_id, 'testkey', nil).inspect, "Could not delete tag 'testkey' from #{resource_id}"
188
+ sleep 1 # :(
189
+ # ... deletes all tags with the given key
190
+ assert_equal(
191
+ [],
192
+ @ec2.describe_tags('Filter.1.Name' => 'resource-id', 'Filter.1.Value.1' => resource_id)
193
+ )
194
+ end
195
+
196
+ def test_14_vpc
197
+ @vpc = @ec2.create_vpc("172.16.0.0/16").first
198
+ assert_equal "172.16.0.0/16", @vpc[:cidr_block]
199
+ assert @vpc.key?(:state)
200
+
201
+ vpcs = @ec2.describe_vpcs
202
+ assert vpcs.find { |v| v[:vpc_id] == @vpc[:vpc_id] }
203
+
204
+ vpcs = @ec2.describe_vpcs(@vpc[:vpc_id])
205
+ assert_equal 1, vpcs.size
206
+ assert_equal @vpc[:vpc_id], vpcs.first[:vpc_id]
207
+
208
+ @subnet = @ec2.create_subnet(@vpc[:vpc_id], "172.16.3.0/24", "us-east-1b").first
209
+ assert @subnet[:subnet_id]
210
+ assert_equal @vpc[:vpc_id], @subnet[:vpc_id]
211
+ assert_equal "172.16.3.0/24", @subnet[:cidr_block]
212
+ assert_equal "251", @subnet[:available_ip_address_count]
213
+ assert_equal "us-east-1b", @subnet[:availability_zone]
214
+ assert @subnet.key?(:state)
215
+ subnets = @ec2.describe_subnets
216
+ assert subnets.find { |s| s[:subnet_id] = @subnet[:subnet_id] }
217
+
218
+ subnets = @ec2.describe_subnets('Filter.1.Name' => 'vpc-id',
219
+ 'Filter.1.Value' => @vpc[:vpc_id])
220
+ assert_equal 1, subnets.size
221
+ assert_equal @subnet[:subnet_id], subnets.first[:subnet_id]
222
+
223
+ assert @ec2.delete_subnet(@subnet[:subnet_id])
224
+ @subnet = nil
225
+ assert @ec2.delete_vpc(@vpc[:vpc_id])
226
+ @vpc = nil
227
+ ensure
228
+ @ec2.delete_subnet(@subnet[:subnet_id]) if @subnet
229
+ @ec2.delete_vpc(@vpc[:vpc_id]) if @vpc
230
+ end
231
+
232
+ private
233
+
234
+ # Memoize the images to speed up the tests
235
+ def describe_images
236
+ @@images ||= @ec2.describe_images
237
+ assert @@images.size>0, 'Amazon must have at least some public images'
238
+ @@images
239
+ end
240
+
241
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/aws'
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
3
+ require 'pp'
4
+
5
+ class TestEc2 < Test::Unit::TestCase
6
+
7
+ # Some of RightEc2 instance methods concerning instance launching and image registration
8
+ # are not tested here due to their potentially risk.
9
+
10
+ def setup
11
+ TestCredentials.get_credentials
12
+ @ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id,
13
+ TestCredentials.aws_secret_access_key)
14
+ @key = 'right_ec2_awesome_test_key'
15
+ @group = 'right_ec2_awesome_test_security_group'
16
+ end
17
+ end
@@ -0,0 +1,51 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/aws'
3
+ require 'pp'
4
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
5
+
6
+ class TestElb < Test::Unit::TestCase
7
+
8
+ # Some of RightEc2 instance methods concerning instance launching and image registration
9
+ # are not tested here due to their potentially risk.
10
+
11
+ def setup
12
+ TestCredentials.get_credentials
13
+
14
+ @ec2 = Aws::Ec2.new(TestCredentials.aws_access_key_id,
15
+ TestCredentials.aws_secret_access_key)
16
+
17
+ @elb = Aws::Elb.new(TestCredentials.aws_access_key_id,
18
+ TestCredentials.aws_secret_access_key)
19
+ @key = 'right_ec2_awesome_test_key'
20
+ @group = 'right_ec2_awesome_test_security_group'
21
+ end
22
+
23
+ def test_01_create_elb
24
+
25
+ end
26
+
27
+ def test_02_register_instances
28
+
29
+ end
30
+
31
+ def test_03_deregister_instances
32
+
33
+ end
34
+
35
+
36
+ def test_04_describe_elb
37
+ desc = @elb.describe_load_balancers
38
+ puts desc.inspect
39
+ end
40
+
41
+ def test_06_describe_instance_health
42
+
43
+ end
44
+
45
+
46
+ def test_15_delete_elb
47
+
48
+ end
49
+
50
+
51
+ end
@@ -0,0 +1,87 @@
1
+ =begin
2
+ Copyright (c) 2007 RightScale, Inc.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ 'Software'), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ =end
23
+
24
+ # Stub extension/redefinition of RightHttpConnection for testing purposes.
25
+ require 'net/http'
26
+ require 'rubygems'
27
+ require 'right_http_connection'
28
+
29
+ module Net
30
+ class HTTPResponse
31
+ alias_method :real_body, :body
32
+ def setmsg(msg)
33
+ @mymsg = msg
34
+ end
35
+
36
+ def body
37
+ # defined?() helps us to get rid of a bunch of 'warnings'
38
+ (defined?(@mymsg) && @mymsg) ? @mymsg : real_body
39
+ end
40
+ end
41
+ end
42
+
43
+ module Rightscale
44
+
45
+ class HttpConnection
46
+ @@response_stack = []
47
+
48
+ alias_method :real_request, :request
49
+
50
+ def request(request_params, &block)
51
+ if(@@response_stack.length == 0)
52
+ return real_request(request_params, &block)
53
+ end
54
+
55
+ if(block)
56
+ # Do something special
57
+ else
58
+ next_response = HttpConnection::pop()
59
+ classname = Net::HTTPResponse::CODE_TO_OBJ["#{next_response[:code]}"]
60
+ response = classname.new("1.1", next_response[:code], next_response[:msg])
61
+ if(next_response[:msg])
62
+ response.setmsg(next_response[:msg])
63
+ end
64
+ response
65
+ end
66
+ end
67
+
68
+ def self.reset
69
+ @@response_stack = []
70
+ end
71
+
72
+ def self.push(code, msg=nil)
73
+ response = {:code => code, :msg => msg}
74
+ @@response_stack << response
75
+ end
76
+
77
+ def self.pop
78
+ @@response_stack.pop
79
+ end
80
+
81
+ def self.length
82
+ @@response_stack.length
83
+ end
84
+
85
+ end
86
+
87
+ end
@@ -0,0 +1,33 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/aws'
3
+ require 'pp'
4
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
5
+
6
+ class TestIam < Test::Unit::TestCase
7
+
8
+ def setup
9
+ TestCredentials.get_credentials
10
+
11
+ @iam = Aws::Iam.new(TestCredentials.aws_access_key_id,
12
+ TestCredentials.aws_secret_access_key)
13
+
14
+ end
15
+
16
+ def test_01_list_server_certificates
17
+
18
+ ret = @iam.list_server_certificates
19
+ p ret
20
+ assert_true(ret.size == 0)
21
+ end
22
+
23
+ def test_02_upload_server_certificate
24
+ ret = @iam.upload_server_certificate("test_cert",
25
+ IO.read('x').strip,
26
+ IO.read('y').strip,
27
+ :certificate_chain=>IO.read('z').strip)
28
+
29
+ p ret
30
+ end
31
+
32
+
33
+ end
@@ -0,0 +1,181 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/aws'
3
+ require 'rds/rds'
4
+ require 'pp'
5
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
6
+
7
+ class TestRds < Test::Unit::TestCase
8
+
9
+ # Some of RightEc2 instance methods concerning instance launching and image registration
10
+ # are not tested here due to their potentially risk.
11
+
12
+ def setup
13
+ TestCredentials.get_credentials
14
+
15
+ @rds = Aws::Rds.new(TestCredentials.aws_access_key_id,
16
+ TestCredentials.aws_secret_access_key)
17
+
18
+ @identifier = 'test-db-instance1b'
19
+ # deleting this one....
20
+ #@identifier2 = 'my-db-instance2'
21
+ end
22
+
23
+
24
+ def test_00_describe_db_instances_empty
25
+ instances = @rds.describe_db_instances
26
+ # puts "instances_result=" + instances_result.inspect
27
+ # instances = instances_result["DescribeDBInstancesResult"]["DBInstances"]["DBInstance"]
28
+ puts "instances count = " + instances.count.to_s
29
+ puts 'instances=' + instances.inspect
30
+ assert instances.size == 0
31
+ end
32
+
33
+
34
+ def test_01_create_db_instance
35
+ begin
36
+ db_instance3 = @rds.create_db_instance('bad_test_key', "db.m1.small", 5, "master", "masterpass")
37
+ rescue => ex
38
+ #puts "msg=" + ex.message
39
+ #puts "response=" + ex.response
40
+ assert ex.message[0, "InvalidParameterValue".size] == "InvalidParameterValue"
41
+ end
42
+
43
+ db_instance = @rds.create_db_instance(@identifier, "db.m1.small", 5, "master", "masterpass")
44
+ assert db_instance[:db_instance_status] == "creating"
45
+
46
+ start = Time.now
47
+ tries=0
48
+ catch (:done) do
49
+ while tries < 100
50
+ instances = @rds.describe_db_instances
51
+
52
+ #puts "INSTANCES -----> " + instances.inspect
53
+
54
+ instances.each do |i|
55
+ db_status = i[:db_instance_status]
56
+ puts 'i=' + db_status.to_s
57
+ next unless i[:db_instance_identifier] == @identifier
58
+ throw :done if db_status == "available"
59
+ puts "Database not ready yet.... attempt #{tries.to_s} of 100, db state --> #{i[:db_instance_status].to_s}"
60
+ tries += 1
61
+ sleep 5
62
+ end
63
+ end
64
+ end
65
+ puts "Duration to start db instance: #{Time.now-start}"
66
+ end
67
+
68
+
69
+ def test_02_describe_db_instances
70
+ instances = @rds.describe_db_instances
71
+ # puts "instances_result=" + instances_result.inspect
72
+ # instances = instances_result["DescribeDBInstancesResult"]["DBInstances"]["DBInstance"]
73
+ puts "instances count = " + instances.count.to_s
74
+ puts 'instances=' + instances.inspect
75
+ assert instances.size > 0
76
+ i_describe = nil
77
+ instances.each do |rdi|
78
+ puts 'rdi=' + rdi.inspect
79
+ i_describe = rdi if rdi[:db_instance_identifier] == @identifier
80
+ end
81
+ assert i_describe
82
+
83
+ puts 'response_metadata=' + instances.response_metadata.inspect
84
+ assert instances.response_metadata
85
+ assert instances.response_metadata[:request_id]
86
+ end
87
+
88
+
89
+ def test_03_describe_security_groups
90
+ security_groups = @rds.describe_db_security_groups()
91
+ puts "security_groups=" + security_groups.inspect
92
+ default_present = false
93
+ assert security_groups.is_a?(Array)
94
+ security_groups.each do |security_group|
95
+ security_group.inspect
96
+ if security_group[:db_security_group_name] == "default"
97
+ default_present=true
98
+ end
99
+ assert security_group[:ec2_security_groups].is_a? Array
100
+ end
101
+ assert default_present
102
+ end
103
+
104
+
105
+ def test_04_authorize_security_groups_ingress
106
+ # Create
107
+ # security_groups = @rds.describe_db_security_groups
108
+ # @security_info = security_groups[0]
109
+ @rds.authorize_db_security_group_ingress_range("default", "122.122.122.122/12")
110
+
111
+ # Check
112
+ security_groups = @rds.describe_db_security_groups
113
+ @security_info = security_groups[0]
114
+
115
+ ip_found = @security_info.inspect.include? "122.122.122.122/12"
116
+ assert ip_found
117
+ end
118
+
119
+
120
+ def test_05_delete_db_instance
121
+ @rds.delete_db_instance(@identifier) # todo: can't delete unless it's in "available" state
122
+ #@rds.delete_db_instance(@identifier2)
123
+ sleep 3
124
+
125
+ instances = @rds.describe_db_instances(:db_instance_identifier=>@identifier)
126
+ #puts "instances_result=" + instances_result.inspect
127
+
128
+ instances.each do |i|
129
+ next unless i[:db_instance_identifier] == @identifier
130
+ db_status = i[:db_instance_status]
131
+ puts "Trying to delete and getting i[DBInstanceStatus] -----------> " + db_status
132
+ @rds.delete_db_instance(i[:db_instance_identifier]) if db_status == "available"
133
+ assert db_status == "deleting"
134
+ end
135
+ sleep 2
136
+
137
+ end
138
+
139
+
140
+ def test_06_create_security_groups
141
+ group_present=false
142
+
143
+ @rds.create_db_security_group("new_sample_group", "new_sample_group_description")
144
+
145
+ security_groups = @rds.describe_db_security_groups
146
+
147
+ security_groups.each do |security_group|
148
+ if (security_group[:db_security_group_name]=="new_sample_group")&&(security_group[:db_security_group_description]=="new_sample_group_description")
149
+ group_present = true
150
+ end
151
+ end
152
+
153
+ assert group_present
154
+ end
155
+
156
+
157
+ def test_07_revoking_security_groups_ingress
158
+ # sleep 15
159
+ @rds.revoke_db_security_group_ingress("default", "122.122.122.122/12")
160
+ sleep 2
161
+ security_groups = @rds.describe_db_security_groups
162
+ revoking = security_groups[0].inspect.include? "revoking"
163
+ assert revoking
164
+ end
165
+
166
+
167
+ def test_08_delete_security_group
168
+ group_present=false
169
+ @rds.delete_db_security_group("new_sample_group")
170
+ sleep 2
171
+ security_groups = @rds.describe_db_security_groups
172
+ security_groups.each do |security_group|
173
+ if (security_group[:db_security_group_name]=="new_sample_group")
174
+ group_present=true
175
+ end
176
+ end
177
+ assert !group_present
178
+ end
179
+
180
+
181
+ end