fog-aws 3.9.0 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +251 -17
  3. data/README.md +1 -1
  4. data/fog-aws.gemspec +6 -6
  5. data/lib/fog/aws/compute.rb +6 -3
  6. data/lib/fog/aws/credential_fetcher.rb +14 -7
  7. data/lib/fog/aws/models/compute/security_group.rb +13 -5
  8. data/lib/fog/aws/models/compute/server.rb +2 -0
  9. data/lib/fog/aws/models/storage/file.rb +21 -17
  10. data/lib/fog/aws/parsers/compute/describe_security_groups.rb +18 -4
  11. data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +15 -0
  12. data/lib/fog/aws/requests/compute/create_network_interface.rb +7 -4
  13. data/lib/fog/aws/requests/compute/create_subnet.rb +3 -3
  14. data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
  15. data/lib/fog/aws/requests/compute/run_instances.rb +44 -0
  16. data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +18 -8
  17. data/lib/fog/aws/requests/storage/get_object.rb +1 -1
  18. data/lib/fog/aws/storage.rb +42 -3
  19. data/lib/fog/aws/version.rb +1 -1
  20. metadata +11 -297
  21. data/.gitignore +0 -17
  22. data/.travis.yml +0 -124
  23. data/Gemfile +0 -14
  24. data/Rakefile +0 -14
  25. data/bin/console +0 -14
  26. data/bin/setup +0 -8
  27. data/gemfiles/Gemfile-edge +0 -14
  28. data/gemfiles/Gemfile-ruby-2.0 +0 -7
  29. data/stale.yml +0 -17
  30. data/tests/credentials_tests.rb +0 -149
  31. data/tests/helper.rb +0 -29
  32. data/tests/helpers/collection_helper.rb +0 -90
  33. data/tests/helpers/compute/flavors_helper.rb +0 -28
  34. data/tests/helpers/compute/server_helper.rb +0 -23
  35. data/tests/helpers/compute/servers_helper.rb +0 -8
  36. data/tests/helpers/dns_helper.rb +0 -56
  37. data/tests/helpers/formats_helper.rb +0 -100
  38. data/tests/helpers/formats_helper_tests.rb +0 -107
  39. data/tests/helpers/mock_helper.rb +0 -109
  40. data/tests/helpers/model_helper.rb +0 -30
  41. data/tests/helpers/responds_to_helper.rb +0 -11
  42. data/tests/helpers/schema_validator_tests.rb +0 -104
  43. data/tests/helpers/succeeds_helper.rb +0 -9
  44. data/tests/lorem.txt +0 -1
  45. data/tests/models/auto_scaling/activities_tests.rb +0 -6
  46. data/tests/models/auto_scaling/configuration_test.rb +0 -13
  47. data/tests/models/auto_scaling/configurations_tests.rb +0 -11
  48. data/tests/models/auto_scaling/groups_test.rb +0 -27
  49. data/tests/models/auto_scaling/helper.rb +0 -0
  50. data/tests/models/auto_scaling/instance_tests.rb +0 -15
  51. data/tests/models/auto_scaling/instances_tests.rb +0 -6
  52. data/tests/models/beanstalk/application_tests.rb +0 -69
  53. data/tests/models/beanstalk/applications_tests.rb +0 -7
  54. data/tests/models/beanstalk/environment_tests.rb +0 -131
  55. data/tests/models/beanstalk/environments_tests.rb +0 -34
  56. data/tests/models/beanstalk/template_tests.rb +0 -47
  57. data/tests/models/beanstalk/templates_tests.rb +0 -62
  58. data/tests/models/beanstalk/version_tests.rb +0 -66
  59. data/tests/models/beanstalk/versions_tests.rb +0 -60
  60. data/tests/models/cdn/distribution_tests.rb +0 -15
  61. data/tests/models/cdn/distributions_tests.rb +0 -15
  62. data/tests/models/cdn/invalidation_tests.rb +0 -31
  63. data/tests/models/cdn/invalidations_tests.rb +0 -14
  64. data/tests/models/cdn/streaming_distribution_tests.rb +0 -15
  65. data/tests/models/cdn/streaming_distributions_tests.rb +0 -15
  66. data/tests/models/cloud_watch/alarm_data_tests.rb +0 -42
  67. data/tests/models/cloud_watch/alarm_history_tests.rb +0 -22
  68. data/tests/models/cloud_watch/metric_statistics_tests.rb +0 -51
  69. data/tests/models/cloud_watch/metrics_tests.rb +0 -32
  70. data/tests/models/compute/address_tests.rb +0 -43
  71. data/tests/models/compute/addresses_tests.rb +0 -5
  72. data/tests/models/compute/dhcp_option_tests.rb +0 -3
  73. data/tests/models/compute/dhcp_options_tests.rb +0 -3
  74. data/tests/models/compute/internet_gateway_tests.rb +0 -3
  75. data/tests/models/compute/internet_gateways_tests.rb +0 -3
  76. data/tests/models/compute/key_pair_tests.rb +0 -26
  77. data/tests/models/compute/key_pairs_tests.rb +0 -5
  78. data/tests/models/compute/network_acl_tests.rb +0 -109
  79. data/tests/models/compute/network_acls_tests.rb +0 -20
  80. data/tests/models/compute/network_interfaces_test.rb +0 -12
  81. data/tests/models/compute/security_group_tests.rb +0 -98
  82. data/tests/models/compute/security_groups_tests.rb +0 -5
  83. data/tests/models/compute/server_tests.rb +0 -94
  84. data/tests/models/compute/snapshot_tests.rb +0 -10
  85. data/tests/models/compute/snapshots_tests.rb +0 -10
  86. data/tests/models/compute/subnet_tests.rb +0 -13
  87. data/tests/models/compute/subnets_tests.rb +0 -5
  88. data/tests/models/compute/volume_tests.rb +0 -65
  89. data/tests/models/compute/volumes_tests.rb +0 -5
  90. data/tests/models/compute/vpc_tests.rb +0 -26
  91. data/tests/models/compute/vpcs_tests.rb +0 -19
  92. data/tests/models/data_pipeline/pipeline_tests.rb +0 -8
  93. data/tests/models/data_pipeline/pipelines_tests.rb +0 -8
  94. data/tests/models/dns/record_tests.rb +0 -33
  95. data/tests/models/dns/records_tests.rb +0 -41
  96. data/tests/models/dns/zone_tests.rb +0 -4
  97. data/tests/models/dns/zones_tests.rb +0 -4
  98. data/tests/models/efs/file_system_tests.rb +0 -12
  99. data/tests/models/efs/mount_target_tests.rb +0 -45
  100. data/tests/models/efs/mount_targets_tests.rb +0 -30
  101. data/tests/models/elasticache/cluster_tests.rb +0 -30
  102. data/tests/models/elasticache/parameter_groups_tests.rb +0 -15
  103. data/tests/models/elasticache/security_groups_tests.rb +0 -52
  104. data/tests/models/elasticache/subnet_groups_tests.rb +0 -43
  105. data/tests/models/elb/model_tests.rb +0 -360
  106. data/tests/models/elb/tagging_tests.rb +0 -15
  107. data/tests/models/glacier/model_tests.rb +0 -47
  108. data/tests/models/iam/access_keys_tests.rb +0 -53
  109. data/tests/models/iam/groups_tests.rb +0 -59
  110. data/tests/models/iam/instance_profile_tests.rb +0 -18
  111. data/tests/models/iam/managed_policies_tests.rb +0 -89
  112. data/tests/models/iam/policies_tests.rb +0 -57
  113. data/tests/models/iam/roles_tests.rb +0 -71
  114. data/tests/models/iam/users_tests.rb +0 -119
  115. data/tests/models/rds/cluster_tests.rb +0 -54
  116. data/tests/models/rds/clusters_tests.rb +0 -5
  117. data/tests/models/rds/event_subscription_tests.rb +0 -9
  118. data/tests/models/rds/event_subscriptions_tests.rb +0 -6
  119. data/tests/models/rds/helper.rb +0 -25
  120. data/tests/models/rds/instance_option_tests.rb +0 -14
  121. data/tests/models/rds/parameter_group_tests.rb +0 -24
  122. data/tests/models/rds/parameter_groups_tests.rb +0 -8
  123. data/tests/models/rds/security_group_tests.rb +0 -77
  124. data/tests/models/rds/security_groups_tests.rb +0 -5
  125. data/tests/models/rds/server_tests.rb +0 -131
  126. data/tests/models/rds/servers_tests.rb +0 -24
  127. data/tests/models/rds/snapshot_tests.rb +0 -12
  128. data/tests/models/rds/snapshots_tests.rb +0 -12
  129. data/tests/models/rds/tagging_tests.rb +0 -20
  130. data/tests/models/sns/topic_tests.rb +0 -15
  131. data/tests/models/sns/topics_tests.rb +0 -6
  132. data/tests/models/storage/directory_tests.rb +0 -91
  133. data/tests/models/storage/file_tests.rb +0 -129
  134. data/tests/models/storage/files_tests.rb +0 -90
  135. data/tests/models/storage/url_tests.rb +0 -25
  136. data/tests/models/storage/version_tests.rb +0 -52
  137. data/tests/models/storage/versions_tests.rb +0 -51
  138. data/tests/models/support/trusted_advisor_tests.rb +0 -25
  139. data/tests/parsers/compute/describe_images_tests.rb +0 -33
  140. data/tests/parsers/elb/describe_load_balancers.rb +0 -65
  141. data/tests/parsers/elbv2/create_load_balancer_tests.rb +0 -48
  142. data/tests/parsers/elbv2/describe_listeners_tests.rb +0 -76
  143. data/tests/parsers/elbv2/describe_load_balancers_tests.rb +0 -54
  144. data/tests/parsers/elbv2/describe_tags_tests.rb +0 -35
  145. data/tests/requests/auto_scaling/auto_scaling_tests.rb +0 -111
  146. data/tests/requests/auto_scaling/describe_types_tests.rb +0 -102
  147. data/tests/requests/auto_scaling/helper.rb +0 -229
  148. data/tests/requests/auto_scaling/model_tests.rb +0 -235
  149. data/tests/requests/auto_scaling/notification_configuration_tests.rb +0 -124
  150. data/tests/requests/auto_scaling/tag_tests.rb +0 -63
  151. data/tests/requests/beanstalk/application_tests.rb +0 -140
  152. data/tests/requests/beanstalk/solution_stack_tests.rb +0 -22
  153. data/tests/requests/cdn/cdn_tests.rb +0 -252
  154. data/tests/requests/cloud_formation/stack_tests.rb +0 -167
  155. data/tests/requests/cloud_watch/get_metric_statistics_tests.rb +0 -28
  156. data/tests/requests/cloud_watch/list_metrics_test.rb +0 -64
  157. data/tests/requests/cloud_watch/put_metric_data_tests.rb +0 -36
  158. data/tests/requests/compute/address_tests.rb +0 -144
  159. data/tests/requests/compute/assign_private_ip_tests.rb +0 -55
  160. data/tests/requests/compute/availability_zone_tests.rb +0 -25
  161. data/tests/requests/compute/client_tests.rb +0 -25
  162. data/tests/requests/compute/dhcp_options_tests.rb +0 -39
  163. data/tests/requests/compute/helper.rb +0 -27
  164. data/tests/requests/compute/image_tests.rb +0 -169
  165. data/tests/requests/compute/instance_attrib_tests.rb +0 -168
  166. data/tests/requests/compute/instance_tests.rb +0 -338
  167. data/tests/requests/compute/internet_gateway_tests.rb +0 -49
  168. data/tests/requests/compute/key_pair_tests.rb +0 -67
  169. data/tests/requests/compute/network_acl_tests.rb +0 -112
  170. data/tests/requests/compute/network_interface_tests.rb +0 -239
  171. data/tests/requests/compute/placement_group_tests.rb +0 -48
  172. data/tests/requests/compute/region_tests.rb +0 -52
  173. data/tests/requests/compute/route_tests.rb +0 -341
  174. data/tests/requests/compute/security_group_tests.rb +0 -446
  175. data/tests/requests/compute/snapshot_tests.rb +0 -77
  176. data/tests/requests/compute/spot_datafeed_subscription_tests.rb +0 -47
  177. data/tests/requests/compute/spot_instance_tests.rb +0 -55
  178. data/tests/requests/compute/spot_price_history_tests.rb +0 -23
  179. data/tests/requests/compute/subnet_tests.rb +0 -87
  180. data/tests/requests/compute/tag_tests.rb +0 -101
  181. data/tests/requests/compute/volume_tests.rb +0 -263
  182. data/tests/requests/compute/vpc_tests.rb +0 -222
  183. data/tests/requests/data_pipeline/helper.rb +0 -78
  184. data/tests/requests/data_pipeline/pipeline_tests.rb +0 -80
  185. data/tests/requests/dns/change_resource_record_sets_tests.rb +0 -34
  186. data/tests/requests/dns/dns_tests.rb +0 -240
  187. data/tests/requests/dns/health_check_tests.rb +0 -159
  188. data/tests/requests/dns/helper.rb +0 -21
  189. data/tests/requests/dynamodb/item_tests.rb +0 -137
  190. data/tests/requests/dynamodb/table_tests.rb +0 -99
  191. data/tests/requests/ecs/cluster_tests.rb +0 -112
  192. data/tests/requests/ecs/container_instance_tests.rb +0 -119
  193. data/tests/requests/ecs/helper.rb +0 -276
  194. data/tests/requests/ecs/sample_task_definition1.json +0 -56
  195. data/tests/requests/ecs/service_tests.rb +0 -132
  196. data/tests/requests/ecs/task_definitions_tests.rb +0 -97
  197. data/tests/requests/ecs/task_tests.rb +0 -145
  198. data/tests/requests/efs/file_system_tests.rb +0 -152
  199. data/tests/requests/efs/helper.rb +0 -44
  200. data/tests/requests/elasticache/cache_cluster_tests.rb +0 -137
  201. data/tests/requests/elasticache/describe_events.rb +0 -17
  202. data/tests/requests/elasticache/describe_reserved_cache_nodes.rb +0 -17
  203. data/tests/requests/elasticache/helper.rb +0 -103
  204. data/tests/requests/elasticache/parameter_group_tests.rb +0 -105
  205. data/tests/requests/elasticache/security_group_tests.rb +0 -108
  206. data/tests/requests/elasticache/subnet_group_tests.rb +0 -52
  207. data/tests/requests/elb/helper.rb +0 -91
  208. data/tests/requests/elb/listener_tests.rb +0 -68
  209. data/tests/requests/elb/load_balancer_tests.rb +0 -89
  210. data/tests/requests/elb/policy_tests.rb +0 -132
  211. data/tests/requests/elbv2/helper.rb +0 -66
  212. data/tests/requests/elbv2/load_balancer_tests.rb +0 -50
  213. data/tests/requests/emr/helper.rb +0 -167
  214. data/tests/requests/emr/instance_group_tests.rb +0 -106
  215. data/tests/requests/emr/job_flow_tests.rb +0 -88
  216. data/tests/requests/federation/get_signin_token_tests.rb +0 -11
  217. data/tests/requests/glacier/archive_tests.rb +0 -13
  218. data/tests/requests/glacier/multipart_upload_tests.rb +0 -29
  219. data/tests/requests/glacier/tree_hash_tests.rb +0 -91
  220. data/tests/requests/glacier/vault_tests.rb +0 -35
  221. data/tests/requests/iam/access_key_tests.rb +0 -53
  222. data/tests/requests/iam/account_policy_tests.rb +0 -20
  223. data/tests/requests/iam/account_tests.rb +0 -34
  224. data/tests/requests/iam/group_policy_tests.rb +0 -48
  225. data/tests/requests/iam/group_tests.rb +0 -44
  226. data/tests/requests/iam/helper.rb +0 -154
  227. data/tests/requests/iam/instance_profile_tests.rb +0 -44
  228. data/tests/requests/iam/login_profile_tests.rb +0 -62
  229. data/tests/requests/iam/managed_policy_tests.rb +0 -110
  230. data/tests/requests/iam/mfa_tests.rb +0 -23
  231. data/tests/requests/iam/role_tests.rb +0 -156
  232. data/tests/requests/iam/server_certificate_tests.rb +0 -130
  233. data/tests/requests/iam/user_policy_tests.rb +0 -45
  234. data/tests/requests/iam/user_tests.rb +0 -78
  235. data/tests/requests/iam/versioned_managed_policy_tests.rb +0 -105
  236. data/tests/requests/kinesis/helper.rb +0 -111
  237. data/tests/requests/kinesis/stream_tests.rb +0 -169
  238. data/tests/requests/kms/helper.rb +0 -27
  239. data/tests/requests/kms/key_tests.rb +0 -23
  240. data/tests/requests/lambda/function_sample_1.js +0 -9
  241. data/tests/requests/lambda/function_sample_2.js +0 -9
  242. data/tests/requests/lambda/function_tests.rb +0 -460
  243. data/tests/requests/lambda/helper.rb +0 -81
  244. data/tests/requests/rds/cluster_snapshot_tests.rb +0 -43
  245. data/tests/requests/rds/cluster_tests.rb +0 -37
  246. data/tests/requests/rds/db_engine_versions.rb +0 -7
  247. data/tests/requests/rds/db_snapshot_tests.rb +0 -62
  248. data/tests/requests/rds/describe_events.rb +0 -16
  249. data/tests/requests/rds/event_subscription_tests.rb +0 -30
  250. data/tests/requests/rds/helper.rb +0 -406
  251. data/tests/requests/rds/instance_option_tests.rb +0 -27
  252. data/tests/requests/rds/instance_tests.rb +0 -149
  253. data/tests/requests/rds/log_file_tests.rb +0 -19
  254. data/tests/requests/rds/parameter_group_tests.rb +0 -62
  255. data/tests/requests/rds/parameter_request_tests.rb +0 -32
  256. data/tests/requests/rds/security_group_tests.rb +0 -101
  257. data/tests/requests/rds/subnet_groups_tests.rb +0 -52
  258. data/tests/requests/rds/tagging_tests.rb +0 -78
  259. data/tests/requests/redshift/cluster_parameter_group_tests.rb +0 -76
  260. data/tests/requests/redshift/cluster_security_group_tests.rb +0 -42
  261. data/tests/requests/redshift/cluster_snapshot_tests.rb +0 -73
  262. data/tests/requests/redshift/cluster_tests.rb +0 -80
  263. data/tests/requests/ses/helper.rb +0 -9
  264. data/tests/requests/ses/verified_domain_identity_tests.rb +0 -16
  265. data/tests/requests/ses/verified_email_address_tests.rb +0 -27
  266. data/tests/requests/simpledb/attributes_tests.rb +0 -86
  267. data/tests/requests/simpledb/domain_tests.rb +0 -51
  268. data/tests/requests/simpledb/helper.rb +0 -10
  269. data/tests/requests/sns/helper.rb +0 -9
  270. data/tests/requests/sns/subscription_tests.rb +0 -86
  271. data/tests/requests/sns/topic_tests.rb +0 -53
  272. data/tests/requests/sqs/helper.rb +0 -9
  273. data/tests/requests/sqs/message_tests.rb +0 -51
  274. data/tests/requests/sqs/queue_tests.rb +0 -50
  275. data/tests/requests/storage/acl_utils_tests.rb +0 -209
  276. data/tests/requests/storage/bucket_tests.rb +0 -416
  277. data/tests/requests/storage/cors_utils_tests.rb +0 -108
  278. data/tests/requests/storage/delete_multiple_objects_tests.rb +0 -12
  279. data/tests/requests/storage/multipart_copy_tests.rb +0 -93
  280. data/tests/requests/storage/multipart_upload_tests.rb +0 -121
  281. data/tests/requests/storage/object_tests.rb +0 -269
  282. data/tests/requests/storage/versioning_tests.rb +0 -262
  283. data/tests/requests/sts/assume_role_tests.rb +0 -19
  284. data/tests/requests/sts/assume_role_with_saml_tests.rb +0 -18
  285. data/tests/requests/sts/assume_role_with_web_identity_tests.rb +0 -28
  286. data/tests/requests/sts/get_federation_token_tests.rb +0 -20
  287. data/tests/requests/sts/session_token_tests.rb +0 -16
  288. data/tests/requests/support/helper.rb +0 -43
  289. data/tests/requests/support/trusted_advisor_check_tests.rb +0 -16
  290. data/tests/signaturev4_tests.rb +0 -106
  291. data/tests/signed_params_tests.rb +0 -17
  292. data/tests/storage_tests.rb +0 -7
