fog 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/Gemfile.lock +11 -6
  2. data/changelog.txt +49 -0
  3. data/fog.gemspec +5 -4
  4. data/lib/fog.rb +1 -1
  5. data/lib/fog/aws/cloud_formation.rb +124 -0
  6. data/lib/fog/aws/elb.rb +4 -1
  7. data/lib/fog/aws/iam.rb +6 -0
  8. data/lib/fog/aws/parsers/cloud_formation/basic.rb +12 -0
  9. data/lib/fog/aws/parsers/cloud_formation/create_stack.rb +19 -0
  10. data/lib/fog/aws/parsers/cloud_formation/describe_stack_events.rb +31 -0
  11. data/lib/fog/aws/parsers/cloud_formation/describe_stack_resources.rb +31 -0
  12. data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +72 -0
  13. data/lib/fog/aws/parsers/cloud_formation/get_template.rb +19 -0
  14. data/lib/fog/aws/parsers/cloud_formation/validate_template.rb +52 -0
  15. data/lib/fog/aws/parsers/iam/login_profile.rb +27 -0
  16. data/lib/fog/aws/parsers/iam/upload_server_certificate.rb +26 -0
  17. data/lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb +38 -0
  18. data/lib/fog/aws/parsers/rds/create_db_instance.rb +34 -0
  19. data/lib/fog/aws/parsers/rds/create_db_instance_read_replica.rb +34 -0
  20. data/lib/fog/aws/parsers/rds/create_db_parameter_group.rb +35 -0
  21. data/lib/fog/aws/parsers/rds/create_db_security_group.rb +38 -0
  22. data/lib/fog/aws/parsers/rds/create_db_snapshot.rb +35 -0
  23. data/lib/fog/aws/parsers/rds/db_parser.rb +123 -0
  24. data/lib/fog/aws/parsers/rds/delete_db_instance.rb +35 -0
  25. data/lib/fog/aws/parsers/rds/delete_db_parameter_group.rb +27 -0
  26. data/lib/fog/aws/parsers/rds/delete_db_security_group.rb +33 -0
  27. data/lib/fog/aws/parsers/rds/delete_db_snapshot.rb +34 -0
  28. data/lib/fog/aws/parsers/rds/describe_db_instances.rb +36 -0
  29. data/lib/fog/aws/parsers/rds/describe_db_parameter_groups.rb +38 -0
  30. data/lib/fog/aws/parsers/rds/describe_db_parameters.rb +44 -0
  31. data/lib/fog/aws/parsers/rds/describe_db_security_groups.rb +39 -0
  32. data/lib/fog/aws/parsers/rds/describe_db_snapshots.rb +39 -0
  33. data/lib/fog/aws/parsers/rds/modify_db_instance.rb +34 -0
  34. data/lib/fog/aws/parsers/rds/modify_db_parameter_group.rb +28 -0
  35. data/lib/fog/aws/parsers/rds/reboot_db_instance.rb +35 -0
  36. data/lib/fog/aws/parsers/rds/restore_db_instance_from_db_snapshot.rb +34 -0
  37. data/lib/fog/aws/parsers/rds/restore_db_instance_to_point_in_time.rb +35 -0
  38. data/lib/fog/aws/parsers/rds/revoke_db_security_group_ingress.rb +39 -0
  39. data/lib/fog/aws/parsers/rds/security_group_parser.rb +39 -0
  40. data/lib/fog/aws/parsers/rds/snapshot_parser.rb +40 -0
  41. data/lib/fog/aws/rds.rb +161 -0
  42. data/lib/fog/aws/rds/models/parameter.rb +21 -0
  43. data/lib/fog/aws/rds/models/parameter_group.rb +36 -0
  44. data/lib/fog/aws/rds/models/parameter_groups.rb +27 -0
  45. data/lib/fog/aws/rds/models/parameters.rb +37 -0
  46. data/lib/fog/aws/rds/models/security_group.rb +73 -0
  47. data/lib/fog/aws/rds/models/security_groups.rb +43 -0
  48. data/lib/fog/aws/rds/models/server.rb +105 -0
  49. data/lib/fog/aws/rds/models/servers.rb +27 -0
  50. data/lib/fog/aws/rds/models/snapshot.rb +49 -0
  51. data/lib/fog/aws/rds/models/snapshots.rb +45 -0
  52. data/lib/fog/aws/requests/cloud_formation/create_stack.rb +71 -0
  53. data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +30 -0
  54. data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +44 -0
  55. data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +43 -0
  56. data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +42 -0
  57. data/lib/fog/aws/requests/cloud_formation/get_template.rb +32 -0
  58. data/lib/fog/aws/requests/cloud_formation/validate_template.rb +34 -0
  59. data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -0
  60. data/lib/fog/aws/requests/iam/create_login_profile.rb +36 -0
  61. data/lib/fog/aws/requests/iam/delete_login_profile.rb +31 -0
  62. data/lib/fog/aws/requests/iam/delete_server_certificate.rb +32 -0
  63. data/lib/fog/aws/requests/iam/get_login_profile.rb +35 -0
  64. data/lib/fog/aws/requests/iam/update_login_profile.rb +33 -0
  65. data/lib/fog/aws/requests/iam/upload_server_certificate.rb +45 -0
  66. data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +43 -0
  67. data/lib/fog/aws/requests/rds/create_db_instance.rb +56 -0
  68. data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +42 -0
  69. data/lib/fog/aws/requests/rds/create_db_parameter_group.rb +41 -0
  70. data/lib/fog/aws/requests/rds/create_db_security_group.rb +37 -0
  71. data/lib/fog/aws/requests/rds/create_db_snapshot.rb +36 -0
  72. data/lib/fog/aws/requests/rds/delete_db_instance.rb +40 -0
  73. data/lib/fog/aws/requests/rds/delete_db_parameter_group.rb +36 -0
  74. data/lib/fog/aws/requests/rds/delete_db_security_group.rb +36 -0
  75. data/lib/fog/aws/requests/rds/delete_db_snapshot.rb +36 -0
  76. data/lib/fog/aws/requests/rds/describe_db_instances.rb +42 -0
  77. data/lib/fog/aws/requests/rds/describe_db_parameter_groups.rb +45 -0
  78. data/lib/fog/aws/requests/rds/describe_db_parameters.rb +46 -0
  79. data/lib/fog/aws/requests/rds/describe_db_security_groups.rb +39 -0
  80. data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +42 -0
  81. data/lib/fog/aws/requests/rds/modify_db_instance.rb +54 -0
  82. data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +55 -0
  83. data/lib/fog/aws/requests/rds/reboot_db_instance.rb +34 -0
  84. data/lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb +34 -0
  85. data/lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb +35 -0
  86. data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +44 -0
  87. data/lib/fog/aws/simpledb.rb +21 -7
  88. data/lib/fog/bin.rb +2 -1
  89. data/lib/fog/bin/aws.rb +8 -0
  90. data/lib/fog/bin/virtual_box.rb +52 -0
  91. data/lib/fog/cdn/aws.rb +9 -8
  92. data/lib/fog/cdn/rackspace.rb +6 -6
  93. data/lib/fog/cdn/requests/rackspace/post_container.rb +30 -0
  94. data/lib/fog/cdn/requests/rackspace/put_container.rb +1 -1
  95. data/lib/fog/compute.rb +6 -3
  96. data/lib/fog/compute/aws.rb +11 -7
  97. data/lib/fog/compute/bluebox.rb +5 -6
  98. data/lib/fog/compute/brightbox.rb +3 -0
  99. data/lib/fog/compute/go_grid.rb +5 -6
  100. data/lib/fog/compute/linode.rb +5 -6
  101. data/lib/fog/compute/models/aws/flavors.rb +19 -18
  102. data/lib/fog/compute/models/aws/server.rb +23 -0
  103. data/lib/fog/compute/models/aws/tag.rb +1 -1
  104. data/lib/fog/compute/models/brightbox/server.rb +7 -1
  105. data/lib/fog/compute/models/virtual_box/medium.rb +87 -0
  106. data/lib/fog/compute/models/virtual_box/medium_format.rb +34 -0
  107. data/lib/fog/compute/models/virtual_box/mediums.rb +32 -0
  108. data/lib/fog/compute/models/virtual_box/nat_engine.rb +65 -0
  109. data/lib/fog/compute/models/virtual_box/nat_redirect.rb +91 -0
  110. data/lib/fog/compute/models/virtual_box/nat_redirects.rb +41 -0
  111. data/lib/fog/compute/models/virtual_box/network_adapter.rb +82 -0
  112. data/lib/fog/compute/models/virtual_box/network_adapters.rb +42 -0
  113. data/lib/fog/compute/models/virtual_box/server.rb +241 -0
  114. data/lib/fog/compute/models/virtual_box/servers.rb +41 -0
  115. data/lib/fog/compute/models/virtual_box/storage_controller.rb +83 -0
  116. data/lib/fog/compute/models/virtual_box/storage_controllers.rb +38 -0
  117. data/lib/fog/compute/models/voxel/servers.rb +7 -6
  118. data/lib/fog/compute/new_servers.rb +5 -6
  119. data/lib/fog/compute/parsers/aws/monitor_unmonitor_instances.rb +35 -0
  120. data/lib/fog/compute/rackspace.rb +7 -7
  121. data/lib/fog/compute/requests/aws/delete_tags.rb +12 -9
  122. data/lib/fog/compute/requests/aws/monitor_instances.rb +52 -0
  123. data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +24 -8
  124. data/lib/fog/compute/requests/aws/unmonitor_instances.rb +53 -0
  125. data/lib/fog/compute/requests/brightbox/activate_console_server.rb +20 -0
  126. data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +20 -0
  127. data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +20 -0
  128. data/lib/fog/compute/slicehost.rb +5 -6
  129. data/lib/fog/compute/virtual_box.rb +48 -0
  130. data/lib/fog/compute/voxel.rb +30 -27
  131. data/lib/fog/core.rb +1 -0
  132. data/lib/fog/core/attributes.rb +3 -1
  133. data/lib/fog/core/collection.rb +2 -2
  134. data/lib/fog/core/credentials.rb +13 -3
  135. data/lib/fog/core/scp.rb +0 -4
  136. data/lib/fog/core/service.rb +0 -8
  137. data/lib/fog/core/ssh.rb +0 -4
  138. data/lib/fog/dns.rb +3 -3
  139. data/lib/fog/dns/aws.rb +8 -8
  140. data/lib/fog/dns/bluebox.rb +5 -7
  141. data/lib/fog/dns/dnsimple.rb +7 -7
  142. data/lib/fog/dns/linode.rb +5 -6
  143. data/lib/fog/dns/models/dnsimple/record.rb +11 -1
  144. data/lib/fog/dns/models/dnsimple/records.rb +7 -7
  145. data/lib/fog/dns/models/dnsimple/zones.rb +2 -1
  146. data/lib/fog/dns/requests/dnsimple/get_record.rb +34 -0
  147. data/lib/fog/dns/slicehost.rb +5 -6
  148. data/lib/fog/dns/zerigo.rb +5 -7
  149. data/lib/fog/providers.rb +2 -1
  150. data/lib/fog/providers/aws.rb +10 -8
  151. data/lib/fog/providers/virtual_box.rb +11 -0
  152. data/lib/fog/storage.rb +21 -0
  153. data/lib/fog/storage/aws.rb +16 -32
  154. data/lib/fog/storage/google.rb +6 -27
  155. data/lib/fog/storage/local.rb +7 -7
  156. data/lib/fog/storage/models/rackspace/directory.rb +1 -1
  157. data/lib/fog/storage/models/rackspace/file.rb +1 -0
  158. data/lib/fog/storage/rackspace.rb +5 -27
  159. data/lib/fog/storage/requests/aws/put_object.rb +2 -2
  160. data/lib/fog/storage/requests/aws/upload_part.rb +1 -1
  161. data/lib/fog/storage/requests/google/put_object.rb +2 -2
  162. data/lib/fog/storage/requests/rackspace/put_object.rb +1 -1
  163. data/tests/aws/requests/cloud_formation/stack_tests.rb +130 -0
  164. data/tests/aws/requests/iam/login_profile_tests.rb +64 -0
  165. data/tests/aws/requests/rds/helper.rb +169 -0
  166. data/tests/aws/requests/rds/instance_tests.rb +129 -0
  167. data/tests/aws/requests/rds/model_tests.rb +98 -0
  168. data/tests/aws/requests/rds/parameter_group_tests.rb +68 -0
  169. data/tests/aws/requests/rds/parameter_request_tests.rb +35 -0
  170. data/tests/compute/models/aws/server_monitor_tests.rb +47 -0
  171. data/tests/compute/models/server_tests.rb +7 -23
  172. data/tests/compute/parsers/aws/monitor_unmonitor_instances_tests.rb +49 -0
  173. data/tests/compute/requests/aws/security_group_tests.rb +69 -52
  174. data/tests/compute/requests/aws/tag_tests.rb +5 -5
  175. data/tests/compute/requests/brightbox/helper.rb +7 -6
  176. data/tests/compute/requests/brightbox/server_tests.rb +5 -0
  177. data/tests/compute/requests/voxel/server_tests.rb +2 -3
  178. data/tests/storage/requests/aws/bucket_tests.rb +10 -0
  179. metadata +148 -12
