fog 1.12.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/.travis.yml +1 -1
  2. data/Gemfile +5 -0
  3. data/Rakefile +14 -4
  4. data/bin/fog +22 -0
  5. data/changelog.txt +262 -0
  6. data/fog.gemspec +8 -4
  7. data/lib/fog/aws.rb +11 -0
  8. data/lib/fog/aws/auto_scaling.rb +15 -18
  9. data/lib/fog/aws/beanstalk.rb +8 -10
  10. data/lib/fog/aws/cloud_formation.rb +9 -12
  11. data/lib/fog/aws/compute.rb +8 -10
  12. data/lib/fog/aws/credential_fetcher.rb +6 -6
  13. data/lib/fog/aws/elasticache.rb +13 -17
  14. data/lib/fog/aws/elb.rb +29 -31
  15. data/lib/fog/aws/iam.rb +10 -13
  16. data/lib/fog/aws/models/auto_scaling/group.rb +6 -3
  17. data/lib/fog/aws/models/compute/spot_request.rb +1 -11
  18. data/lib/fog/aws/models/rds/log_file.rb +26 -0
  19. data/lib/fog/aws/models/rds/log_files.rb +50 -0
  20. data/lib/fog/aws/models/rds/server.rb +3 -1
  21. data/lib/fog/aws/models/rds/snapshot.rb +1 -0
  22. data/lib/fog/aws/models/rds/snapshots.rb +20 -13
  23. data/lib/fog/aws/parsers/rds/db_parser.rb +1 -1
  24. data/lib/fog/aws/parsers/rds/describe_db_log_files.rb +44 -0
  25. data/lib/fog/aws/parsers/rds/download_db_logfile_portion.rb +26 -0
  26. data/lib/fog/aws/parsers/ses/verify_domain_identity.rb +26 -0
  27. data/lib/fog/aws/parsers/storage/complete_multipart_upload.rb +1 -1
  28. data/lib/fog/aws/parsers/sts/assume_role.rb +30 -0
  29. data/lib/fog/aws/rds.rb +27 -14
  30. data/lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb +8 -0
  31. data/lib/fog/aws/requests/auto_scaling/update_auto_scaling_group.rb +8 -1
  32. data/lib/fog/aws/requests/compute/create_volume.rb +3 -3
  33. data/lib/fog/aws/requests/rds/create_db_instance.rb +3 -1
  34. data/lib/fog/aws/requests/rds/describe_db_log_files.rb +67 -0
  35. data/lib/fog/aws/requests/rds/download_db_logfile_portion.rb +63 -0
  36. data/lib/fog/aws/requests/ses/send_raw_email.rb +1 -1
  37. data/lib/fog/aws/requests/ses/verify_domain_identity.rb +30 -0
  38. data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +6 -2
  39. data/lib/fog/aws/requests/storage/get_object.rb +1 -1
  40. data/lib/fog/aws/requests/sts/assume_role.rb +46 -0
  41. data/lib/fog/aws/ses.rb +26 -9
  42. data/lib/fog/aws/storage.rb +2 -1
  43. data/lib/fog/aws/sts.rb +31 -21
  44. data/lib/fog/bin.rb +0 -1
  45. data/lib/fog/bin/openstack.rb +5 -0
  46. data/lib/fog/brightbox/compute.rb +20 -212
  47. data/lib/fog/brightbox/compute/shared.rb +232 -0
  48. data/lib/fog/brightbox/models/compute/collaboration.rb +43 -0
  49. data/lib/fog/brightbox/models/compute/collaborations.rb +23 -0
  50. data/lib/fog/brightbox/models/compute/user_collaboration.rb +29 -0
  51. data/lib/fog/brightbox/models/compute/user_collaborations.rb +23 -0
  52. data/lib/fog/brightbox/requests/compute/accept_user_collaboration.rb +21 -0
  53. data/lib/fog/brightbox/requests/compute/create_collaboration.rb +23 -0
  54. data/lib/fog/brightbox/requests/compute/delete_collaboration.rb +28 -0
  55. data/lib/fog/brightbox/requests/compute/delete_user_collaboration.rb +28 -0
  56. data/lib/fog/brightbox/requests/compute/destroy_user_collaboration.rb +21 -0
  57. data/lib/fog/brightbox/requests/compute/get_collaboration.rb +21 -0
  58. data/lib/fog/brightbox/requests/compute/get_user_collaboration.rb +21 -0
  59. data/lib/fog/brightbox/requests/compute/list_collaborations.rb +19 -0
  60. data/lib/fog/brightbox/requests/compute/list_user_collaborations.rb +19 -0
  61. data/lib/fog/brightbox/requests/compute/reject_user_collaboration.rb +21 -0
  62. data/lib/fog/brightbox/requests/compute/resend_collaboration.rb +21 -0
  63. data/lib/fog/cloudsigma/docs/getting_started.md +59 -0
  64. data/lib/fog/core.rb +7 -2
  65. data/lib/fog/core/connection.rb +62 -29
  66. data/lib/fog/core/deprecated/connection.rb +24 -0
  67. data/lib/fog/core/parser.rb +1 -1
  68. data/lib/fog/digitalocean/examples/getting_started.md +1 -1
  69. data/lib/fog/digitalocean/models/compute/server.rb +2 -2
  70. data/lib/fog/google/compute.rb +31 -7
  71. data/lib/fog/google/models/compute/disk.rb +80 -0
  72. data/lib/fog/google/models/compute/disks.rb +28 -0
  73. data/lib/fog/google/models/compute/image.rb +36 -0
  74. data/lib/fog/google/models/compute/server.rb +46 -33
  75. data/lib/fog/google/models/compute/servers.rb +15 -8
  76. data/lib/fog/google/requests/compute/delete_server.rb +5 -2
  77. data/lib/fog/google/requests/compute/get_disk.rb +3 -0
  78. data/lib/fog/google/requests/compute/get_server.rb +7 -1
  79. data/lib/fog/google/requests/compute/insert_disk.rb +8 -2
  80. data/lib/fog/google/requests/compute/insert_server.rb +51 -22
  81. data/lib/fog/google/requests/compute/list_machine_types.rb +3 -2
  82. data/lib/fog/google/requests/storage/get_object.rb +1 -1
  83. data/lib/fog/hp/requests/storage/get_object.rb +1 -1
  84. data/lib/fog/hp/storage.rb +26 -9
  85. data/lib/fog/ibm/requests/compute/create_instance.rb +20 -15
  86. data/lib/fog/internet_archive/requests/storage/get_object.rb +1 -1
  87. data/lib/fog/{core/json.rb → json.rb} +13 -2
  88. data/lib/fog/metering.rb +25 -0
  89. data/lib/fog/openstack.rb +1 -0
  90. data/lib/fog/openstack/metering.rb +215 -0
  91. data/lib/fog/openstack/models/compute/flavors.rb +2 -2
  92. data/lib/fog/openstack/models/compute/metadata.rb +1 -1
  93. data/lib/fog/openstack/models/compute/server.rb +5 -2
  94. data/lib/fog/openstack/models/image/images.rb +1 -1
  95. data/lib/fog/openstack/models/metering/meter.rb +0 -0
  96. data/lib/fog/openstack/models/metering/meters.rb +0 -0
  97. data/lib/fog/openstack/models/metering/resource.rb +24 -0
  98. data/lib/fog/openstack/models/metering/resources.rb +25 -0
  99. data/lib/fog/openstack/models/volume/volume.rb +3 -1
  100. data/lib/fog/openstack/models/volume/volumes.rb +2 -1
  101. data/lib/fog/openstack/network.rb +1 -1
  102. data/lib/fog/openstack/requests/compute/create_flavor.rb +1 -1
  103. data/lib/fog/openstack/requests/compute/create_server.rb +19 -1
  104. data/lib/fog/openstack/requests/compute/detach_volume.rb +2 -1
  105. data/lib/fog/openstack/requests/compute/list_flavors_detail.rb +4 -3
  106. data/lib/fog/openstack/requests/compute/list_security_groups.rb +1 -1
  107. data/lib/fog/openstack/requests/identity/create_tenant.rb +2 -2
  108. data/lib/fog/openstack/requests/metering/get_resource.rb +32 -0
  109. data/lib/fog/openstack/requests/metering/get_samples.rb +55 -0
  110. data/lib/fog/openstack/requests/metering/get_statistics.rb +56 -0
  111. data/lib/fog/openstack/requests/metering/list_meters.rb +50 -0
  112. data/lib/fog/openstack/requests/metering/list_resources.rb +32 -0
  113. data/lib/fog/openstack/requests/volume/create_volume.rb +4 -2
  114. data/lib/fog/rackspace.rb +16 -1
  115. data/lib/fog/rackspace/block_storage.rb +13 -28
  116. data/lib/fog/rackspace/cdn.rb +10 -24
  117. data/lib/fog/rackspace/compute.rb +17 -45
  118. data/lib/fog/rackspace/compute_v2.rb +13 -33
  119. data/lib/fog/rackspace/databases.rb +13 -29
  120. data/lib/fog/rackspace/dns.rb +27 -23
  121. data/lib/fog/rackspace/identity.rb +10 -26
  122. data/lib/fog/rackspace/load_balancers.rb +13 -29
  123. data/lib/fog/rackspace/mock_data.rb +3 -3
  124. data/lib/fog/rackspace/models/compute/server.rb +1 -1
  125. data/lib/fog/rackspace/models/dns/zones.rb +34 -21
  126. data/lib/fog/rackspace/models/identity/users.rb +2 -2
  127. data/lib/fog/rackspace/models/storage/file.rb +1 -0
  128. data/lib/fog/rackspace/requests/dns/list_domains.rb +2 -2
  129. data/lib/fog/rackspace/requests/storage/delete_multiple_objects.rb +75 -0
  130. data/lib/fog/rackspace/requests/storage/delete_static_large_object.rb +50 -0
  131. data/lib/fog/rackspace/requests/storage/get_object.rb +3 -1
  132. data/lib/fog/rackspace/requests/storage/put_dynamic_obj_manifest.rb +44 -0
  133. data/lib/fog/rackspace/requests/storage/put_object_manifest.rb +3 -30
  134. data/lib/fog/rackspace/requests/storage/put_static_obj_manifest.rb +60 -0
  135. data/lib/fog/rackspace/service.rb +43 -1
  136. data/lib/fog/rackspace/storage.rb +25 -43
  137. data/lib/fog/riakcs/provisioning.rb +2 -1
  138. data/lib/fog/riakcs/usage.rb +2 -1
  139. data/lib/fog/vcloud/requests/compute/configure_vm_cpus.rb +1 -1
  140. data/lib/fog/vcloud/requests/compute/configure_vm_memory.rb +1 -1
  141. data/lib/fog/version.rb +1 -1
  142. data/lib/fog/vsphere/requests/compute/get_folder.rb +1 -1
  143. data/lib/fog/xenserver/compute.rb +2 -0
  144. data/lib/fog/xenserver/models/compute/server.rb +9 -7
  145. data/lib/fog/xenserver/requests/compute/snapshot_revert.rb +22 -0
  146. data/lib/fog/xenserver/requests/compute/snapshot_server.rb +22 -0
  147. data/lib/fog/xml.rb +21 -0
  148. data/lib/fog/xml/sax_parser_connection.rb +43 -0
  149. data/lib/tasks/changelog_task.rb +1 -0
  150. data/tests/aws/models/auto_scaling/groups_test.rb +22 -0
  151. data/tests/aws/requests/compute/volume_tests.rb +3 -3
  152. data/tests/aws/requests/rds/helper.rb +14 -0
  153. data/tests/aws/requests/rds/log_file_tests.rb +19 -0
  154. data/tests/aws/requests/ses/verified_domain_identity_tests.rb +16 -0
  155. data/tests/aws/requests/sts/assume_role_tests.rb +19 -0
  156. data/tests/brightbox/requests/compute/collaboration_tests.rb +41 -0
  157. data/tests/brightbox/requests/compute/helper.rb +46 -2
  158. data/tests/brightbox/requests/compute/user_collaboration_tests.rb +67 -0
  159. data/tests/core/connection_tests.rb +26 -0
  160. data/tests/helper.rb +13 -0
  161. data/tests/openstack/requests/metering/meter_tests.rb +52 -0
  162. data/tests/openstack/requests/metering/resource_tests.rb +19 -0
  163. data/tests/openvz/helper.rb +14 -8
  164. data/tests/rackspace/block_storage_tests.rb +9 -0
  165. data/tests/rackspace/compute_tests.rb +9 -0
  166. data/tests/rackspace/compute_v2_tests.rb +9 -0
  167. data/tests/rackspace/databases_tests.rb +9 -0
  168. data/tests/rackspace/dns_tests.rb +20 -0
  169. data/tests/rackspace/helper.rb +12 -1
  170. data/tests/rackspace/identity_tests.rb +25 -0
  171. data/tests/rackspace/load_balancer_tests.rb +10 -0
  172. data/tests/rackspace/models/block_storage/volume_tests.rb +2 -2
  173. data/tests/rackspace/models/compute_v2/metadata_tests.rb +2 -2
  174. data/tests/rackspace/models/compute_v2/server_tests.rb +22 -21
  175. data/tests/rackspace/models/dns/zones_tests.rb +19 -5
  176. data/tests/rackspace/models/storage/file_tests.rb +22 -6
  177. data/tests/rackspace/rackspace_tests.rb +35 -0
  178. data/tests/rackspace/requests/block_storage/snapshot_tests.rb +2 -3
  179. data/tests/rackspace/requests/block_storage/volume_type_tests.rb +4 -11
  180. data/tests/rackspace/requests/compute_v2/address_tests.rb +1 -1
  181. data/tests/rackspace/requests/compute_v2/attachment_tests.rb +8 -9
  182. data/tests/rackspace/requests/compute_v2/flavor_tests.rb +1 -1
  183. data/tests/rackspace/requests/compute_v2/metadata_tests.rb +4 -4
  184. data/tests/rackspace/requests/databases/database_tests.rb +23 -20
  185. data/tests/rackspace/requests/databases/user_tests.rb +6 -6
  186. data/tests/rackspace/requests/identity/user_tests.rb +4 -1
  187. data/tests/rackspace/requests/load_balancers/usage_tests.rb +4 -2
  188. data/tests/rackspace/requests/storage/large_object_tests.rb +303 -59
  189. data/tests/rackspace/requests/storage/object_tests.rb +73 -18
  190. data/tests/rackspace/service_tests.rb +83 -0
  191. data/tests/rackspace/storage_tests.rb +9 -0
  192. data/tests/xenserver/models/compute/server_tests.rb +11 -1
  193. metadata +89 -19
  194. data/tests/core/user_agent_tests.rb +0 -6
