| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::cache' do |
| 4 |
|
| 5 |
let :params do |
| 6 |
{} |
| 7 |
end |
| 8 |
|
| 9 |
shared_examples_for 'nova::cache' do |
| 10 |
|
| 11 |
context 'with default parameters' do |
| 12 |
it 'configures cache' do |
| 13 |
is_expected.to contain_oslo__cache('nova_config').with( |
| 14 |
:config_prefix => '<SERVICE DEFAULT>', |
| 15 |
:expiration_time => '<SERVICE DEFAULT>', |
| 16 |
:backend_expiration_time => '<SERVICE DEFAULT>', |
| 17 |
:backend => '<SERVICE DEFAULT>', |
| 18 |
:backend_argument => '<SERVICE DEFAULT>', |
| 19 |
:proxies => '<SERVICE DEFAULT>', |
| 20 |
:enabled => '<SERVICE DEFAULT>', |
| 21 |
:debug_cache_backend => '<SERVICE DEFAULT>', |
| 22 |
:socket_timeout => '<SERVICE DEFAULT>', |
| 23 |
:username => '<SERVICE DEFAULT>', |
| 24 |
:password => '<SERVICE DEFAULT>', |
| 25 |
:memcache_servers => '<SERVICE DEFAULT>', |
| 26 |
:memcache_dead_retry => '<SERVICE DEFAULT>', |
| 27 |
:memcache_socket_timeout => nil, |
| 28 |
:enable_socket_keepalive => '<SERVICE DEFAULT>', |
| 29 |
:socket_keepalive_idle => '<SERVICE DEFAULT>', |
| 30 |
:socket_keepalive_interval => '<SERVICE DEFAULT>', |
| 31 |
:socket_keepalive_count => '<SERVICE DEFAULT>', |
| 32 |
:memcache_pool_maxsize => '<SERVICE DEFAULT>', |
| 33 |
:memcache_pool_unused_timeout => '<SERVICE DEFAULT>', |
| 34 |
:memcache_pool_connection_get_timeout => '<SERVICE DEFAULT>', |
| 35 |
:memcache_pool_flush_on_reconnect => '<SERVICE DEFAULT>', |
| 36 |
:memcache_sasl_enabled => '<SERVICE DEFAULT>', |
| 37 |
:memcache_username => nil, |
| 38 |
:memcache_password => nil, |
| 39 |
:redis_server => '<SERVICE DEFAULT>', |
| 40 |
:redis_username => nil, |
| 41 |
:redis_password => nil, |
| 42 |
:redis_sentinels => '<SERVICE DEFAULT>', |
| 43 |
:redis_socket_timeout => nil, |
| 44 |
:redis_sentinel_service_name => '<SERVICE DEFAULT>', |
| 45 |
:tls_enabled => '<SERVICE DEFAULT>', |
| 46 |
:tls_cafile => '<SERVICE DEFAULT>', |
| 47 |
:tls_certfile => '<SERVICE DEFAULT>', |
| 48 |
:tls_keyfile => '<SERVICE DEFAULT>', |
| 49 |
:tls_allowed_ciphers => '<SERVICE DEFAULT>', |
| 50 |
:enable_retry_client => '<SERVICE DEFAULT>', |
| 51 |
:retry_attempts => '<SERVICE DEFAULT>', |
| 52 |
:retry_delay => '<SERVICE DEFAULT>', |
| 53 |
:hashclient_retry_attempts => '<SERVICE DEFAULT>', |
| 54 |
:hashclient_retry_timeout => '<SERVICE DEFAULT>', |
| 55 |
:hashclient_dead_timeout => '<SERVICE DEFAULT>', |
| 56 |
:manage_backend_package => true, |
| 57 |
:hashclient_retry_delay => nil, |
| 58 |
:dead_timeout => nil, |
| 59 |
) |
| 60 |
end |
| 61 |
end |
| 62 |
|
| 63 |
context 'with overridden parameters' do |
| 64 |
let :params do |
| 65 |
{ |
| 66 |
:config_prefix => 'prefix', |
| 67 |
:expiration_time => 3600, |
| 68 |
:backend_expiration_time => 7200, |
| 69 |
:backend => 'oslo_cache.memcache_pool', |
| 70 |
:proxies => ['proxy01:8888', 'proxy02:8888'], |
| 71 |
:enabled => true, |
| 72 |
:debug_cache_backend => false, |
| 73 |
:socket_timeout => 3.0, |
| 74 |
:username => 'user', |
| 75 |
:password => 'pass', |
| 76 |
:memcache_servers => ['memcached01:11211', 'memcached02:11211'], |
| 77 |
:memcache_dead_retry => '60', |
| 78 |
:memcache_socket_timeout => 3.1, |
| 79 |
:enable_socket_keepalive => false, |
| 80 |
:socket_keepalive_idle => 1, |
| 81 |
:socket_keepalive_interval => 1, |
| 82 |
:socket_keepalive_count => 1, |
| 83 |
:memcache_pool_maxsize => '10', |
| 84 |
:memcache_pool_unused_timeout => '120', |
| 85 |
:memcache_pool_connection_get_timeout => '360', |
| 86 |
:memcache_pool_flush_on_reconnect => false, |
| 87 |
:memcache_sasl_enabled => false, |
| 88 |
:memcache_username => 'sasluser', |
| 89 |
:memcache_password => 'saslpass', |
| 90 |
:redis_server => 'localhost:6379', |
| 91 |
:redis_username => 'redisuser', |
| 92 |
:redis_password => 'redispass', |
| 93 |
:redis_sentinels => ['host1:26379', 'host2:26379'], |
| 94 |
:redis_socket_timeout => 3.2, |
| 95 |
:redis_sentinel_service_name => 'mymaster', |
| 96 |
:tls_enabled => false, |
| 97 |
:enable_retry_client => false, |
| 98 |
:retry_attempts => 2, |
| 99 |
:retry_delay => 0, |
| 100 |
:hashclient_retry_attempts => 2, |
| 101 |
:hashclient_retry_timeout => 1, |
| 102 |
:hashclient_dead_timeout => 60, |
| 103 |
:manage_backend_package => false, |
| 104 |
:hashclient_retry_delay => 3, |
| 105 |
:dead_timeout => 61, |
| 106 |
} |
| 107 |
end |
| 108 |
|
| 109 |
it 'configures cache' do |
| 110 |
is_expected.to contain_oslo__cache('nova_config').with( |
| 111 |
:config_prefix => 'prefix', |
| 112 |
:expiration_time => 3600, |
| 113 |
:backend_expiration_time => 7200, |
| 114 |
:backend => 'oslo_cache.memcache_pool', |
| 115 |
:backend_argument => '<SERVICE DEFAULT>', |
| 116 |
:proxies => ['proxy01:8888', 'proxy02:8888'], |
| 117 |
:enabled => true, |
| 118 |
:debug_cache_backend => false, |
| 119 |
:socket_timeout => 3.0, |
| 120 |
:username => 'user', |
| 121 |
:password => 'pass', |
| 122 |
:memcache_servers => ['memcached01:11211', 'memcached02:11211'], |
| 123 |
:memcache_dead_retry => '60', |
| 124 |
:memcache_socket_timeout => 3.1, |
| 125 |
:enable_socket_keepalive => false, |
| 126 |
:socket_keepalive_idle => 1, |
| 127 |
:socket_keepalive_interval => 1, |
| 128 |
:socket_keepalive_count => 1, |
| 129 |
:memcache_pool_maxsize => '10', |
| 130 |
:memcache_pool_unused_timeout => '120', |
| 131 |
:memcache_pool_connection_get_timeout => '360', |
| 132 |
:memcache_pool_flush_on_reconnect => false, |
| 133 |
:memcache_sasl_enabled => false, |
| 134 |
:memcache_username => 'sasluser', |
| 135 |
:memcache_password => 'saslpass', |
| 136 |
:redis_server => 'localhost:6379', |
| 137 |
:redis_username => 'redisuser', |
| 138 |
:redis_password => 'redispass', |
| 139 |
:redis_sentinels => ['host1:26379', 'host2:26379'], |
| 140 |
:redis_socket_timeout => 3.2, |
| 141 |
:redis_sentinel_service_name => 'mymaster', |
| 142 |
:tls_enabled => false, |
| 143 |
:tls_cafile => '<SERVICE DEFAULT>', |
| 144 |
:tls_certfile => '<SERVICE DEFAULT>', |
| 145 |
:tls_keyfile => '<SERVICE DEFAULT>', |
| 146 |
:tls_allowed_ciphers => '<SERVICE DEFAULT>', |
| 147 |
:enable_retry_client => false, |
| 148 |
:retry_attempts => 2, |
| 149 |
:retry_delay => 0, |
| 150 |
:hashclient_retry_attempts => 2, |
| 151 |
:hashclient_retry_timeout => 1, |
| 152 |
:hashclient_dead_timeout => 60, |
| 153 |
:manage_backend_package => false, |
| 154 |
:hashclient_retry_delay => 3, |
| 155 |
:dead_timeout => 61, |
| 156 |
) |
| 157 |
end |
| 158 |
end |
| 159 |
end |
| 160 |
|
| 161 |
on_supported_os({ |
| 162 |
:supported_os => OSDefaults.get_supported_os |
| 163 |
}).each do |os,facts| |
| 164 |
context "on #{os}" do |
| 165 |
let (:facts) do |
| 166 |
facts.merge!(OSDefaults.get_facts()) |
| 167 |
end |
| 168 |
|
| 169 |
it_configures 'nova::cache' |
| 170 |
end |
| 171 |
end |
| 172 |
|
| 173 |
end |