2015-01-02 12:34:40 -05:00
|
|
|
Shindo.tests('AWS::Elasticache | parameter group requests', ['aws', 'elasticache']) do
|
2014-12-30 17:25:09 -05:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
|
|
|
|
name = 'fog-test'
|
|
|
|
description = 'Fog Test Parameter Group'
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#describe_engine_default_parameters'
|
2015-01-02 12:34:40 -05:00
|
|
|
).formats(AWS::Elasticache::Formats::ENGINE_DEFAULTS) do
|
|
|
|
response = Fog::AWS[:elasticache].describe_engine_default_parameters
|
2014-12-30 17:25:09 -05:00
|
|
|
engine_defaults = response.body['EngineDefaults']
|
|
|
|
returns('memcached1.4') { engine_defaults['CacheParameterGroupFamily'] }
|
|
|
|
engine_defaults
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#create_cache_parameter_group'
|
2015-01-02 12:34:40 -05:00
|
|
|
).formats(AWS::Elasticache::Formats::SINGLE_PARAMETER_GROUP) do
|
|
|
|
body = Fog::AWS[:elasticache].create_cache_parameter_group(name, description).body
|
2014-12-30 17:25:09 -05:00
|
|
|
group = body['CacheParameterGroup']
|
|
|
|
returns(name) { group['CacheParameterGroupName'] }
|
|
|
|
returns(description) { group['Description'] }
|
|
|
|
returns('memcached1.4') { group['CacheParameterGroupFamily'] }
|
|
|
|
body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#describe_cache_parameters'
|
2015-01-02 12:34:40 -05:00
|
|
|
).formats(AWS::Elasticache::Formats::PARAMETER_SET) do
|
|
|
|
response = Fog::AWS[:elasticache].describe_cache_parameters(name)
|
2014-12-30 17:25:09 -05:00
|
|
|
parameter_set = response.body['DescribeCacheParametersResult']
|
|
|
|
parameter_set
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#describe_cache_parameter_groups without options'
|
2015-01-02 12:34:40 -05:00
|
|
|
).formats(AWS::Elasticache::Formats::DESCRIBE_PARAMETER_GROUPS) do
|
|
|
|
body = Fog::AWS[:elasticache].describe_cache_parameter_groups.body
|
2014-12-30 17:25:09 -05:00
|
|
|
returns(true, "has #{name}") do
|
|
|
|
body['CacheParameterGroups'].any? do |group|
|
|
|
|
group['CacheParameterGroupName'] == name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#reset_cache_parameter_group completely'
|
|
|
|
).formats('CacheParameterGroupName' => String) do
|
2015-01-02 12:34:40 -05:00
|
|
|
result = Fog::AWS[:elasticache].reset_cache_parameter_group(
|
2014-12-30 17:25:09 -05:00
|
|
|
name
|
|
|
|
).body['ResetCacheParameterGroupResult']
|
|
|
|
returns(name) {result['CacheParameterGroupName']}
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#modify_cache_parameter_group'
|
|
|
|
).formats('CacheParameterGroupName' => String) do
|
2015-01-02 12:34:40 -05:00
|
|
|
result = Fog::AWS[:elasticache].modify_cache_parameter_group(
|
2014-12-30 17:25:09 -05:00
|
|
|
name, {"chunk_size" => 32}
|
|
|
|
).body['ModifyCacheParameterGroupResult']
|
|
|
|
returns(name) {result['CacheParameterGroupName']}
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
# BUG: returns "MalformedInput - Unexpected complex element termination"
|
|
|
|
tests(
|
|
|
|
'#reset_cache_parameter_group with one parameter'
|
|
|
|
).formats('CacheParameterGroupName' => String) do
|
|
|
|
pending
|
2015-01-02 12:34:40 -05:00
|
|
|
result = Fog::AWS[:elasticache].reset_cache_parameter_group(
|
2014-12-30 17:25:09 -05:00
|
|
|
name, ["chunk_size"]
|
|
|
|
).body['ResetCacheParameterGroupResult']
|
|
|
|
returns(name) {result['CacheParameterGroupName']}
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#describe_cache_parameter_groups with name'
|
2015-01-02 12:34:40 -05:00
|
|
|
).formats(AWS::Elasticache::Formats::DESCRIBE_PARAMETER_GROUPS) do
|
|
|
|
body = Fog::AWS[:elasticache].describe_cache_parameter_groups(name).body
|
2014-12-30 17:25:09 -05:00
|
|
|
returns(1, "size of 1") { body['CacheParameterGroups'].size }
|
|
|
|
returns(name, "has #{name}") do
|
|
|
|
body['CacheParameterGroups'].first['CacheParameterGroupName']
|
|
|
|
end
|
|
|
|
body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests(
|
|
|
|
'#delete_cache_parameter_group'
|
2015-01-02 12:34:40 -05:00
|
|
|
).formats(AWS::Elasticache::Formats::BASIC) do
|
|
|
|
body = Fog::AWS[:elasticache].delete_cache_parameter_group(name).body
|
2014-12-30 17:25:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
# TODO:
|
|
|
|
# Create a duplicate parameter group
|
|
|
|
# List a missing parameter group
|
|
|
|
# Delete a missing parameter group
|
|
|
|
end
|
|
|
|
end
|