fog 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. data/.gitignore +2 -1
  2. data/Rakefile +90 -1
  3. data/bin/fog +5 -1
  4. data/changelog.txt +156 -0
  5. data/docs/_layouts/default.html +1 -0
  6. data/docs/about/press.markdown +4 -0
  7. data/docs/compute/index.markdown +4 -0
  8. data/docs/storage/index.markdown +4 -0
  9. data/fog.gemspec +3 -3
  10. data/lib/fog.rb +1 -1
  11. data/lib/fog/aws/iam.rb +7 -6
  12. data/lib/fog/aws/models/rds/server.rb +27 -23
  13. data/lib/fog/aws/parsers/iam/get_group.rb +2 -2
  14. data/lib/fog/aws/requests/iam/update_server_certificate.rb +37 -0
  15. data/lib/fog/bin.rb +2 -1
  16. data/lib/fog/bin/dynect.rb +30 -0
  17. data/lib/fog/bin/rackspace.rb +4 -0
  18. data/lib/fog/cdn.rb +4 -0
  19. data/lib/fog/cdn/aws.rb +6 -0
  20. data/lib/fog/cdn/parsers/aws/get_invalidation_list.rb +43 -0
  21. data/lib/fog/cdn/parsers/aws/get_streaming_distribution_list.rb +59 -0
  22. data/lib/fog/cdn/parsers/aws/streaming_distribution.rb +59 -0
  23. data/lib/fog/cdn/requests/aws/delete_streaming_distribution.rb +28 -0
  24. data/lib/fog/cdn/requests/aws/get_invalidation_list.rb +42 -0
  25. data/lib/fog/cdn/requests/aws/get_streaming_distribution.rb +50 -0
  26. data/lib/fog/cdn/requests/aws/get_streaming_distribution_list.rb +59 -0
  27. data/lib/fog/cdn/requests/aws/post_streaming_distribution.rb +78 -0
  28. data/lib/fog/cdn/requests/aws/put_streaming_distribution_config.rb +83 -0
  29. data/lib/fog/compute.rb +6 -2
  30. data/lib/fog/compute/aws.rb +12 -1
  31. data/lib/fog/compute/brightbox.rb +22 -12
  32. data/lib/fog/compute/models/aws/image.rb +5 -0
  33. data/lib/fog/compute/models/aws/server.rb +19 -22
  34. data/lib/fog/compute/models/aws/tag.rb +1 -1
  35. data/lib/fog/compute/models/bluebox/server.rb +2 -18
  36. data/lib/fog/compute/models/brightbox/account.rb +1 -1
  37. data/lib/fog/compute/models/brightbox/server.rb +2 -2
  38. data/lib/fog/compute/models/go_grid/server.rb +2 -18
  39. data/lib/fog/compute/models/linode/server.rb +5 -5
  40. data/lib/fog/compute/models/ninefold/server.rb +2 -2
  41. data/lib/fog/compute/models/rackspace/server.rb +2 -18
  42. data/lib/fog/compute/models/server.rb +27 -0
  43. data/lib/fog/compute/models/slicehost/server.rb +2 -18
  44. data/lib/fog/compute/models/storm_on_demand/server.rb +3 -3
  45. data/lib/fog/compute/models/voxel/server.rb +2 -2
  46. data/lib/fog/compute/parsers/aws/describe_images.rb +15 -3
  47. data/lib/fog/compute/parsers/aws/describe_instances.rb +1 -1
  48. data/lib/fog/compute/parsers/aws/describe_security_groups.rb +31 -7
  49. data/lib/fog/compute/requests/aws/describe_images.rb +33 -14
  50. data/lib/fog/compute/requests/aws/describe_volumes.rb +1 -0
  51. data/lib/fog/compute/requests/aws/modify_image_attribute.rb +39 -0
  52. data/lib/fog/compute/requests/aws/modify_instance_attribute.rb +37 -0
  53. data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +10 -10
  54. data/lib/fog/compute/requests/aws/register_image.rb +54 -13
  55. data/lib/fog/compute/requests/aws/run_instances.rb +5 -0
  56. data/lib/fog/compute/requests/aws/stop_instances.rb +2 -1
  57. data/lib/fog/compute/requests/brightbox/activate_console_server.rb +2 -8
  58. data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +2 -8
  59. data/lib/fog/compute/requests/brightbox/add_nodes_load_balancer.rb +2 -8
  60. data/lib/fog/compute/requests/brightbox/create_api_client.rb +2 -8
  61. data/lib/fog/compute/requests/brightbox/create_cloud_ip.rb +2 -8
  62. data/lib/fog/compute/requests/brightbox/create_image.rb +2 -8
  63. data/lib/fog/compute/requests/brightbox/create_load_balancer.rb +2 -8
  64. data/lib/fog/compute/requests/brightbox/create_server.rb +2 -8
  65. data/lib/fog/compute/requests/brightbox/destroy_api_client.rb +2 -8
  66. data/lib/fog/compute/requests/brightbox/destroy_cloud_ip.rb +2 -8
  67. data/lib/fog/compute/requests/brightbox/destroy_image.rb +2 -8
  68. data/lib/fog/compute/requests/brightbox/destroy_load_balancer.rb +2 -8
  69. data/lib/fog/compute/requests/brightbox/destroy_server.rb +2 -8
  70. data/lib/fog/compute/requests/brightbox/get_account.rb +2 -8
  71. data/lib/fog/compute/requests/brightbox/get_api_client.rb +2 -8
  72. data/lib/fog/compute/requests/brightbox/get_cloud_ip.rb +2 -8
  73. data/lib/fog/compute/requests/brightbox/get_image.rb +2 -8
  74. data/lib/fog/compute/requests/brightbox/get_interface.rb +2 -8
  75. data/lib/fog/compute/requests/brightbox/get_load_balancer.rb +2 -8
  76. data/lib/fog/compute/requests/brightbox/get_server.rb +2 -8
  77. data/lib/fog/compute/requests/brightbox/get_server_type.rb +2 -8
  78. data/lib/fog/compute/requests/brightbox/get_user.rb +2 -8
  79. data/lib/fog/compute/requests/brightbox/get_zone.rb +2 -8
  80. data/lib/fog/compute/requests/brightbox/list_api_clients.rb +2 -8
  81. data/lib/fog/compute/requests/brightbox/list_cloud_ips.rb +2 -8
  82. data/lib/fog/compute/requests/brightbox/list_images.rb +2 -8
  83. data/lib/fog/compute/requests/brightbox/list_load_balancers.rb +2 -8
  84. data/lib/fog/compute/requests/brightbox/list_server_types.rb +2 -8
  85. data/lib/fog/compute/requests/brightbox/list_servers.rb +2 -8
  86. data/lib/fog/compute/requests/brightbox/list_users.rb +2 -8
  87. data/lib/fog/compute/requests/brightbox/list_zones.rb +2 -8
  88. data/lib/fog/compute/requests/brightbox/map_cloud_ip.rb +2 -8
  89. data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +2 -8
  90. data/lib/fog/compute/requests/brightbox/remove_nodes_load_balancer.rb +2 -8
  91. data/lib/fog/compute/requests/brightbox/reset_ftp_password_account.rb +2 -8
  92. data/lib/fog/compute/requests/brightbox/shutdown_server.rb +2 -8
  93. data/lib/fog/compute/requests/brightbox/snapshot_server.rb +2 -8
  94. data/lib/fog/compute/requests/brightbox/start_server.rb +2 -8
  95. data/lib/fog/compute/requests/brightbox/stop_server.rb +2 -8
  96. data/lib/fog/compute/requests/brightbox/unmap_cloud_ip.rb +2 -8
  97. data/lib/fog/compute/requests/brightbox/update_account.rb +2 -8
  98. data/lib/fog/compute/requests/brightbox/update_api_client.rb +2 -8
  99. data/lib/fog/compute/requests/brightbox/update_image.rb +2 -8
  100. data/lib/fog/compute/requests/brightbox/update_load_balancer.rb +2 -8
  101. data/lib/fog/compute/requests/brightbox/update_server.rb +2 -8
  102. data/lib/fog/compute/requests/brightbox/update_user.rb +2 -8
  103. data/lib/fog/core.rb +1 -0
  104. data/lib/fog/core/credentials.rb +1 -1
  105. data/lib/fog/core/errors.rb +3 -1
  106. data/lib/fog/core/json.rb +20 -0
  107. data/lib/fog/core/provider.rb +3 -1
  108. data/lib/fog/core/service.rb +5 -0
  109. data/lib/fog/dns.rb +8 -1
  110. data/lib/fog/dns/dynect.rb +80 -0
  111. data/lib/fog/dns/models/dynect/record.rb +67 -0
  112. data/lib/fog/dns/models/dynect/records.rb +53 -0
  113. data/lib/fog/dns/models/dynect/zone.rb +60 -0
  114. data/lib/fog/dns/models/dynect/zones.rb +29 -0
  115. data/lib/fog/dns/requests/dynect/delete_record.rb +24 -0
  116. data/lib/fog/dns/requests/dynect/delete_zone.rb +21 -0
  117. data/lib/fog/dns/requests/dynect/get_node_list.rb +23 -0
  118. data/lib/fog/dns/requests/dynect/get_record.rb +25 -0
  119. data/lib/fog/dns/requests/dynect/get_zone.rb +22 -0
  120. data/lib/fog/dns/requests/dynect/post_record.rb +27 -0
  121. data/lib/fog/dns/requests/dynect/post_session.rb +36 -0
  122. data/lib/fog/dns/requests/dynect/post_zone.rb +32 -0
  123. data/lib/fog/dns/requests/dynect/put_zone.rb +26 -0
  124. data/lib/fog/dns/zerigo.rb +1 -1
  125. data/lib/fog/providers.rb +1 -0
  126. data/lib/fog/providers/dynect.rb +14 -0
  127. data/lib/fog/providers/rackspace.rb +1 -0
  128. data/lib/fog/rackspace/load_balancers.rb +179 -0
  129. data/lib/fog/rackspace/models/load_balancers/access_rule.rb +39 -0
  130. data/lib/fog/rackspace/models/load_balancers/access_rules.rb +29 -0
  131. data/lib/fog/rackspace/models/load_balancers/load_balancer.rb +216 -0
  132. data/lib/fog/rackspace/models/load_balancers/load_balancers.rb +27 -0
  133. data/lib/fog/rackspace/models/load_balancers/node.rb +58 -0
  134. data/lib/fog/rackspace/models/load_balancers/nodes.rb +29 -0
  135. data/lib/fog/rackspace/models/load_balancers/virtual_ip.rb +35 -0
  136. data/lib/fog/rackspace/models/load_balancers/virtual_ips.rb +32 -0
  137. data/lib/fog/rackspace/requests/load_balancers/create_access_rule.rb +24 -0
  138. data/lib/fog/rackspace/requests/load_balancers/create_load_balancer.rb +26 -0
  139. data/lib/fog/rackspace/requests/load_balancers/create_node.rb +27 -0
  140. data/lib/fog/rackspace/requests/load_balancers/create_virtual_ip.rb +20 -0
  141. data/lib/fog/rackspace/requests/load_balancers/delete_access_rule.rb +15 -0
  142. data/lib/fog/rackspace/requests/load_balancers/delete_all_access_rules.rb +15 -0
  143. data/lib/fog/rackspace/requests/load_balancers/delete_load_balancer.rb +15 -0
  144. data/lib/fog/rackspace/requests/load_balancers/delete_node.rb +15 -0
  145. data/lib/fog/rackspace/requests/load_balancers/delete_nodes.rb +17 -0
  146. data/lib/fog/rackspace/requests/load_balancers/delete_virtual_ip.rb +15 -0
  147. data/lib/fog/rackspace/requests/load_balancers/get_connection_logging.rb +15 -0
  148. data/lib/fog/rackspace/requests/load_balancers/get_connection_throttling.rb +15 -0
  149. data/lib/fog/rackspace/requests/load_balancers/get_load_balancer.rb +15 -0
  150. data/lib/fog/rackspace/requests/load_balancers/get_load_balancer_usage.rb +21 -0
  151. data/lib/fog/rackspace/requests/load_balancers/get_monitor.rb +15 -0
  152. data/lib/fog/rackspace/requests/load_balancers/get_node.rb +15 -0
  153. data/lib/fog/rackspace/requests/load_balancers/get_session_persistence.rb +15 -0
  154. data/lib/fog/rackspace/requests/load_balancers/get_usage.rb +20 -0
  155. data/lib/fog/rackspace/requests/load_balancers/list_access_rules.rb +15 -0
  156. data/lib/fog/rackspace/requests/load_balancers/list_algorithms.rb +15 -0
  157. data/lib/fog/rackspace/requests/load_balancers/list_load_balancers.rb +15 -0
  158. data/lib/fog/rackspace/requests/load_balancers/list_nodes.rb +15 -0
  159. data/lib/fog/rackspace/requests/load_balancers/list_protocols.rb +15 -0
  160. data/lib/fog/rackspace/requests/load_balancers/list_virtual_ips.rb +15 -0
  161. data/lib/fog/rackspace/requests/load_balancers/remove_connection_throttling.rb +15 -0
  162. data/lib/fog/rackspace/requests/load_balancers/remove_monitor.rb +15 -0
  163. data/lib/fog/rackspace/requests/load_balancers/remove_session_persistence.rb +15 -0
  164. data/lib/fog/rackspace/requests/load_balancers/set_connection_logging.rb +21 -0
  165. data/lib/fog/rackspace/requests/load_balancers/set_connection_throttling.rb +22 -0
  166. data/lib/fog/rackspace/requests/load_balancers/set_monitor.rb +31 -0
  167. data/lib/fog/rackspace/requests/load_balancers/set_session_persistence.rb +21 -0
  168. data/lib/fog/rackspace/requests/load_balancers/update_load_balancer.rb +24 -0
  169. data/lib/fog/rackspace/requests/load_balancers/update_node.rb +26 -0
  170. data/lib/fog/storage.rb +5 -1
  171. data/lib/fog/storage/aws.rb +3 -0
  172. data/lib/fog/storage/models/aws/directory.rb +1 -3
  173. data/lib/fog/storage/models/aws/file.rb +1 -1
  174. data/lib/fog/storage/models/google/file.rb +1 -1
  175. data/lib/fog/storage/models/local/file.rb +8 -6
  176. data/lib/fog/storage/models/ninefold/file.rb +0 -1
  177. data/lib/fog/storage/requests/aws/copy_object.rb +1 -1
  178. data/lib/fog/storage/requests/aws/get_bucket.rb +14 -11
  179. data/lib/fog/storage/requests/aws/post_object_hidden_fields.rb +2 -4
  180. data/tests/aws/models/rds/server_tests.rb +4 -4
  181. data/tests/compute/models/aws/server_tests.rb +15 -1
  182. data/tests/compute/requests/aws/helper.rb +0 -4
  183. data/tests/compute/requests/aws/image_tests.rb +40 -9
  184. data/tests/compute/requests/brightbox/account_tests.rb +1 -1
  185. data/tests/compute/requests/brightbox/helper.rb +3 -0
  186. data/tests/compute/requests/brightbox/load_balancer_tests.rb +1 -1
  187. data/tests/compute/requests/voxel/server_tests.rb +2 -2
  188. data/tests/dns/helper.rb +18 -0
  189. data/tests/dns/models/record_tests.rb +3 -2
  190. data/tests/dns/models/records_tests.rb +2 -2
  191. data/tests/dns/models/zone_tests.rb +2 -2
  192. data/tests/dns/models/zones_tests.rb +1 -1
  193. data/tests/dns/requests/bluebox/dns_tests.rb +0 -12
  194. data/tests/dns/requests/dnsimple/dns_tests.rb +0 -12
  195. data/tests/dns/requests/dnsmadeeasy/dns_tests.rb +0 -12
  196. data/tests/dns/requests/dynect/dns_tests.rb +132 -0
  197. data/tests/dns/requests/linode/dns_tests.rb +1 -13
  198. data/tests/dns/requests/slicehost/dns_tests.rb +1 -13
  199. data/tests/helper.rb +1 -1
  200. data/tests/helpers/collection_helper.rb +2 -2
  201. data/tests/helpers/formats_helper.rb +2 -0
  202. data/tests/helpers/mock_helper.rb +4 -1
  203. data/tests/rackspace/helper.rb +24 -0
  204. data/tests/rackspace/load_balancer_tests.rb +21 -0
  205. data/tests/rackspace/models/access_list_tests.rb +12 -0
  206. data/tests/rackspace/models/access_lists_tests.rb +12 -0
  207. data/tests/rackspace/models/load_balancer_tests.rb +116 -0
  208. data/tests/rackspace/models/load_balancers_tests.rb +19 -0
  209. data/tests/rackspace/models/node_tests.rb +19 -0
  210. data/tests/rackspace/models/nodes_tests.rb +12 -0
  211. data/tests/rackspace/models/virtual_ip_tests.rb +16 -0
  212. data/tests/rackspace/models/virtual_ips_tests.rb +12 -0
  213. data/tests/rackspace/requests/access_list_tests.rb +56 -0
  214. data/tests/rackspace/requests/algorithm_tests.rb +19 -0
  215. data/tests/rackspace/requests/connection_logging_tests.rb +25 -0
  216. data/tests/rackspace/requests/connection_throttling_tests.rb +37 -0
  217. data/tests/rackspace/requests/helper.rb +112 -0
  218. data/tests/rackspace/requests/load_balancer_tests.rb +63 -0
  219. data/tests/rackspace/requests/load_balancer_usage_tests.rb +19 -0
  220. data/tests/rackspace/requests/monitor_tests.rb +46 -0
  221. data/tests/rackspace/requests/node_tests.rb +87 -0
  222. data/tests/rackspace/requests/protocol_tests.rb +21 -0
  223. data/tests/rackspace/requests/session_persistence_tests.rb +33 -0
  224. data/tests/rackspace/requests/usage_tests.rb +17 -0
  225. data/tests/rackspace/requests/virtual_ip_tests.rb +40 -0
  226. data/tests/storage/requests/aws/bucket_tests.rb +53 -0
  227. metadata +127 -8
  228. data/lib/fog/compute/requests/aws/modify_image_attributes.rb +0 -37