@@ -0,0 +1,98 @@
1
+ Shindo.tests('AWS::RDS | models', ['aws', 'rds']) do
2
+ @db_instance_id='fog-test'
3
+ @db_replica_id='fog-replica'
4
+
5
+ tests('success') do
6
+ pending if Fog.mocking?
7
+
8
+ tests('parametergroups') do
9
+ group = nil
10
+
11
+ tests('create') do
12
+ group = AWS[:rds].parameter_groups.create :id => 'testgroup', :family => 'mysql5.1', :description => 'test'
13
+ end
14
+
15
+ tests('#parameters') do
16
+ parameters = group.parameters
17
+ #search for a sample parameter
18
+ tests 'contains parameter' do
19
+ returns(true){ !!parameters.detect {|p| p.name == 'query_cache_size'}}
20
+ end
21
+ end
22
+
23
+ tests('modify') do
24
+ group.modify([{:name => 'query_cache_size', :value => '6553600', :apply_method => 'immediate'}])
25
+
26
+ tests 'parameter has changed' do
27
+ returns('6553600'){group.parameters.detect {|p| p.name == 'query_cache_size'}.value}
28
+ end
29
+ end
30
+
31
+ tests('destroy').succeeds do
32
+ group.destroy
33
+ end
34
+
35
+ returns(nil){AWS[:rds].parameter_groups.detect {|g| g.id == 'testgroup'}}
36
+ end
37
+
38
+ tests('servers') do
39
+ server = nil
40
+ tests('create').succeeds do
41
+ server = AWS[:rds].servers.create( :id => @db_instance_id, :allocated_storage => 5, :engine => 'mysql',
42
+ :master_username => 'foguser', :password => 'fogpassword',
43
+ :backup_retention_period => 0)
44
+ end
45
+
46
+ server.wait_for {ready?}
47
+
48
+ tests('snapshots') do
49
+ snapshot = nil
50
+
51
+ tests('create').succeeds do
52
+ snapshot = server.snapshots.create(:id => 'testsnapshot')
53
+ end
54
+
55
+ returns(@db_instance_id){snapshot.instance_id}
56
+ server.reload
57
+ server.wait_for {ready?}
58
+ snapshot.wait_for {ready?}
59
+ tests('all') do
60
+ returns(['testsnapshot']){server.snapshots.collect {|s| s.id}}
61
+ end
62
+
63
+ tests('destroy').succeeds do
64
+ snapshot.destroy
65
+ end
66
+
67
+ returns([]) {server.snapshots}
68
+ end
69
+
70
+ group = AWS[:rds].parameter_groups.create :id => 'some-group', :family => 'mysql5.1', :description => 'test'
71
+ tests('modify') do
72
+ server.modify(true, 'DBParameterGroupName' => 'some-group')
73
+ server.reload
74
+ returns('some-group'){server.db_parameter_groups.first['DBParameterGroupName']}
75
+ end
76
+
77
+ tests('reboot').succeeds do
78
+ server.reboot
79
+ end
80
+ server.wait_for {state == 'rebooting'}
81
+ server.wait_for {state == 'available'}
82
+
83
+ tests('destroy').succeeds do
84
+ server.destroy('finalsnapshot')
85
+ end
86
+
87
+ Fog.wait_for do
88
+ AWS[:rds].servers.length == 0
89
+ end
90
+
91
+ group.destroy
92
+
93
+ tests("final snapshot was created") do
94
+ AWS[:rds].snapshots.get('finalsnapshot').destroy
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,68 @@
1
+ Shindo.tests('AWS::RDS | parameter group requests', ['aws', 'rds']) do
2
+ tests('success') do
3
+ pending if Fog.mocking?
4
+
5
+ tests("#create_db_parameter_groups").formats(AWS::RDS::Formats::CREATE_DB_PARAMETER_GROUP) do
6
+ pending if Fog.mocking?
7
+ body = AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description').body
8
+
9
+ returns( 'mysql5.1') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupFamily']}
10
+ returns( 'fog-group') { body['CreateDBParameterGroupResult']['DBParameterGroup']['DBParameterGroupName']}
11
+ returns( 'Some description') { body['CreateDBParameterGroupResult']['DBParameterGroup']['Description']}
12
+
13
+ body
14
+ end
15
+
16
+ AWS[:rds].create_db_parameter_group('other-fog-group', 'MySQL5.1', 'Some description')
17
+
18
+ tests("#describe_db_parameter_groups").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
19
+ pending if Fog.mocking?
20
+
21
+ body = AWS[:rds].describe_db_parameter_groups().body
22
+
23
+ returns(3) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
24
+ body
25
+ end
26
+
27
+ tests("#describe_db_parameter_groups('fog-group)").formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETER_GROUP) do
28
+ pending if Fog.mocking?
29
+
30
+ body = AWS[:rds].describe_db_parameter_groups('fog-group').body
31
+
32
+ returns(1) {body['DescribeDBParameterGroupsResult']['DBParameterGroups'].length}
33
+
34
+ group = body['DescribeDBParameterGroupsResult']['DBParameterGroups'].first
35
+ returns( 'mysql5.1') { group['DBParameterGroupFamily']}
36
+ returns( 'fog-group') { group['DBParameterGroupName']}
37
+ returns( 'Some description') { group['Description']}
38
+
39
+ body
40
+ end
41
+
42
+ tests("delete_db_parameter_group").formats(AWS::RDS::Formats::BASIC) do
43
+ pending if Fog.mocking?
44
+ body = AWS[:rds].delete_db_parameter_group('fog-group').body
45
+
46
+ raises(Fog::AWS::RDS::NotFound) {AWS[:rds].describe_db_parameter_groups('fog-group')}
47
+
48
+ body
49
+ end
50
+
51
+ AWS[:rds].delete_db_parameter_group('other-fog-group')
52
+ end
53
+
54
+ tests("failures") do
55
+ pending if Fog.mocking?
56
+ raises(Fog::AWS::RDS::NotFound) {AWS[:rds].describe_db_parameter_groups('doesntexist')}
57
+ raises(Fog::AWS::RDS::NotFound) {AWS[:rds].delete_db_parameter_group('doesntexist')}
58
+
59
+ tests "creating second group with same id" do
60
+ AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
61
+ raises(Fog::AWS::RDS::IdentifierTaken) {AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')}
62
+ end
63
+
64
+ AWS[:rds].delete_db_parameter_group('fog-group')
65
+
66
+ end
67
+
68
+ end
@@ -0,0 +1,35 @@
1
+ Shindo.tests('AWS::RDS | parameter requests', ['aws', 'rds']) do
2
+ tests('success') do
3
+ pending if Fog.mocking?
4
+
5
+ AWS[:rds].create_db_parameter_group('fog-group', 'MySQL5.1', 'Some description')
6
+
7
+ tests('#modify_db_parameter_group').formats(AWS::RDS::Formats::MODIFY_PARAMETER_GROUP) do
8
+ body = AWS[:rds].modify_db_parameter_group('fog-group',[
9
+ {'ParameterName' => 'query_cache_size',
10
+ 'ParameterValue' => '12345',
11
+ 'ApplyMethod' => 'immediate'}
12
+ ]).body
13
+
14
+ body
15
+ end
16
+
17
+ tests('#describe_db_parameters').formats(AWS::RDS::Formats::DESCRIBE_DB_PARAMETERS) do
18
+ AWS[:rds].describe_db_parameters('fog-group', :max_records => 20).body
19
+ end
20
+
21
+
22
+ tests("#describe_db_parameters :source => 'user'")do
23
+ body = AWS[:rds].describe_db_parameters('fog-group', :source => 'user').body
24
+ returns(1){ body['DescribeDBParametersResult']['Parameters'].length}
25
+
26
+ param = body['DescribeDBParametersResult']['Parameters'].first
27
+ returns('query_cache_size'){param['ParameterName']}
28
+ returns('12345'){param['ParameterValue']}
29
+ returns(true){param['IsModifiable']}
30
+ returns('query_cache_size'){param['ParameterName']}
31
+ end
32
+ AWS[:rds].delete_db_parameter_group('fog-group')
33
+
34
+ end
35
+ end
@@ -0,0 +1,47 @@
1
+ Shindo.tests("AWS::Compute::Server | monitor", ['aws']) do
2
+
3
+ config = compute_providers[AWS]
4
+
5
+ if !Fog.mocking? || config[:mocked]
6
+ @instance = AWS[:compute].servers.new(config[:server_attributes])
7
+ end
8
+
9
+ tests('new instance') do
10
+
11
+ test('monitor') do
12
+ @instance.monitoring = true
13
+ @instance.attributes[:monitoring] == true
14
+ end
15
+
16
+ test('unmonitor') do
17
+ @instance.monitoring = false
18
+ @instance.attributes[:monitoring] == false
19
+ end
20
+
21
+ end
22
+
23
+ tests('existing instance') do
24
+
25
+ @instance.save
26
+
27
+ test('monitor') do
28
+ #what I'd really like to test is if connection.monitor_instances is being called
29
+ #this is a safeguard
30
+ @instance.identity != nil
31
+ @instance.monitoring = false
32
+ @instance.monitor = true
33
+ @instance.monitoring == true
34
+ end
35
+
36
+ test('unmonitor') do
37
+ #what I'd really like to test is if connection.monitor_instances is being called
38
+ #this is a safeguard
39
+ @instance.identity != nil
40
+ @instance.monitoring = true
41
+ @instance.monitor = false
42
+ @instance.monitoring == false
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -4,29 +4,13 @@ for provider, config in compute_providers
4
4
 
5
5
  server_tests(provider[:compute], (config[:server_attributes] || {}), config[:mocked]) do
6
6
 
7
- tests('responds_to(:bootstrap)') do
8
- pending if Fog.mocking? && !config[:mocked]
9
- @instance.responds_to(:bootstrap)
10
- end
11
-
12
- tests('responds_to(:private_ip_address)') do
13
- pending if Fog.mocking? && !config[:mocked]
14
- @instance.responds_to(:public_ip_address)
15
- end
16
-
17
- tests('responds_to(:public_ip_address)') do
18
- pending if Fog.mocking? && !config[:mocked]
19
- @instance.responds_to(:public_ip_address)
20
- end
21
-
22
- tests('responds_to(:scp)') do
23
- pending if Fog.mocking? && !config[:mocked]
24
- @instance.responds_to(:ssh)
25
- end
26
-
27
- tests('responds_to(:ssh)') do
28
- pending if Fog.mocking? && !config[:mocked]
29
- @instance.responds_to(:ssh)
7
+ if Fog.mocking? && !config[:mocked]
8
+ pending
9
+ else
10
+ responds_to(:boostrap)
11
+ responds_to(:public_ip_address)
12
+ responds_to(:scp)
13
+ responds_to(:ssh)
30
14
  end
31
15
 
32
16
  end
@@ -0,0 +1,49 @@
1
+ require 'fog/compute/parsers/aws/monitor_unmonitor_instances'
2
+
3
+ Shindo.tests('AWS::Compute::MonitorUnmonitorInstances | monitor/unmonitor parser') do
4
+
5
+ tests('success') do
6
+
7
+ tests('#parse') do
8
+
9
+ aws_result = <<-AWS
10
+ <UnmonitorInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/">
11
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
12
+ <instancesSet>
13
+ <item>
14
+ <instanceId>i-43a4412a</instanceId>
15
+ <monitoring>
16
+ <state>enabled</state>
17
+ </monitoring>
18
+ </item>
19
+ <item>
20
+ <instanceId>i-23a3397d</instanceId>
21
+ <monitoring>
22
+ <state>disabled</state>
23
+ </monitoring>
24
+ </item>
25
+ </instancesSet>
26
+ </UnmonitorInstancesResponse>
27
+ AWS
28
+
29
+ parser = Fog::Parsers::AWS::Compute::MonitorUnmonitorInstances.new
30
+ body = Nokogiri::XML::SAX::PushParser.new(parser)
31
+ body << aws_result
32
+
33
+ test('requestId') { parser.response['requestId'] == '59dbff89-35bd-4eac-99ed-be587EXAMPLE' }
34
+
35
+ test('enabled') do
36
+ selected = parser.response['instancesSet'].select { |item| item['instanceId'] == 'i-43a4412a' }[0]
37
+ selected['monitoring'] == 'enabled'
38
+ end
39
+
40
+ test('disabled') do
41
+ selected = parser.response['instancesSet'].select { |item| item['instanceId'] == 'i-23a3397d' }[0]
42
+ selected['monitoring'] == 'disabled'
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -24,21 +24,25 @@ Shindo.tests('AWS::Compute | security group requests', ['aws']) do
24
24
  AWS[:compute].create_security_group('fog_security_group', 'tests group').body
25
25
  end
26
26
 
27
- tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'fog_security_group', 'IpProtocol' => 'tcp', 'toPort' => 80})").formats(AWS::Compute::Formats::BASIC) do
28
- AWS[:compute].authorize_security_group_ingress({
29
- 'FromPort' => 80,
30
- 'GroupName' => 'fog_security_group',
31
- 'IpProtocol' => 'tcp',
32
- 'ToPort' => 80,
33
- }).body
27
+ tests("#authorize_security_group_ingress('fog_security_group', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").formats(AWS::Compute::Formats::BASIC) do
28
+ AWS[:compute].authorize_security_group_ingress(
29
+ 'fog_security_group',
30
+ {
31
+ 'FromPort' => 80,
32
+ 'IpProtocol' => 'tcp',
33
+ 'ToPort' => 80,
34
+ }
35
+ ).body
34
36
  end