@@ -0,0 +1,19 @@
1
+ Shindo.tests('Fog::Metering[:openstack] | resource requests', ['openstack']) do
2
+
3
+ @resource_format = {
4
+ 'resource_id' => String,
5
+ 'project_id' => String,
6
+ 'user_id' => String,
7
+ 'metadata' => Hash,
8
+ }
9
+
10
+ tests('success') do
11
+ tests('#list_resource').formats([@resource_format]) do
12
+ Fog::Metering[:openstack].list_resources.body
13
+ end
14
+
15
+ tests('#get_resource').formats(@resource_format) do
16
+ Fog::Metering[:openstack].get_resource('test').body
17
+ end
18
+ end
19
+ end
@@ -18,6 +18,9 @@ def openvz_fog_test_server
18
18
  # Server bootstrap took more than 120 secs!
19
19
  end
20
20
  end
21
+
22
+ openvz_fog_test_cleanup
23
+
21
24
  server
22
25
  end
23
26
 
@@ -27,15 +30,18 @@ def openvz_fog_test_server_destroy
27
30
  server.destroy if server
28
31
  end
29
32
 
30
- at_exit do
31
- unless Fog.mocking?
32
- server = openvz_service.servers.find { |s| s.name == '104' }
33
- if server
34
- server.wait_for(120) do
35
- reload rescue nil; ready?
33
+ # Prepare a callback to destroy the long lived test server
34
+ def openvz_fog_test_cleanup
35
+ at_exit do
36
+ unless Fog.mocking?
37
+ server = openvz_service.servers.find { |s| s.name == '104' }
38
+ if server
39
+ server.wait_for(120) do
40
+ reload rescue nil; ready?
41
+ end
36
42
  end