@@ -3,19 +3,7 @@ Shindo.tests('Fog::DNS[:slicehost] | DNS requests', ['slicehost', 'dns']) do
3
3
  @domain = ''
4
4
  @new_zones = []
5
5
  @new_records =[]
6
-
7
- def generate_unique_domain( with_trailing_dot = false)
8
- #get time (with 1/100th of sec accuracy)
9
- #want unique domain name and if provider is fast, this can be called more than once per second
10
- time= (Time.now.to_f * 100).to_i
11
- domain = 'test-' + time.to_s + '.com'
12
- if with_trailing_dot
13
- domain+= '.'
14
- end
15
-
16
- domain
17
- end
18
-
6
+
19
7
  tests( 'success') do
20
8
 
21
9
  test('get current zone count') do
data/tests/helper.rb CHANGED
@@ -8,7 +8,7 @@ def lorem_file
8
8
  end
9
9
 
10
10
  # check to see which credentials are available and add others to the skipped tags list
11
- all_providers = ['aws', 'bluebox', 'brightbox', 'dnsimple', 'dnsmadeeasy', 'ecloud', 'gogrid', 'google', 'linode', 'local', 'ninefold', 'newservers', 'rackspace', 'slicehost', 'stormondemand', 'voxel', 'zerigo']
11
+ all_providers = ['aws', 'bluebox', 'brightbox', 'dnsimple', 'dnsmadeeasy', 'dynect', 'ecloud', 'gogrid', 'google', 'linode', 'local', 'ninefold', 'newservers', 'rackspace', 'slicehost', 'stormondemand', 'voxel', 'zerigo']
12
12
  available_providers = Fog.available_providers.map {|provider| provider.downcase}