35
37
 
36
- tests("#authorize_security_group_ingress({'GroupName' => 'fog_security_group', 'SourceSecurityGroupName' => 'fog_security_group', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").formats(AWS::Compute::Formats::BASIC) do
37
- AWS[:compute].authorize_security_group_ingress({
38
- 'GroupName' => 'fog_security_group',
39
- 'SourceSecurityGroupName' => 'fog_security_group',
40
- 'SourceSecurityGroupOwnerId' => @owner_id
41
- }).body
38
+ tests("#authorize_security_group_ingress('fog_security_group', {'SourceSecurityGroupName' => 'fog_security_group', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").formats(AWS::Compute::Formats::BASIC) do
39
+ AWS[:compute].authorize_security_group_ingress(
40
+ 'fog_security_group',
41
+ {
42
+ 'SourceSecurityGroupName' => 'fog_security_group',
43
+ 'SourceSecurityGroupOwnerId' => @owner_id
44
+ }
45
+ ).body
42
46
  end
43
47
 
44
48
  tests("#describe_security_groups").formats(@security_groups_format) do
@@ -49,21 +53,26 @@ Shindo.tests('AWS::Compute | security group requests', ['aws']) do
49
53
  AWS[:compute].describe_security_groups('group-name' => 'fog_security_group').body