43
+ server.stop
44
+ openvz_fog_test_server_destroy
37
45
  end
38
- server.stop
39
- openvz_fog_test_server_destroy
40
46
  end
41
47
  end
@@ -101,4 +101,13 @@ Shindo.tests('Fog::Rackspace::BlockStorage', ['rackspace']) do
101
101
  end
102
102
  end
103
103
 
104
+ tests('reauthentication') do
105
+ pending if Fog.mocking?
106
+
107
+ @service = Fog::Rackspace::BlockStorage.new :rackspace_region => :ord
108
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
109
+ @service.instance_variable_set("@auth_token", "bad-token")
110
+ returns(200) { @service.list_volumes.status }
111
+ end
112
+
104
113
  end
@@ -87,4 +87,13 @@ Shindo.tests('Rackspace | Compute', ['rackspace']) do
87
87
  returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /snet-/) != nil }
88
88
  end
89
89
  end
90
+
91
+ tests('reauthentication') do
92
+ pending if Fog.mocking?
93
+
94
+ @service = Fog::Compute::Rackspace.new
95
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
96
+ @service.instance_variable_set("@auth_token", "bad-token")
97
+ returns(true) { [200, 203].include?(@service.list_flavors.status) }
98
+ end
90
99
  end
@@ -100,4 +100,13 @@ Shindo.tests('Fog::Compute::RackspaceV2', ['rackspace']) do
100
100
  end
