require 'spec_helper' describe 'heat::cache' do let :params do {} end shared_examples_for 'heat::cache' do context 'with default parameters' do it 'configures cache' do is_expected.to contain_oslo__cache('heat_config').with( :config_prefix => '', :expiration_time => '', :backend => '', :backend_argument => '', :proxies => '', :enabled => '', :debug_cache_backend => '', :memcache_servers => '', :memcache_dead_retry => '', :memcache_socket_timeout => '', :enable_socket_keepalive => '', :socket_keepalive_idle => '', :socket_keepalive_interval => '', :socket_keepalive_count => '', :memcache_pool_maxsize => '', :memcache_pool_unused_timeout => '', :memcache_pool_connection_get_timeout => '', :tls_enabled => '', :tls_cafile => '', :tls_certfile => '', :tls_keyfile => '', :tls_allowed_ciphers => '', :enable_retry_client => '', :retry_attempts => '', :retry_delay => '', :hashclient_retry_attempts => '', :hashclient_retry_delay => '', :dead_timeout => '', :manage_backend_package => true, ) is_expected.to contain_heat_config('constraint_validation_cache/caching').with_value('') is_expected.to contain_heat_config('constraint_validation_cache/expiration_time').with_value('') is_expected.to contain_heat_config('service_extension_cache/caching').with_value('') is_expected.to contain_heat_config('service_extension_cache/expiration_time').with_value('') is_expected.to contain_heat_config('resource_finder_cache/caching').with_value('') is_expected.to contain_heat_config('resource_finder_cache/expiration_time').with_value('') end end context 'with overridden parameters' do let :params do { :config_prefix => 'prefix', :expiration_time => 3600, :backend => 'oslo_cache.memcache_pool', :proxies => ['proxy01:8888', 'proxy02:8888'], :enabled => true, :debug_cache_backend => false, :memcache_servers => ['memcached01:11211', 'memcached02:11211'], :memcache_dead_retry => '60', :memcache_socket_timeout => '300.0', :enable_socket_keepalive => false, :socket_keepalive_idle => 1, :socket_keepalive_interval => 1, :socket_keepalive_count => 1, :memcache_pool_maxsize => '10', :memcache_pool_unused_timeout => '120', :memcache_pool_connection_get_timeout => '360', :tls_enabled => false, :enable_retry_client => false, :retry_attempts => 2, :retry_delay => 0, :hashclient_retry_attempts => 2, :hashclient_retry_delay => 1, :dead_timeout => 60, :manage_backend_package => false, :constraint_validation_caching => true, :constraint_validation_expiration_time => '3600', :service_extension_caching => true, :service_extension_expiration_time => '3600', :resource_finder_caching => true, :resource_finder_expiration_time => '3600', } end it 'configures cache' do is_expected.to contain_oslo__cache('heat_config').with( :config_prefix => 'prefix', :expiration_time => 3600, :backend => 'oslo_cache.memcache_pool', :backend_argument => '', :proxies => ['proxy01:8888', 'proxy02:8888'], :enabled => true, :debug_cache_backend => false, :memcache_servers => ['memcached01:11211', 'memcached02:11211'], :memcache_dead_retry => '60', :memcache_socket_timeout => '300.0', :enable_socket_keepalive => false, :socket_keepalive_idle => 1, :socket_keepalive_interval => 1, :socket_keepalive_count => 1, :memcache_pool_maxsize => '10', :memcache_pool_unused_timeout => '120', :memcache_pool_connection_get_timeout => '360', :tls_enabled => false, :tls_cafile => '', :tls_certfile => '', :tls_keyfile => '', :tls_allowed_ciphers => '', :enable_retry_client => false, :retry_attempts => 2, :retry_delay => 0, :hashclient_retry_attempts => 2, :hashclient_retry_delay => 1, :dead_timeout => 60, :manage_backend_package => false, ) is_expected.to contain_heat_config('constraint_validation_cache/caching').with_value('true') is_expected.to contain_heat_config('constraint_validation_cache/expiration_time').with_value('3600') is_expected.to contain_heat_config('service_extension_cache/caching').with_value('true') is_expected.to contain_heat_config('service_extension_cache/expiration_time').with_value('3600') is_expected.to contain_heat_config('resource_finder_cache/caching').with_value('true') is_expected.to contain_heat_config('resource_finder_cache/expiration_time').with_value('3600') end end end on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| context "on #{os}" do let (:facts) do facts.merge!(OSDefaults.get_facts()) end it_configures 'heat::cache' end end end