50
54
  end
51
55
 
52
- tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'fog_security_group', 'IpProtocol' => 'tcp', 'toPort' => 80})").formats(AWS::Compute::Formats::BASIC) do
53
- AWS[:compute].revoke_security_group_ingress({
54
- 'FromPort' => 80,
55
- 'GroupName' => 'fog_security_group',
56
- 'IpProtocol' => 'tcp',
57
- 'ToPort' => 80,
58
- }).body
56
+ tests("#revoke_security_group_ingress('fog_security_group', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").formats(AWS::Compute::Formats::BASIC) do
57
+ AWS[:compute].revoke_security_group_ingress(
58
+ 'fog_security_group',
59
+ {
60
+ 'FromPort' => 80,
61
+ 'IpProtocol' => 'tcp',
62
+ 'ToPort' => 80,
63
+ }
64
+ ).body
59
65
  end
60
66
 
61
- tests("#revoke_security_group_ingress({'GroupName' => 'fog_security_group', 'SourceSecurityGroupName' => 'fog_security_group', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").formats(AWS::Compute::Formats::BASIC) do
62
- AWS[:compute].revoke_security_group_ingress({
63
- 'GroupName' => 'fog_security_group',
64
- 'SourceSecurityGroupName' => 'fog_security_group',
65
- 'SourceSecurityGroupOwnerId' => @owner_id
66
- }).body
67
+ tests("#revoke_security_group_ingress('fog_security_group', {'SourceSecurityGroupName' => 'fog_security_group', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").formats(AWS::Compute::Formats::BASIC) do
68
+ AWS[:compute].revoke_security_group_ingress(
69
+ 'fog_security_group',
70
+ {
71
+ 'GroupName' => 'fog_security_group',
72
+ 'SourceSecurityGroupName' => 'fog_security_group',
73
+ 'SourceSecurityGroupOwnerId' => @owner_id
74
+ }
75
+ ).body
67
76
  end