101
101
  end
102
102
 
103
+ tests('reauthentication') do
104
+ pending if Fog.mocking?
105
+
106
+ @service = Fog::Compute::RackspaceV2.new
107
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
108
+ @service.instance_variable_set("@auth_token", "bad_token")
109
+ returns(true) { [200, 203].include? @service.list_flavors.status }
110
+ end
111
+
103
112
  end
@@ -102,6 +102,15 @@ Shindo.tests('Fog::Rackspace::Databases', ['rackspace']) do |variable|
102
102
  end
103
103
  end
104
104
 
105
+ tests('reauthentication') do
106
+ pending if Fog.mocking?
107
+
108
+ @service = Fog::Rackspace::Databases.new
109
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
110
+ @service.instance_variable_set("@auth_token", "bad_token")
111
+ returns(200) { @service.list_flavors.status }
112
+ end
113
+
105
114
  @service = Fog::Rackspace::Databases.new
106
115
 
107
116
  tests('#flavors').succeeds do
@@ -82,4 +82,24 @@ Shindo.tests('Fog::DNS::Rackspace', ['rackspace']) do
82
82
  end
83
83
  end
84
84
 
85
+ tests('reauthentication') do
86
+ pending if Fog.mocking?
87
+
88
+ @service =Fog::DNS::Rackspace.new
89
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
90
+ @service.instance_variable_set("@auth_token", "bad_token")
91
+ returns(200) { @service.list_domains.status }
92
+ end
93
+
94
+ tests('array_to_query_string') do
95
+ pending if Fog.mocking?
96
+
97
+ @service = Fog::DNS::Rackspace.new
98
+ returns("") { @service.send(:array_to_query_string, nil) }
99
+ returns("param1=1") { @service.send(:array_to_query_string, {:param1 => [1]}) }
100
+ returns("param1=1") { @service.send(:array_to_query_string, {:param1 => 1}) }
101
+ returns("param1=1,2") { @service.send(:array_to_query_string, {:param1 => [1,2]}) }
102
+ returns("param1=1&param2=2") { @service.send(:array_to_query_string, {:param1 => [1], :param2 => [2]}) }
103
+ end
104
+
85
105
  end