13
13
  for provider in (all_providers - available_providers)
14
14
  Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")
@@ -39,8 +39,8 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
39
39
 
40
40
  if !Fog.mocking? || mocks_implemented
41
41
  @identity = @identity.to_s
42
- @identity.gsub!(/[a-zA-Z]/) { Fog::Mock.random_letters(1) }
43
- @identity.gsub!(/\d/) { Fog::Mock.random_numbers(1) }
42
+ @identity = @identity.gsub(/[a-zA-Z]/) { Fog::Mock.random_letters(1) }
43
+ @identity = @identity.gsub(/\d/) { Fog::Mock.random_numbers(1) }
44
44
  @identity
45
45
  end
46
46
 
@@ -8,6 +8,7 @@ module Fog
8
8
  module Integer; end
9
9
  module String; end
10
10
  module Time; end
11
+ module Float; end
11
12
  end
12
13
  end
13
14
  [FalseClass, TrueClass].each {|klass| klass.send(:include, Fog::Boolean)}
@@ -15,6 +16,7 @@ end
15
16
  [NilClass, String].each {|klass| klass.send(:include, Fog::Nullable::String)}
16
17
  [NilClass, Time].each {|klass| klass.send(:include, Fog::Nullable::Time)}
17
18
  [Integer, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Integer)}