68
77
 
69
78
  tests("#delete_security_group('fog_security_group')").formats(AWS::Compute::Formats::BASIC) do
@@ -79,38 +88,46 @@ Shindo.tests('AWS::Compute | security group requests', ['aws']) do
79
88
  AWS[:compute].create_security_group(@security_group.name, @security_group.description)
80
89
  end
81
90
 
82
- tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::Compute::NotFound) do
83
- AWS[:compute].authorize_security_group_ingress({
84
- 'FromPort' => 80,
85
- 'GroupName' => 'not_a_group_name',
86
- 'IpProtocol' => 'tcp',
87
- 'ToPort' => 80,
88
- })
91
+ tests("#authorize_security_group_ingress('not_a_group_name', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::Compute::NotFound) do
92
+ AWS[:compute].authorize_security_group_ingress(
93
+ 'not_a_group_name',
94
+ {
95
+ 'FromPort' => 80,
96
+ 'IpProtocol' => 'tcp',
97
+ 'ToPort' => 80,
98
+ }
99
+ )
89
100
  end
90
101
 
91
- tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::Compute::NotFound) do
92
- AWS[:compute].authorize_security_group_ingress({
93
- 'GroupName' => 'not_a_group_name',
94
- 'SourceSecurityGroupName' => 'not_a_group_name',
95
- 'SourceSecurityGroupOwnerId' => @owner_id
96
- })
102
+ tests("#authorize_security_group_ingress('not_a_group_name', {'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::Compute::NotFound) do
103
+ AWS[:compute].authorize_security_group_ingress(
104
+ 'not_a_group_name',
105
+ {
106
+ 'SourceSecurityGroupName' => 'not_a_group_name',
107
+ 'SourceSecurityGroupOwnerId' => @owner_id
108
+ }
109
+ )
97
110
  end
98
111
 
99
- tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::Compute::NotFound) do
100
- AWS[:compute].revoke_security_group_ingress({
101
- 'FromPort' => 80,
102
- 'GroupName' => 'not_a_group_name',
103
- 'IpProtocol' => 'tcp',
104
- 'ToPort' => 80,
105
- })
112
+ tests("#revoke_security_group_ingress('not_a_group_name', {'FromPort' => 80, 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::Compute::NotFound) do
113
+ AWS[:compute].revoke_security_group_ingress(
114
+ 'not_a_group_name',
115
+ {
116
+ 'FromPort' => 80,
117
+ 'IpProtocol' => 'tcp',
118
+ 'ToPort' => 80,
119
+ }
120
+ )
106
121
  end
107
122
 
108
- tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::Compute::NotFound) do
109
- AWS[:compute].revoke_security_group_ingress({
110
- 'GroupName' => 'not_a_group_name',
111
- 'SourceSecurityGroupName' => 'not_a_group_name',
112
- 'SourceSecurityGroupOwnerId' => @owner_id
113
- })
123
+ tests("#revoke_security_group_ingress('not_a_group_name', {'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::Compute::NotFound) do
124
+ AWS[:compute].revoke_security_group_ingress(
125
+ 'not_a_group_name',
126
+ {
127
+ 'SourceSecurityGroupName' => 'not_a_group_name',
128
+ 'SourceSecurityGroupOwnerId' => @owner_id
129
+ }
130
+ )
114
131
  end
115
132
 
116
133
  tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::Compute::NotFound) do