@@ -1,6 +1,11 @@
1
1
  module Shindo
2
2
  class Tests
3
-
3
+
4
+ unless Fog.mocking?
5
+ Fog.timeout = 2000
6
+ Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds"
7
+ end
8
+
4
9
  def given_a_load_balancer_service(&block)
5
10
  @service = Fog::Rackspace::LoadBalancers.new
6
11
  instance_eval(&block)
@@ -23,6 +28,12 @@ module Shindo
23
28
  end
24
29
  end
25
30
 
31
+ def wait_for_request(description = "waiting", &block)
32
+ return if Fog.mocking?
33
+ tests(description) do
34
+ Fog.wait_for &block
35
+ end
36
+ end
26
37
 
27
38
  def wait_for_server_deletion(server)
28
39
  return if Fog.mocking?
@@ -0,0 +1,25 @@
1
+ Shindo.tests('Fog::Rackspace::Identity', ['rackspace']) do
2
+
3
+ tests('current authentication') do
4
+ pending if Fog.mocking?
5
+
6
+ tests('variables populated').returns(200) do
7
+ @service = Fog::Rackspace::Identity.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true}
8
+ returns(true, "auth token populated") { !@service.auth_token.nil? }
9
+ returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? }
10
+ returns(false, "service catalog populated") { @service.service_catalog.nil? }
11
+
12
+ @service.list_tenants.status
13
+ end
14
+ end
15
+
16
+ tests('reauthentication') do
17
+ pending if Fog.mocking?
18
+
19
+ @service = Fog::Rackspace::Identity.new :rackspace_region => :ord
20
+ returns(true, "auth token populated") { !@service.auth_token.nil? }
21
+ @service.instance_variable_set("@auth_token", "bad-token")
22
+ returns(true) { [200, 203].include? @service.list_tenants.status }
23
+ end
24
+
25
+ end
@@ -101,6 +101,16 @@ Shindo.tests('Fog::Rackspace::LoadBalancers', ['rackspace']) do
101
101
  end