19
+ [Float, NilClass].each {|klass| klass.send(:include, Fog::Nullable::Float)}
18
20
 
19
21
  module Shindo
20
22
  class Tests
@@ -47,6 +47,9 @@ if Fog.mock?
47
47
  :voxel_api_key => 'voxel_api_key',
48
48
  :voxel_api_secret => 'voxel_api_secret',
49
49
  :zerigo_email => 'zerigo_email',
50
- :zerigo_token => 'zerigo_token'
50
+ :zerigo_token => 'zerigo_token',
51
+ :dynect_customer => 'dynect_customer',
52
+ :dynect_username => 'dynect_username',
53
+ :dynect_password => 'dynect_password'
51
54
  })
52
55
  end
@@ -0,0 +1,24 @@
1
+ module Shindo
2
+ class Tests
3
+ def given_a_load_balancer_service(&block)
4
+ @service = Fog::Rackspace::LoadBalancers.new
5
+ instance_eval(&block)
6
+ end
7
+ def given_a_load_balancer(&block)
8
+ @lb = @service.load_balancers.create({
9
+ :name => ('fog' + Time.now.to_i.to_s),
10
+ :protocol => 'HTTP',
11
+ :port => 80,
12
+ :virtual_ips => [{ :type => 'PUBLIC'}],
13
+ :nodes => [{ :address => '10.0.0.1', :port => 80, :condition => 'ENABLED'}]
14
+ })
15
+ @lb.wait_for { ready? }
16
+ begin
17
+ instance_eval(&block)
18
+ ensure
19
+ @lb.wait_for { ready? }
20
+ @lb.destroy
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ @service = Fog::Rackspace::LoadBalancers.new
6
+
7
+ tests('#algorithms').succeeds do
8
+ data = @service.algorithms
9
+ returns(true) { data.is_a? Array }
10
+ returns(true) { data.first.is_a? String }
11
+ end
12
+
13
+ tests('#protocols').succeeds do
14
+ data = @service.protocols
15
+ returns(true) { data.is_a? Array }
16
+ end
17
+
18
+ tests('#usage').succeeds do
19
+ @service.usage
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | access_list', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ model_tests(@lb.access_rules, { :address => '10.0.0.2', :type => 'ALLOW'}, false) do
8
+ @lb.wait_for { ready? }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | access_lists', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ collection_tests(@lb.access_rules, { :address => '10.0.0.2', :type => 'ALLOW'}, false) do
8
+ @lb.wait_for { ready? }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,116 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancer', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ LOAD_BALANCER_ATTRIBUTES = {
6
+ :name => 'fog' + Time.now.to_i.to_s,
7
+ :protocol => 'HTTP',
8
+ :port => 80,
9
+ :virtual_ips => [{ :type => 'PUBLIC'}],
10
+ :nodes => [{ :address => '10.0.0.1', :port => 80, :condition => 'ENABLED'}]
11
+ }
12
+
13
+ given_a_load_balancer_service do
14
+ model_tests(@service.load_balancers, LOAD_BALANCER_ATTRIBUTES, false) do
15
+
16
+ @instance.wait_for { ready? }
17
+ tests('#save => saving existing with port = 88').succeeds do
18
+ @instance.port = 88
19
+ @instance.save
20
+ end
21
+
22
+ @instance.wait_for { ready? }
23
+ tests('#enable_connection_logging').succeeds do
24
+ @instance.enable_connection_logging
25
+ returns(true) { @instance.connection_logging }
26
+ end
27
+
28
+ @instance.wait_for { ready? }
29
+ tests('#disable_connection_logging').succeeds do
30
+ @instance.disable_connection_logging
31
+ returns(false) { @instance.connection_logging }
32
+ end
33
+
34
+ tests('#usage').succeeds do
35
+ @instance.usage
36
+ end
37
+
38
+ tests("#usage(:start_time => '2010-05-10', :end_time => '2010-05-11')").succeeds do
39
+ @instance.usage(:start_time => '2010-05-10', :end_time => '2010-05-11')
40
+ end
41
+
42
+ tests("#health_monitor").returns(nil) do
43
+ @instance.health_monitor
44
+ end
45
+
46
+ @instance.wait_for { ready? }
47
+ tests("#enable_health_monitor('CONNECT', 5, 5, 5)").succeeds do
48
+ @instance.enable_health_monitor('CONNECT', 5, 5, 5)
49
+ end
50
+
51
+ @instance.wait_for { ready? }
52
+ tests("#health_monitor").succeeds do
53
+ monitor = @instance.health_monitor
54
+ returns('CONNECT') { monitor['type'] }
55
+ end
56
+
57
+ @instance.wait_for { ready? }
58
+ tests("#disable_health_monitor").succeeds do
59
+ @instance.disable_health_monitor
60
+ end
61
+
62
+ @instance.wait_for { ready? }
63
+ tests("#connection_throttling").returns(nil) do
64
+ @instance.connection_throttling
65
+ end
66
+
67
+ tests("#enable_connection_throttling(5, 5, 5, 5)").succeeds do
68
+ @instance.enable_connection_throttling(5, 5, 5, 5)
69
+ end
70
+
71
+ @instance.wait_for { ready? }
72
+ tests("#connection_throttling").succeeds do
73
+ throttle = @instance.connection_throttling
74
+ returns(5) { throttle['maxConnections'] }
75
+ end
76
+
77
+ @instance.wait_for { ready? }
78
+ tests("#disable_connection_throttling").succeeds do
79
+ @instance.disable_connection_throttling
80
+ end
81
+
82
+ @instance.wait_for { ready? }
83
+ tests("#session_persistence").returns(nil) do
84
+ @instance.session_persistence
85
+ end
86
+
87
+ tests("#enable_session_persistence('HTTP_COOKIE')").succeeds do
88
+ @instance.enable_session_persistence('HTTP_COOKIE')
89
+ end
90
+
91
+ @instance.wait_for { ready? }
92
+ tests("#connction_throttling").succeeds do
93
+ persistence = @instance.session_persistence
94
+ returns('HTTP_COOKIE') { persistence['persistenceType'] }
95
+ end
96
+
97
+ @instance.wait_for { ready? }
98
+ tests("#disable_session_persistence").succeeds do
99
+ @instance.disable_session_persistence
100
+ end
101
+
102
+ @instance.wait_for { ready? }
103
+ end
104
+
105
+ tests('failure') do
106
+ @lb = @service.load_balancers.new LOAD_BALANCER_ATTRIBUTES
107
+ tests('#usage => Requires ID').raises(ArgumentError) do
108
+ @lb.usage
109
+ end
110
+
111
+ tests('#health_monitor => Requires ID').raises(ArgumentError) do
112
+ @lb.health_monitor
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,19 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | load_balancers', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ @lb_name = 'fog' + Time.now.to_i.to_s
7
+ collection_tests(@service.load_balancers,
8
+ {
9
+ :name => @lb_name,
10
+ :protocol => 'HTTP',
11
+ :port => 80,
12
+ :virtual_ips => [{ :type => 'PUBLIC'}],
13
+ :nodes => [{ :address => '10.0.0.1', :port => 80, :condition => 'ENABLED'}]
14
+ },
15
+ false) do
16
+ @instance.wait_for { ready? }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | node', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ model_tests(@lb.nodes, { :address => '10.0.0.2', :port => 80, :condition => 'ENABLED'}, false) do
8
+ @lb.wait_for { ready? }
9
+
10
+ tests("#save() => existing node with port = 88").succeeds do
11
+ @instance.port = 88
12
+ @instance.save
13
+ end
14
+
15
+ @lb.wait_for { ready? }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | nodes', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ collection_tests(@lb.nodes, { :address => '10.0.0.2', :port => 80, :condition => 'ENABLED'}, false) do
8
+ @lb.wait_for { ready? }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | virtual_ip', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ model_tests(@lb.virtual_ips, { :type => 'PUBLIC'}, false) do
8
+ @lb.wait_for { ready? }
9
+
10
+ tests("#save => existing virtual IP").raises(Fog::Errors::Error) do
11
+ @instance.save
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | virtual_ips', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ collection_tests(@lb.virtual_ips, { :type => 'PUBLIC'}, false) do
8
+ @lb.wait_for { ready? }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,56 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | access_lists_tests', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ tests('success') do
8
+
9
+ @lb.wait_for { ready? }
10
+ tests("#create_access_rule(#{@lb.id}, '67.0.0.1','ALLOW')").succeeds do
11
+ @service.create_access_rule(@lb.id, '67.0.0.1', 'ALLOW').body
12
+ end
13
+
14
+ @lb.wait_for { ready? }
15
+ tests("list_access_rules").formats(ACCESS_LIST_FORMAT) do
16
+ data = @service.list_access_rules(@lb.id).body
17
+ returns(1) { data.size }
18
+ @access_list_id = data['accessList'].first['id']
19
+ data
20
+ end
21
+
22
+ @lb.wait_for {ready? }
23
+ tests("delete_access_rule(#{@lb.id}, #{@access_list_id}").succeeds do
24
+ @service.delete_access_rule(@lb.id, @access_list_id)
25
+ end
26
+
27
+ @lb.wait_for {ready? }
28
+ tests("delete_all_access_rules(#{@lb.id})").succeeds do
29
+ #This could be refactored once we can add multiple access rules at once
30
+ @service.create_access_rule(@lb.id, '67.0.0.2', 'ALLOW')
31
+ @lb.wait_for {ready? }
32
+ @service.create_access_rule(@lb.id, '67.0.0.3', 'ALLOW')
33
+ @lb.wait_for {ready? }
34
+ returns(2) { @service.list_access_rules(@lb.id).body['accessList'].size }
35
+
36
+ @service.delete_all_access_rules(@lb.id)
37
+
38
+ @lb.wait_for {ready? }
39
+ returns(0) { @service.list_access_rules(@lb.id).body['accessList'].size }
40
+ end
41
+ end
42
+
43
+ tests('failure') do
44
+ tests('create_access_rule(invalid ip)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
45
+ @service.create_access_rule(@lb.id, '', 'ALLOW')
46
+ end
47
+ tests('create_access_rule(invalid type)').raises(Fog::Rackspace::LoadBalancers::BadRequest) do
48
+ @service.create_access_rule(@lb.id, '10.10.10.10', 'ENABLED')
49
+ end
50
+ tests("delete_access_rule(#{@lb.id}, 0)").raises(Fog::Rackspace::LoadBalancers::NotFound) do
51
+ @service.delete_access_rule(@lb.id, 0)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,19 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | algorithm_tests', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ ALGORITHMS_FORMAT = {
6
+ 'algorithms' => [
7
+ {
8
+ 'name' => String
9
+ }
10
+ ]}
11
+
12
+ @service = Fog::Rackspace::LoadBalancers.new
13
+
14
+ tests('success') do
15
+ tests('#list_algorithms').formats(ALGORITHMS_FORMAT) do
16
+ @service.list_algorithms.body
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ Shindo.tests('Fog::Rackspace::LoadBalancers | connection_logging', ['rackspace']) do
2
+
3
+ pending if Fog.mocking?
4
+
5
+ given_a_load_balancer_service do
6
+ given_a_load_balancer do
7
+ tests('success') do
8
+ tests("#get_connection_logging(#{@lb.id})").formats(CONNECTION_LOGGING_FORMAT) do
9
+ @service.get_connection_logging(@lb.id).body
10
+ end
11
+
12
+ @lb.wait_for { ready? }
13
+ tests("#set_connection_logging(#{@lb.id}, true)").succeeds do
14
+ @service.set_connection_logging(@lb.id, true)
15
+ end
16
+ end
17
+
18
+ tests('failure') do
19
+ tests("#set_connection_logging(#{@lb.id}, 'aaa')").raises(Fog::Rackspace::LoadBalancers::InternalServerError) do
20
+ @service.set_connection_logging(@lb.id, 'aaa')
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end