@@ -1,105 +0,0 @@
1
- Shindo.tests('AWS::Elasticache | parameter group requests', ['aws', 'elasticache']) do
2
-
3
- tests('success') do
4
- pending if Fog.mocking?
5
-
6
- name = 'fog-test'
7
- description = 'Fog Test Parameter Group'
8
-
9
- tests(
10
- '#describe_engine_default_parameters'
11
- ).formats(AWS::Elasticache::Formats::ENGINE_DEFAULTS) do
12
- response = Fog::AWS[:elasticache].describe_engine_default_parameters
13
- engine_defaults = response.body['EngineDefaults']
14
- returns('memcached1.4') { engine_defaults['CacheParameterGroupFamily'] }
15
- engine_defaults
16
- end
17
-
18
- tests(
19
- '#create_cache_parameter_group'
20
- ).formats(AWS::Elasticache::Formats::SINGLE_PARAMETER_GROUP) do
21
- body = Fog::AWS[:elasticache].create_cache_parameter_group(name, description).body
22
- group = body['CacheParameterGroup']
23
- returns(name) { group['CacheParameterGroupName'] }
24
- returns(description) { group['Description'] }
25
- returns('memcached1.4') { group['CacheParameterGroupFamily'] }
26
- body
27
- end
28
-
29
- tests(
30
- '#describe_cache_parameters'
31
- ).formats(AWS::Elasticache::Formats::PARAMETER_SET) do
32
- response = Fog::AWS[:elasticache].describe_cache_parameters(name)
33
- parameter_set = response.body['DescribeCacheParametersResult']
34
- parameter_set
35
- end
36
-
37
- tests(
38
- '#describe_cache_parameter_groups without options'
39
- ).formats(AWS::Elasticache::Formats::DESCRIBE_PARAMETER_GROUPS) do
40
- body = Fog::AWS[:elasticache].describe_cache_parameter_groups.body
41
- returns(true, "has #{name}") do
42
- body['CacheParameterGroups'].any? do |group|
43
- group['CacheParameterGroupName'] == name
44
- end
45
- end
46
- body
47
- end
48
-
49
- tests(
50
- '#reset_cache_parameter_group completely'
51
- ).formats('CacheParameterGroupName' => String) do
52
- result = Fog::AWS[:elasticache].reset_cache_parameter_group(
53
- name
54
- ).body['ResetCacheParameterGroupResult']
55
- returns(name) {result['CacheParameterGroupName']}
56
- result
57
- end
58
-
59
- tests(
60
- '#modify_cache_parameter_group'
61
- ).formats('CacheParameterGroupName' => String) do
62
- result = Fog::AWS[:elasticache].modify_cache_parameter_group(
63
- name, {"chunk_size" => 32}
64
- ).body['ModifyCacheParameterGroupResult']
65
- returns(name) {result['CacheParameterGroupName']}
66
- result
67
- end
68
-
69
- # BUG: returns "MalformedInput - Unexpected complex element termination"
70
- tests(
71
- '#reset_cache_parameter_group with one parameter'
72
- ).formats('CacheParameterGroupName' => String) do
73
- pending
74
- result = Fog::AWS[:elasticache].reset_cache_parameter_group(
75
- name, ["chunk_size"]
76
- ).body['ResetCacheParameterGroupResult']
77
- returns(name) {result['CacheParameterGroupName']}
78
- result
79
- end
80
-
81
- tests(
82
- '#describe_cache_parameter_groups with name'
83
- ).formats(AWS::Elasticache::Formats::DESCRIBE_PARAMETER_GROUPS) do
84
- body = Fog::AWS[:elasticache].describe_cache_parameter_groups(name).body
85
- returns(1, "size of 1") { body['CacheParameterGroups'].size }
86
- returns(name, "has #{name}") do
87
- body['CacheParameterGroups'].first['CacheParameterGroupName']
88
- end
89
- body
90
- end
91
-
92
- tests(
93
- '#delete_cache_parameter_group'
94
- ).formats(AWS::Elasticache::Formats::BASIC) do
95
- body = Fog::AWS[:elasticache].delete_cache_parameter_group(name).body
96
- end
97
- end
98
-
99
- tests('failure') do
100
- # TODO:
101
- # Create a duplicate parameter group
102
- # List a missing parameter group
103
- # Delete a missing parameter group
104
- end
105
- end
@@ -1,108 +0,0 @@
1
- Shindo.tests('AWS::Elasticache | security group requests', ['aws', 'elasticache']) do
2
-
3
- tests('success') do
4
-
5
- name = 'fog-test'
6
- description = 'Fog Test Security Group'
7
-
8
- tests(
9
- '#create_cache_security_group'
10
- ).formats(AWS::Elasticache::Formats::SINGLE_SECURITY_GROUP) do
11
- body = Fog::AWS[:elasticache].create_cache_security_group(name, description).body
12
- group = body['CacheSecurityGroup']
13
- returns(name) { group['CacheSecurityGroupName'] }
14
- returns(description) { group['Description'] }
15
- returns([], "no authorized security group") { group['EC2SecurityGroups'] }
16
- body
17
- end
18
-
19
- tests(
20
- '#describe_cache_security_groups without options'
21
- ).formats(AWS::Elasticache::Formats::DESCRIBE_SECURITY_GROUPS) do
22
- body = Fog::AWS[:elasticache].describe_cache_security_groups.body
23
- returns(true, "has #{name}") do
24
- body['CacheSecurityGroups'].any? do |group|
25
- group['CacheSecurityGroupName'] == name
26
- end
27
- end
28
- body
29
- end
30
-
31
- tests(
32
- '#describe_cache_security_groups with name'
33
- ).formats(AWS::Elasticache::Formats::DESCRIBE_SECURITY_GROUPS) do
34
- body = Fog::AWS[:elasticache].describe_cache_security_groups(name).body
35
- returns(1, "size of 1") { body['CacheSecurityGroups'].size }
36
- returns(name, "has #{name}") do
37
- body['CacheSecurityGroups'].first['CacheSecurityGroupName']
38
- end
39
- body
40
- end
41
-
42
- tests('authorization') do
43
- ec2_group = Fog::Compute.new(:provider => 'AWS').security_groups.create(
44
- :name => 'fog-test-elasticache', :description => 'Fog Test Elasticache'
45
- )
46
- # Reload to get the owner_id
47
- ec2_group.reload
48
-
49
- tests(
50
- '#authorize_cache_security_group_ingress'
51
- ).formats(AWS::Elasticache::Formats::SINGLE_SECURITY_GROUP) do
52
- body = Fog::AWS[:elasticache].authorize_cache_security_group_ingress(
53
- name, ec2_group.name, ec2_group.owner_id
54
- ).body
55
- group = body['CacheSecurityGroup']
56
- expected_ec2_groups = [{
57
- 'Status' => 'authorizing', 'EC2SecurityGroupName' => ec2_group.name,
58
- 'EC2SecurityGroupOwnerId' => ec2_group.owner_id
59
- }]
60
- returns(expected_ec2_groups, 'has correct EC2 groups') do
61
- group['EC2SecurityGroups']
62
- end
63
- body
64
- end
65
-
66
- # Wait for the state to be active
67
- Fog.wait_for do
68
- response = Fog::AWS[:elasticache].describe_cache_security_groups(name)
69
- group = response.body['CacheSecurityGroups'].first
70
- group['EC2SecurityGroups'].all? {|ec2| ec2['Status'] == 'authorized'}
71
- end
72
-
73
- tests(
74
- '#revoke_cache_security_group_ingress'
75
- ).formats(AWS::Elasticache::Formats::SINGLE_SECURITY_GROUP) do
76
- pending if Fog.mocking?
77
-
78
- body = Fog::AWS[:elasticache].revoke_cache_security_group_ingress(
79
- name, ec2_group.name, ec2_group.owner_id
80
- ).body
81
- group = body['CacheSecurityGroup']
82
- expected_ec2_groups = [{
83
- 'Status' => 'revoking', 'EC2SecurityGroupName' => ec2_group.name,
84
- 'EC2SecurityGroupOwnerId' => ec2_group.owner_id
85
- }]
86
- returns(expected_ec2_groups, 'has correct EC2 groups') do
87
- group['EC2SecurityGroups']
88
- end
89
- body
90
- end
91
-
92
- ec2_group.destroy
93
- end
94
-
95
- tests(
96
- '#delete_cache_security_group'
97
- ).formats(AWS::Elasticache::Formats::BASIC) do
98
- body = Fog::AWS[:elasticache].delete_cache_security_group(name).body
99
- end
100
- end
101
-
102
- tests('failure') do
103
- # TODO:
104
- # Create a duplicate security group
105
- # List a missing security group
106
- # Delete a missing security group
107
- end
108
- end
@@ -1,52 +0,0 @@
1
- Shindo.tests('AWS::Elasticache | subnet group requests', ['aws', 'elasticache']) do
2
- # random_differentiator
3
- # Useful when rapidly re-running tests, so we don't have to wait
4
- # serveral minutes for deleted VPCs/subnets to disappear
5
- suffix = rand(65536).to_s(16)
6
- @subnet_group_name = "fog-test-#{suffix}"
7
-
8
- vpc_range = rand(245) + 10
9
- @vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => "10.#{vpc_range}.0.0/16")
10
-
11
- # Create 4 subnets in this VPC, each one in a different AZ
12
- subnet_az = 'us-east-1a'
13
- subnet_range = 8
14
- @subnets = (1..4).map do
15
- subnet = Fog::Compute[:aws].create_subnet(@vpc.id, "10.#{vpc_range}.#{subnet_range}.0/24",
16
- 'AvailabilityZone' => subnet_az).body['subnet']
17
- subnet_az = subnet_az.succ
18
- subnet_range *= 2
19
- subnet
20
- end
21
-
22
- tests('success') do
23
-
24
- subnet_ids = @subnets.map { |sn| sn['subnetId'] }.to_a
25
-
26
- tests("#create_cache_subnet_group").formats(AWS::Elasticache::Formats::CREATE_CACHE_SUBNET_GROUP) do
27
- result = Fog::AWS[:elasticache].create_cache_subnet_group(@subnet_group_name, subnet_ids, 'A subnet group').body
28
-
29
- returns(@subnet_group_name) { result['CreateCacheSubnetGroupResult']['CacheSubnetGroup']['CacheSubnetGroupName'] }
30
- returns('A subnet group') { result['CreateCacheSubnetGroupResult']['CacheSubnetGroup']['CacheSubnetGroupDescription'] }
31
- returns(@vpc.id) { result['CreateCacheSubnetGroupResult']['CacheSubnetGroup']['VpcId'] }
32
- returns(subnet_ids.sort) { result['CreateCacheSubnetGroupResult']['CacheSubnetGroup']['Subnets'].sort }
33
-
34
- result
35
- end
36
-
37
- tests("#describe_cache_subnet_groups").formats(AWS::Elasticache::Formats::DESCRIBE_CACHE_SUBNET_GROUPS) do
38
- Fog::AWS[:elasticache].describe_cache_subnet_groups.body
39
- end
40
-
41
- tests("#delete_cache_subnet_group").formats(AWS::Elasticache::Formats::BASIC) do
42
- Fog::AWS[:elasticache].delete_cache_subnet_group(@subnet_group_name).body
43
- end
44
-
45
- end
46
-
47
- @subnets.each do |sn|
48
- Fog::Compute[:aws].delete_subnet(sn['subnetId'])
49
- end
50
- @vpc.destroy
51
-
52
- end
@@ -1,91 +0,0 @@
1
- class AWS
2
- module ELB
3
- module Formats
4
- BASIC = {
5
- 'ResponseMetadata' => {'RequestId' => String}
6
- }
7
-
8
- LOAD_BALANCER = {
9
- "AvailabilityZones" => Array,
10
- "BackendServerDescriptions" => Array,
11
- "CanonicalHostedZoneName" => String,
12
- "CanonicalHostedZoneNameID" => String,
13
- "CreatedTime" => Time,
14
- "DNSName" => String,
15
- "HealthCheck" => {"HealthyThreshold" => Integer, "Timeout" => Integer, "UnhealthyThreshold" => Integer, "Interval" => Integer, "Target" => String},
16
- "Instances" => Array,
17
- "ListenerDescriptions" => [{
18
- 'PolicyNames' => Array,
19
- 'Listener' => {
20
- 'InstancePort' => Integer,
21
- 'InstanceProtocol' => String,
22
- 'LoadBalancerPort' => Integer,
23
- 'Protocol' => String,
24
- 'SSLCertificateId' => Fog::Nullable::String
25
- }
26
- }],
27
- "LoadBalancerName" => String,
28
- "Policies" => {"LBCookieStickinessPolicies" => Array, "AppCookieStickinessPolicies" => Array, "OtherPolicies" => Array},
29
- "Scheme" => String,
30
- "SecurityGroups" => [Fog::Nullable::String],
31
- "SourceSecurityGroup" => {"GroupName" => String, "OwnerAlias" => String},
32
- "Subnets" => [Fog::Nullable::String]
33
- }
34
-
35
- CREATE_LOAD_BALANCER = BASIC.merge({
36
- 'CreateLoadBalancerResult' => { 'DNSName' => String }
37
- })
38
-
39
- DESCRIBE_LOAD_BALANCERS = BASIC.merge({
40
- 'DescribeLoadBalancersResult' => {'LoadBalancerDescriptions' => [LOAD_BALANCER], 'NextMarker' => Fog::Nullable::String}
41
- })
42
-
43
- POLICY_ATTRIBUTE_DESCRIPTION = {
44
- "AttributeName" => String,
45
- "AttributeValue" => String
46
- }
47
-
48
- POLICY = {
49
- "PolicyAttributeDescriptions" => [POLICY_ATTRIBUTE_DESCRIPTION],
50
- "PolicyName" => String,
51
- "PolicyTypeName" => String
52
- }
53
-
54
- DESCRIBE_LOAD_BALANCER_POLICIES = BASIC.merge({
55
- 'DescribeLoadBalancerPoliciesResult' => { 'PolicyDescriptions' => [POLICY] }
56
- })
57
-
58
- POLICY_ATTRIBUTE_TYPE_DESCRIPTION = {
59
- "AttributeName" => String,
60
- "AttributeType" => String,
61
- "Cardinality" => String,
62
- "DefaultValue" => String,
63
- "Description" => String
64
- }
65
-
66
- POLICY_TYPE = {
67
- "Description" => String,
68
- "PolicyAttributeTypeDescriptions" => [POLICY_ATTRIBUTE_TYPE_DESCRIPTION],
69
- "PolicyTypeName" => String
70
- }
71
-
72
- DESCRIBE_LOAD_BALANCER_POLICY_TYPES = BASIC.merge({
73
- 'DescribeLoadBalancerPolicyTypesResult' => {'PolicyTypeDescriptions' => [POLICY_TYPE] }
74
- })
75
-
76
- CONFIGURE_HEALTH_CHECK = BASIC.merge({
77
- 'ConfigureHealthCheckResult' => {'HealthCheck' => {
78
- 'Target' => String,
79
- 'Interval' => Integer,
80
- 'Timeout' => Integer,
81
- 'UnhealthyThreshold' => Integer,
82
- 'HealthyThreshold' => Integer
83
- }}
84
- })
85
-
86
- DELETE_LOAD_BALANCER = BASIC.merge({
87
- 'DeleteLoadBalancerResult' => NilClass
88
- })
89
- end
90
- end
91
- end
@@ -1,68 +0,0 @@
1
- Shindo.tests('AWS::ELB | listener_tests', ['aws', 'elb']) do
2
- @load_balancer_id = 'fog-test-listener'
3
- @key_name = 'fog-test'
4
-
5
- tests('success') do
6
- Fog::AWS[:elb].create_load_balancer(['us-east-1a'], @load_balancer_id, [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}])
7
- @certificate = Fog::AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
8
-
9
- tests("#create_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
10
- listeners = [
11
- {'Protocol' => 'TCP', 'InstanceProtocol' => 'TCP', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
12
- {'Protocol' => 'HTTP', 'InstanceProtocol' => 'HTTP', 'LoadBalancerPort' => 80, 'InstancePort' => 80}
13
- ]
14
- response = Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
15
- response
16
- end
17
-
18
- tests("#delete_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
19
- ports = [80, 443]
20
- Fog::AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
21
- end
22
-
23
- tests("#create_load_balancer_listeners with non-existant SSL certificate") do
24
- listeners = [
25
- {'Protocol' => 'HTTPS', 'InstanceProtocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => 'non-existant'},
26
- ]
27
- raises(Fog::AWS::IAM::NotFound) { Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners) }
28
- end
29
-
30
- tests("#create_load_balancer_listeners with invalid SSL certificate").raises(Fog::AWS::IAM::NotFound) do
31
- sleep 8 unless Fog.mocking?
32
- listeners = [
33
- {'Protocol' => 'HTTPS', 'InstanceProtocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => "#{@certificate['Arn']}fake"},
34
- ]
35
- Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
36
- end
37
-
38
- # This is sort of fucked up, but it may or may not fail, thanks AWS
39
- tests("#create_load_balancer_listeners with SSL certificate").formats(AWS::ELB::Formats::BASIC) do
40
- sleep 8 unless Fog.mocking?
41
- listeners = [
42
- {'Protocol' => 'HTTPS', 'InstanceProtocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
43
- ]
44
- Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
45
- end
46
-
47
- tests("#set_load_balancer_listener_ssl_certificate").formats(AWS::ELB::Formats::BASIC) do
48
- Fog::AWS[:elb].set_load_balancer_listener_ssl_certificate(@load_balancer_id, 443, @certificate['Arn']).body
49
- end
50
-
51
- tests("#create_load_balancer_listeners with invalid Protocol and InstanceProtocol configuration").raises(Fog::AWS::ELB::ValidationError) do
52
- listeners = [
53
- {'Protocol' => 'HTTP', 'InstanceProtocol' => 'TCP', 'LoadBalancerPort' => 80, 'InstancePort' => 80},
54
- ]
55
- Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
56
- end
57
-
58
- tests("#create_load_balancer_listeners with valid Protocol and InstanceProtocol configuration").formats(AWS::ELB::Formats::BASIC) do
59
- listeners = [
60
- {'Protocol' => 'HTTP', 'InstanceProtocol' => 'HTTPS', 'LoadBalancerPort' => 80, 'InstancePort' => 80},
61
- ]
62
- Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
63
- end
64
-
65
- Fog::AWS[:iam].delete_server_certificate(@key_name)
66
- Fog::AWS[:elb].delete_load_balancer(@load_balancer_id)
67
- end
68
- end
@@ -1,89 +0,0 @@
1
- Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
2
- @load_balancer_id = 'fog-test-elb'
3
- @key_name = 'fog-test'
4
-
5
- tests('success') do
6
- if (Fog::AWS[:iam].get_server_certificate(@key_name) rescue nil)
7
- Fog::AWS[:iam].delete_server_certificate(@key_name)
8
- end
9
-
10
- @certificate = Fog::AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
11
-
12
- tests("#create_load_balancer").formats(AWS::ELB::Formats::CREATE_LOAD_BALANCER) do
13
- zones = ['us-east-1a']
14
- listeners = [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'InstanceProtocol' => 'HTTP', 'Protocol' => 'HTTP'}]
15
- Fog::AWS[:elb].create_load_balancer(zones, @load_balancer_id, listeners).body
16
- end
17
-
18
- tests("#describe_load_balancers").formats(AWS::ELB::Formats::DESCRIBE_LOAD_BALANCERS) do
19
- Fog::AWS[:elb].describe_load_balancers.body
20
- end
21
-
22
- tests('#describe_load_balancers with bad lb') do
23
- raises(Fog::AWS::ELB::NotFound) { Fog::AWS[:elb].describe_load_balancers('LoadBalancerNames' => 'none-such-lb') }
24
- end
25
-
26
- tests("#describe_load_balancers with SSL listener") do
27
- sleep 5 unless Fog.mocking?
28
- listeners = [
29
- {'Protocol' => 'HTTPS', 'LoadBalancerPort' => 443, 'InstancePort' => 443, 'SSLCertificateId' => @certificate['Arn']},
30
- ]
31
- Fog::AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners)
32
- response = Fog::AWS[:elb].describe_load_balancers('LoadBalancerNames' => @load_balancer_id).body
33
- tests("SSLCertificateId is set").returns(@certificate['Arn']) do
34
- listeners = response["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first["ListenerDescriptions"]
35
- listeners.find {|l| l["Listener"]["Protocol"] == 'HTTPS' }["Listener"]["SSLCertificateId"]
36
- end
37
- end
38
-
39
- tests("modify_load_balancer_attributes") do
40
- attributes = {
41
- 'ConnectionDraining' => {'Enabled' => true, 'Timeout' => 600},
42
- 'CrossZoneLoadBalancing' => {'Enabled' => true},
43
- 'ConnectionSettings' => {'IdleTimeout' => 180}
44
- }
45
- Fog::AWS[:elb].modify_load_balancer_attributes(@load_balancer_id, attributes).body
46
- response = Fog::AWS[:elb].describe_load_balancer_attributes(@load_balancer_id).
47
- body['DescribeLoadBalancerAttributesResult']['LoadBalancerAttributes']
48
-
49
- tests("ConnectionDraining is enabled") do
50
- response['ConnectionDraining']['Enabled'] == true
51
- end
52
- tests("ConnectionDraining has a 600 second Timeout").returns(600) do
53
- response['ConnectionDraining']['Timeout']
54
- end
55
- tests("ConnectionSettings has a 180 second IdleTimeout").returns(180) do
56
- response['ConnectionSettings']['IdleTimeout']
57
- end
58
- tests("CrossZoneLoadBalancing is enabled") do
59
- response['CrossZoneLoadBalancing']['Enabled'] == true
60
- end
61
- end
62
-
63
- tests("#configure_health_check").formats(AWS::ELB::Formats::CONFIGURE_HEALTH_CHECK) do
64
- health_check = {
65
- 'Target' => 'HTTP:80/index.html',
66
- 'Interval' => 10,
67
- 'Timeout' => 5,
68
- 'UnhealthyThreshold' => 2,
69
- 'HealthyThreshold' => 3
70
- }
71
-
72
- Fog::AWS[:elb].configure_health_check(@load_balancer_id, health_check).body
73
- end
74
-
75
- tests("#delete_load_balancer").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
76
- Fog::AWS[:elb].delete_load_balancer(@load_balancer_id).body
77
- end
78
-
79
- tests("#delete_load_balancer when non existant").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
80
- Fog::AWS[:elb].delete_load_balancer('non-existant').body
81
- end
82
-
83
- tests("#delete_load_balancer when already deleted").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
84
- Fog::AWS[:elb].delete_load_balancer(@load_balancer_id).body
85
- end
86
-
87
- Fog::AWS[:iam].delete_server_certificate(@key_name)
88
- end
89
- end
@@ -1,132 +0,0 @@
1
- Shindo.tests('AWS::ELB | policy_tests', ['aws', 'elb']) do
2
- @load_balancer_id = 'fog-test-policies'
3
-
4
- tests('success') do
5
- listeners = [{'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'}]
6
- Fog::AWS[:elb].create_load_balancer(['us-east-1a'], @load_balancer_id, listeners)
7
-
8
- tests("#describe_load_balancer_policy_types").formats(AWS::ELB::Formats::DESCRIBE_LOAD_BALANCER_POLICY_TYPES) do
9
- @policy_types = Fog::AWS[:elb].describe_load_balancer_policy_types.body
10
- end
11
-
12
- tests("#create_app_cookie_stickiness_policy").formats(AWS::ELB::Formats::BASIC) do
13
- cookie, policy = 'fog-app-cookie', 'fog-app-policy'
14
- Fog::AWS[:elb].create_app_cookie_stickiness_policy(@load_balancer_id, policy, cookie).body
15
- end
16
-
17
- tests("#create_lb_cookie_stickiness_policy with expiry").formats(AWS::ELB::Formats::BASIC) do
18
- policy = 'fog-lb-expiry'
19
- expiry = 300
20
- Fog::AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy, expiry).body
21
- end
22
-
23
- tests("#create_lb_cookie_stickiness_policy without expiry").formats(AWS::ELB::Formats::BASIC) do
24
- policy = 'fog-lb-no-expiry'
25
- Fog::AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy).body
26
- end
27
-
28
- tests("#create_load_balancer_policy").formats(AWS::ELB::Formats::BASIC) do
29
- policy = 'fog-policy'
30
- Fog::AWS[:elb].create_load_balancer_policy(@load_balancer_id, policy, 'PublicKeyPolicyType', {'PublicKey' => AWS::IAM::SERVER_CERT_PUBLIC_KEY}).body
31
- end
32
-
33
- tests("#describe_load_balancer_policies") do
34
- body = Fog::AWS[:elb].describe_load_balancer_policies(@load_balancer_id).body
35
- formats(AWS::ELB::Formats::DESCRIBE_LOAD_BALANCER_POLICIES) { body }
36
-
37
- # Check the result of each policy by name
38
- returns({
39
- "PolicyAttributeDescriptions"=>[{
40
- "AttributeName"=>"CookieName",
41
- "AttributeValue"=>"fog-app-cookie"
42
- }],
43
- "PolicyName"=>"fog-app-policy",
44
- "PolicyTypeName"=>"AppCookieStickinessPolicyType"
45
- }) do
46
- body["DescribeLoadBalancerPoliciesResult"]["PolicyDescriptions"].find{|e| e['PolicyName'] == 'fog-app-policy' }
47
- end
48
-
49
- returns({
50
- "PolicyAttributeDescriptions"=>[{
51
- "AttributeName"=>"CookieExpirationPeriod",
52
- "AttributeValue"=>"300"
53
- }],
54
- "PolicyName"=>"fog-lb-expiry",
55
- "PolicyTypeName"=>"LBCookieStickinessPolicyType"
56
- }) do
57
- body["DescribeLoadBalancerPoliciesResult"]["PolicyDescriptions"].find{|e| e['PolicyName'] == 'fog-lb-expiry' }
58
- end
59
-
60
- returns({
61
- "PolicyAttributeDescriptions"=>[{
62
- "AttributeName"=>"CookieExpirationPeriod",
63
- "AttributeValue"=>"0"
64
- }],
65
- "PolicyName"=>"fog-lb-no-expiry",
66
- "PolicyTypeName"=>"LBCookieStickinessPolicyType"
67
- }) do
68
- body["DescribeLoadBalancerPoliciesResult"]["PolicyDescriptions"].find{|e| e['PolicyName'] == 'fog-lb-no-expiry' }
69
- end
70
-
71
- returns({
72
- "PolicyAttributeDescriptions"=>[{
73
- "AttributeName"=>"PublicKey",
74
- "AttributeValue"=> AWS::IAM::SERVER_CERT_PUBLIC_KEY
75
- }],
76
- "PolicyName"=>"fog-policy",
77
- "PolicyTypeName"=>"PublicKeyPolicyType"
78
- }) do
79
- body["DescribeLoadBalancerPoliciesResult"]["PolicyDescriptions"].find{|e| e['PolicyName'] == 'fog-policy' }
80
- end
81
- end
82
-
83
- tests("#describe_load_balancer includes all policies") do
84
- lb = Fog::AWS[:elb].describe_load_balancers("LoadBalancerNames" => [@load_balancer_id]).body["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first
85
- returns([
86
- {"PolicyName"=>"fog-app-policy", "CookieName"=>"fog-app-cookie"}
87
- ]) { lb["Policies"]["AppCookieStickinessPolicies"] }
88
-
89
- returns([
90
- {"PolicyName"=>"fog-lb-expiry", "CookieExpirationPeriod"=> 300}
91
- ]) { lb["Policies"]["LBCookieStickinessPolicies"].select{|e| e["PolicyName"] == "fog-lb-expiry"} }
92
-
93
- returns([
94
- {"PolicyName" => "fog-lb-no-expiry"}
95
- ]) { lb["Policies"]["LBCookieStickinessPolicies"].select{|e| e["PolicyName"] == "fog-lb-no-expiry"} }
96
-
97
- returns([
98
- "fog-policy"
99
- ]) { lb["Policies"]["OtherPolicies"] }
100
- end
101
-
102
- tests("#delete_load_balancer_policy").formats(AWS::ELB::Formats::BASIC) do
103
- policy = 'fog-lb-no-expiry'
104
- Fog::AWS[:elb].delete_load_balancer_policy(@load_balancer_id, policy).body
105
- end
106
-
107
- tests("#set_load_balancer_policies_of_listener adds policy").formats(AWS::ELB::Formats::BASIC) do
108
- port, policies = 80, ['fog-lb-expiry']
109
- Fog::AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, policies).body
110
- end
111
-
112
- tests("#set_load_balancer_policies_of_listener removes policy").formats(AWS::ELB::Formats::BASIC) do
113
- port = 80
114
- Fog::AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, []).body
115
- end
116
-
117
- proxy_policy = "EnableProxyProtocol"
118
- Fog::AWS[:elb].create_load_balancer_policy(@load_balancer_id, proxy_policy, 'ProxyProtocolPolicyType', { "ProxyProtocol" => true })
119
-
120
- tests("#set_load_balancer_policies_for_backend_server replaces policies on port").formats(AWS::ELB::Formats::BASIC) do
121
- Fog::AWS[:elb].set_load_balancer_policies_for_backend_server(@load_balancer_id, 80, [proxy_policy]).body
122
- end
123
-
124
- tests("#describe_load_balancers has other policies") do
125
- Fog::AWS[:elb].set_load_balancer_policies_for_backend_server(@load_balancer_id, 80, [proxy_policy]).body
126
- description = Fog::AWS[:elb].describe_load_balancers("LoadBalancerNames" => [@load_balancer_id]).body["DescribeLoadBalancersResult"]["LoadBalancerDescriptions"].first
127
- returns(true) { description["Policies"]["OtherPolicies"].include?(proxy_policy) }
128
- end
129
-
130
- Fog::AWS[:elb].delete_load_balancer(@load_balancer_id)
131
- end
132
- end