102
102
  end
103
103
 
104
+
105
+ tests('reauthentication') do
106
+ pending if Fog.mocking?
107
+
108
+ @service = Fog::Rackspace::LoadBalancers.new
109
+ returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
110
+ @service.instance_variable_set("@auth_token", "bad-token")
111
+ returns(200) { @service.list_load_balancers.status }
112
+ end
113
+
104
114
  pending if Fog.mocking?
105
115
 
106
116
  @service = Fog::Rackspace::LoadBalancers.new
@@ -4,7 +4,7 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume', ['rackspace']) do
4
4
  options = { :display_name => "fog_#{Time.now.to_i.to_s}", :size => 100 }
5
5
 
6
6
  model_tests(service.volumes, options, true) do
7
- @instance.wait_for(timeout=1200) { ready? }
7
+ @instance.wait_for{ ready? }
8
8
 
9
9
  tests('double save').raises(Fog::Rackspace::BlockStorage::IdentifierTaken) do
10
10
  @instance.save
@@ -18,7 +18,7 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume', ['rackspace']) do
18
18
  tests('#snapshots').succeeds do
19
19
  begin
20
20
  snapshot = @instance.create_snapshot
21
- snapshot.wait_for(timeout=1200) { ready? }
21
+ snapshot.wait_for { ready? }
22
22
 
23
23
  returns(true) { @instance.snapshots.first.id == snapshot.id }
24
24
  ensure
@@ -11,7 +11,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do
11
11
  :flavor_id => rackspace_test_flavor_id(service),
12
12
  :image_id => rackspace_test_image_id(service))
13
13
 
14
- @server.wait_for(timeout=1500) { ready? }
14
+ @server.wait_for { ready? }
15
15
 
16
16
  tests('server') do
17
17
  collection_tests(@server.metadata, {:key => 'my_key', :value => 'my_value'}) do
@@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do
21
21
 
22
22
  tests('image') do
23
23
  @image = @server.create_image("fog_image_#{test_time}", :metadata => {:my_key => 'my_value'})
24
- @image.wait_for(timeout = 1500) { ready? }
24
+ @image.wait_for { ready? }
25
25
  tests("#all").succeeds do
26
26
  pending if Fog.mocking? && !mocks_implemented
27
27
  metadata = @image.metadata.all
@@ -66,7 +66,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
66
66
  end
67
67
 
68
68
  model_tests(service.servers, options, true) do
69
- @instance.wait_for(timeout=1500) { ready? }
69
+ @instance.wait_for { ready? }
70
70
 
71
71
  tests('#metadata[\'fog_test\']').returns('true') do
72
72
  @instance.metadata['fog_test']
@@ -79,12 +79,12 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
79
79
  tests('#update').succeeds do
80
80
  @instance.name = "fog_server_update"
81
81
  @instance.access_ipv4_address= "10.10.0.1"
82
- @instance.access_ipv6_address= "0:0:0:0:0:0:0:1"
82
+ @instance.access_ipv6_address= "::1"
83
83
  @instance.save
84
84
  sleep 60 unless Fog.mocking?
85
85
  @instance.reload
86
86
  returns("10.10.0.1") { @instance.access_ipv4_address }
87
- returns("0:0:0:0:0:0:0:1") { @instance.access_ipv6_address }
87
+ returns("::1") { @instance.access_ipv6_address }
88
88
  returns("fog_server_update") { @instance.name }
