require 'spec_helper' describe 'aodh::keystone::authtoken' do let :params do { :password => 'aodh_password', } end shared_examples 'aodh::keystone::authtoken' do context 'with default parameters' do it 'configure keystone_authtoken' do is_expected.to contain_keystone__resource__authtoken('aodh_config').with( :username => 'aodh', :password => 'aodh_password', :auth_url => 'http://localhost:5000', :project_name => 'services', :user_domain_name => 'Default', :project_domain_name => 'Default', :system_scope => '', :insecure => '', :auth_section => '', :auth_type => 'password', :www_authenticate_uri => 'http://localhost:5000', :auth_version => '', :cache => '', :cafile => '', :certfile => '', :delay_auth_decision => '', :enforce_token_bind => '', :http_connect_timeout => '', :http_request_max_retries => '', :include_service_catalog => '', :keyfile => '', :memcache_pool_conn_get_timeout => '', :memcache_pool_dead_retry => '', :memcache_pool_maxsize => '', :memcache_pool_socket_timeout => '', :memcache_pool_unused_timeout => '', :memcache_secret_key => '', :memcache_security_strategy => '', :memcache_use_advanced_pool => '', :memcached_servers => '', :manage_memcache_package => false, :region_name => '', :token_cache_time => '', :service_token_roles => '', :service_token_roles_required => '', :service_type => '', :interface => '', ) end end context 'when overriding parameters' do before do params.merge!({ :www_authenticate_uri => 'https://10.0.0.1:9999/', :username => 'myuser', :password => 'mypasswd', :auth_url => 'http://127.0.0.1:5000', :project_name => 'service_project', :user_domain_name => 'domainX', :project_domain_name => 'domainX', :system_scope => 'all', :insecure => false, :auth_section => 'new_section', :auth_type => 'password', :auth_version => 'v3', :cache => 'somevalue', :cafile => '/opt/stack/data/cafile.pem', :certfile => 'certfile.crt', :delay_auth_decision => false, :enforce_token_bind => 'permissive', :http_connect_timeout => '300', :http_request_max_retries => '3', :include_service_catalog => true, :keyfile => 'keyfile', :memcache_pool_conn_get_timeout => '9', :memcache_pool_dead_retry => '302', :memcache_pool_maxsize => '11', :memcache_pool_socket_timeout => '2', :memcache_pool_unused_timeout => '61', :memcache_secret_key => 'secret_key', :memcache_security_strategy => 'ENCRYPT', :memcache_use_advanced_pool => true, :memcached_servers => ['memcached01:11211','memcached02:11211'], :manage_memcache_package => true, :region_name => 'region2', :token_cache_time => '301', :service_token_roles => ['service'], :service_token_roles_required => false, :service_type => 'identity', :interface => 'internal', }) end it 'configure keystone_authtoken' do is_expected.to contain_keystone__resource__authtoken('aodh_config').with( :www_authenticate_uri => 'https://10.0.0.1:9999/', :username => 'myuser', :password => 'mypasswd', :auth_url => 'http://127.0.0.1:5000', :project_name => 'service_project', :user_domain_name => 'domainX', :project_domain_name => 'domainX', :system_scope => 'all', :insecure => false, :auth_section => 'new_section', :auth_type => 'password', :auth_version => 'v3', :cache => 'somevalue', :cafile => '/opt/stack/data/cafile.pem', :certfile => 'certfile.crt', :delay_auth_decision => false, :enforce_token_bind => 'permissive', :http_connect_timeout => '300', :http_request_max_retries => '3', :include_service_catalog => true, :keyfile => 'keyfile', :memcache_pool_conn_get_timeout => '9', :memcache_pool_dead_retry => '302', :memcache_pool_maxsize => '11', :memcache_pool_socket_timeout => '2', :memcache_pool_unused_timeout => '61', :memcache_secret_key => 'secret_key', :memcache_security_strategy => 'ENCRYPT', :memcache_use_advanced_pool => true, :memcached_servers => ['memcached01:11211','memcached02:11211'], :manage_memcache_package => true, :region_name => 'region2', :token_cache_time => '301', :service_token_roles => ['service'], :service_token_roles_required => false, :service_type => 'identity', :interface => 'internal', ) end end context 'when overriding parameters via params hash' do before do params.merge!({ :username => 'myuser', :params => { 'username' => 'myotheruser' }, }) end it 'configure keystone_authtoken' do is_expected.to contain_keystone__resource__authtoken('aodh_config').with( :username => 'myotheruser', ) 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 'aodh::keystone::authtoken' end end end