89
89
  end
90
90
 
@@ -93,13 +93,13 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
93
93
  returns('REBOOT') { @instance.state }
94
94
  end
95
95
 
96
- @instance.wait_for(timeout=1500) { ready? }
96
+ @instance.wait_for { ready? }
97
97
  tests('#reboot("HARD")').succeeds do
98
98
  @instance.reboot('HARD')
99
99
  returns('HARD_REBOOT') { @instance.state }
100
100
  end
101
101
 
102
- @instance.wait_for(timeout=1500) { ready? }
102
+ @instance.wait_for { ready? }
103
103
  @test_image = nil
104
104
  begin
105
105
  tests('#create_image').succeeds do
@@ -112,7 +112,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
112
112
  end
113
113
 
114
114
  sleep 30 unless Fog.mocking?
115
- @instance.wait_for(timeout=1500) { ready? }
115
+ @instance.wait_for { ready? }
116
116
  sleep 60 unless Fog.mocking?
117
117
  tests('#rebuild').succeeds do
118
118
  @instance.rebuild rackspace_test_image_id(service)
@@ -120,7 +120,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
120
120
  end
121
121
 
122
122
  sleep 30 unless Fog.mocking?
123
- @instance.wait_for(timeout=1500) { ready? }
123
+ @instance.wait_for { ready? }
124
124
  sleep 60 unless Fog.mocking?
125
125
  tests('#resize').succeeds do
126
126
  @instance.resize(3)
@@ -128,37 +128,37 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
128
128
  end
129
129
 
130
130
  sleep 30 unless Fog.mocking?
131
- @instance.wait_for(timeout=1500) { ready?('VERIFY_RESIZE', ['ACTIVE', 'ERROR']) }
131
+ @instance.wait_for { ready?('VERIFY_RESIZE', ['ACTIVE', 'ERROR']) }
132
132
  sleep 60 unless Fog.mocking?
133
133
  tests('#confirm_resize').succeeds do
134
134
  @instance.confirm_resize
135
135
  end
136
136
 
137
137
  sleep 30 unless Fog.mocking?
138
- @instance.wait_for(timeout=1500) { ready? }
138
+ @instance.wait_for { ready? }
139
139
  sleep 60 unless Fog.mocking?
140
140
  tests('#resize').succeeds do
141
141
  @instance.resize(2)
142
142
  returns('RESIZE') { @instance.state }
143
143
  end
144
144
 
145
- @instance.wait_for(timeout=1500) { ready?('VERIFY_RESIZE') }
145
+ @instance.wait_for { ready?('VERIFY_RESIZE') }
146
146
  sleep 60 unless Fog.mocking?
147
147
  tests('#revert_resize').succeeds do
148
148
  @instance.revert_resize
149
149
  end
150
150
 
151
- @instance.wait_for(timeout=1500) { ready? }
151
+ @instance.wait_for { ready? }
152
152
  tests('#rescue').succeeds do
153
153
  @instance.rescue
154
154
  end
155
155
 
156
- @instance.wait_for(timeout=1500) { ready?('RESCUE') }
156
+ @instance.wait_for { ready?('RESCUE') }
157
157
  tests('#unrescue').succeeds do
158
158
  @instance.unrescue
159
159
  end
160
160
 
161
- @instance.wait_for(timeout=1500) { ready? }
161
+ @instance.wait_for { ready? }
162
162
  tests('#change_admin_password').succeeds do
163
163
  @instance.change_admin_password('somerandompassword')
164
164
  returns('PASSWORD') { @instance.state }
@@ -168,28 +168,29 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
168
168
  tests('attachments') do
169
169
  begin
170
170
  @volume = cbs_service.volumes.create(:size => 100, :display_name => "fog-#{Time.now.to_i.to_s}")
171
- @volume.wait_for(timeout=1500) { ready? }
171
+ @volume.wait_for { ready? }
172
172
  tests('#attach_volume').succeeds do
173
173
  @instance.attach_volume(@volume)
174
174
  end
175
175
  tests('#attachments').returns(true) do
176
- @instance.wait_for(timeout=1500) do
176
+ @instance.wait_for do
177
177
  !attachments.empty?
178
178
  end
179
179
  @instance.attachments.any? {|a| a.volume_id == @volume.id }
180
180
  end
181
181
  ensure
182
- @volume.wait_for(timeout=1500) { !attachments.empty? }
182
+ @volume.wait_for { !attachments.empty? }
183
183
  @instance.attachments.each {|a| a.detach }
184
- @volume.wait_for(timeout=1500) { ready? && attachments.empty? }
184
+ @volume.wait_for { ready? && attachments.empty? }
185
185
  @volume.destroy if @volume
186
186
  end
187
187
  end
188
188
 
189
- @instance.wait_for(timeout=1500) { ready? }
189
+ @instance.wait_for { ready? }
190
190
  end
191
191
 
192
192
  wait_for_server_deletion(@instance)
193
+ sleep 60 unless Fog.mocking?
193
194
 
194
195
  tests("delete network #{@network.label}").succeeds do
195
196
  @network.destroy if @network
@@ -197,17 +198,17 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
197
198
 
198
199
  #When after testing resize/resize_confirm we get a 409 when we try to resize_revert so I am going to split it into two blocks
199
200
  model_tests(service.servers, options, true) do
200
- @instance.wait_for(timeout=1500) { ready? }
201
+ @instance.wait_for { ready? }
201
202
  tests('#resize').succeeds do
202
203
  @instance.resize(4)
203
204
  returns('RESIZE') { @instance.state }
204
205
  end
205
206
 
206
- @instance.wait_for(timeout=1500) { ready?('VERIFY_RESIZE') }
207
+ @instance.wait_for { ready?('VERIFY_RESIZE') }
207
208
  sleep 60 unless Fog.mocking?
208
209
  tests('#revert_resize').succeeds do
209
210
  @instance.revert_resize
210
211
  end
211
- @instance.wait_for(timeout=1500) { ready? }
212
+ @instance.wait_for { ready? }
212
213
  end
213
214
  end
@@ -1,22 +1,36 @@
1
1
  Shindo.tests('Fog::Rackspace::DNS | zones', ['rackspace']) do
2
- pending if Fog.mocking?
3
2
 
4
3
  provider = Fog::DNS[:rackspace]
5
4
  domain_sld = uniq_id
6
5
  domain_name = domain_sld + '.com'
7
6
 
8
7
  begin
9
- zone = provider.zones.create({:domain => domain_name, :email => "hostmaster@#{domain_name}"})
8
+ unless Fog.mocking?
9
+ zone = provider.zones.create({:domain => domain_name, :email => "hostmaster@#{domain_name}"})
10
+ end
10
11
 
11
12
  tests("zones.find(#{domain_sld}) => finds domain_name") do
12
- returns(1) { provider.zones.find(domain_sld).length }
13
+ pending if Fog.mocking?
14
+ returns(true) { provider.zones.all.any? {|z| z.domain == domain_name} }
13
15
  end
14
16
 
15
17
  random_name = uniq_id
16
18
  tests("zones.find(#{random_name}) => finds nothing") do
17
- returns(0) { provider.zones.find(random_name).length }
19
+ pending if Fog.mocking?
20
+ returns(false) { provider.zones.all.any? {|z| z.domain == random_name} }
18
21
  end
19
22
  ensure
20
- zone.destroy
23
+ zone.destroy unless Fog.mocking?
24
+ end
25
+
26
+ tests('next_params') do
27
+ zones = Fog::DNS::Rackspace::Zones.new
28
+ returns(nil, "no body") { zones.send(:next_params, nil)}
29
+ returns(nil, "no links") { zones.send(:next_params, {}) }
30
+ returns(nil, "links are empty") { zones.send(:next_params, {'links' => []}) }
31
+ returns(nil, "links does not contain next hash") { zones.send(:next_params, {'links' => [ {'rel' => 'previous'} ] }) }
32
+ returns(nil, "contains a link without parameters") { zones.send(:next_params, {'links' => [ {'rel' => 'next', 'href' => "http://localhost/next"} ] }) }
33
+ returns({"offset"=>["3"], "limit"=>["3"]}, "contains a link without parameters") { zones.send(:next_params, {'links' => [ {'rel' => 'next', 'href' => "http://localhost/next?offset=3&limit=3"} ] }) }
21
34
  end
35
+
22
36
  end