Do not test authtoken parameters directly

The authtoken parameters are not managed directly but managed by
the keystone::resource::authtoken class. Thus we should avoid testing
parameters directly otherwise any change in the resource type can
cause test failures.

Change-Id: Ibec687568588def739643e0f00e92de648a11961
This commit is contained in:
Takashi Kajinami 2021-05-08 23:59:04 +09:00
parent 6701ce7fe0
commit 27d9afed0c
1 changed files with 76 additions and 74 deletions

View File

@ -6,45 +6,48 @@ describe 'aodh::keystone::authtoken' do
{ :password => 'aodh_password', } { :password => 'aodh_password', }
end end
shared_examples 'aodh authtoken' do shared_examples 'aodh::keystone::authtoken' do
context 'with default parameters' do context 'with default parameters' do
it 'configure keystone_authtoken' do it 'configure keystone_authtoken' do
is_expected.to contain_aodh_config('keystone_authtoken/username').with_value('aodh') contain_keystone__resources__authtoken('aodh_config').with(
is_expected.to contain_aodh_config('keystone_authtoken/password').with_value('aodh_password') :username => 'aodh',
is_expected.to contain_aodh_config('keystone_authtoken/auth_url').with_value('http://localhost:5000') :password => 'aodh_password',
is_expected.to contain_aodh_config('keystone_authtoken/project_name').with_value('services') :auth_url => 'http://localhost:5000',
is_expected.to contain_aodh_config('keystone_authtoken/user_domain_name').with_value('Default') :project_name => 'services',
is_expected.to contain_aodh_config('keystone_authtoken/project_domain_name').with_value('Default') :user_domain_name => 'Default',
is_expected.to contain_aodh_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>') :project_domain_name => 'Default',
is_expected.to contain_aodh_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>') :insecure => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/auth_type').with_value('password') :auth_section => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/www_authenticate_uri').with_value('http://localhost:5000') :auth_type => 'password',
is_expected.to contain_aodh_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>') :www_authenticate_uri => 'http://localhost:5000',
is_expected.to contain_aodh_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>') :auth_version => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>') :cache => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/certfile').with_value('<SERVICE DEFAULT>') :cafile => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/delay_auth_decision').with_value('<SERVICE DEFAULT>') :certfile => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/enforce_token_bind').with_value('<SERVICE DEFAULT>') :delay_auth_decision => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/http_connect_timeout').with_value('<SERVICE DEFAULT>') :enforce_token_bind => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/http_request_max_retries').with_value('<SERVICE DEFAULT>') :http_connect_timeout => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/include_service_catalog').with_value('<SERVICE DEFAULT>') :http_request_max_retries => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/keyfile').with_value('<SERVICE DEFAULT>') :include_service_catalog => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('<SERVICE DEFAULT>') :keyfile => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_dead_retry').with_value('<SERVICE DEFAULT>') :memcache_pool_conn_get_timeout => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>') :memcache_pool_dead_retry => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('<SERVICE DEFAULT>') :memcache_pool_maxsize => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>') :memcache_pool_socket_timeout => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_secret_key').with_value('<SERVICE DEFAULT>') :memcache_pool_unused_timeout => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_security_strategy').with_value('<SERVICE DEFAULT>') :memcache_secret_key => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_use_advanced_pool').with_value('<SERVICE DEFAULT>') :memcache_security_strategy => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>') :memcache_use_advanced_pool => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>') :memcached_servers => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>') :manage_memcache_package => false,
is_expected.to contain_aodh_config('keystone_authtoken/service_token_roles').with_value('<SERVICE DEFAULT>') :region_name => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/service_token_roles_required').with_value('<SERVICE DEFAULT>') :token_cache_time => '<SERVICE DEFAULT>',
is_expected.to contain_aodh_config('keystone_authtoken/interface').with_value('<SERVICE DEFAULT>') :service_token_roles => '<SERVICE DEFAULT>',
:service_token_roles_required => '<SERVICE DEFAULT>',
:interface => '<SERVICE DEFAULT>',
)
end end
end end
@ -90,44 +93,43 @@ describe 'aodh::keystone::authtoken' do
end end
it 'configure keystone_authtoken' do it 'configure keystone_authtoken' do
is_expected.to contain_aodh_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/') contain_keystone__resources__authtoken('aodh_config').with(
is_expected.to contain_aodh_config('keystone_authtoken/username').with_value(params[:username]) :www_authenticate_uri => 'https://10.0.0.1:9999/',
is_expected.to contain_aodh_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true) :username => 'myuser',
is_expected.to contain_aodh_config('keystone_authtoken/auth_url').with_value(params[:auth_url]) :password => 'mypasswd',
is_expected.to contain_aodh_config('keystone_authtoken/project_name').with_value(params[:project_name]) :auth_url => 'http://:127.0.0.1:5000',
is_expected.to contain_aodh_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name]) :project_name => 'service_project',
is_expected.to contain_aodh_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name]) :user_domain_name => 'domainX',
is_expected.to contain_aodh_config('keystone_authtoken/insecure').with_value(params[:insecure]) :project_domain_name => 'domainX',
is_expected.to contain_aodh_config('keystone_authtoken/auth_section').with_value(params[:auth_section]) :insecure => false,
is_expected.to contain_aodh_config('keystone_authtoken/auth_type').with_value(params[:auth_type]) :auth_section => 'new_section',
is_expected.to contain_aodh_config('keystone_authtoken/auth_version').with_value(params[:auth_version]) :auth_type => 'password',
is_expected.to contain_aodh_config('keystone_authtoken/cache').with_value(params[:cache]) :auth_version => 'v3',
is_expected.to contain_aodh_config('keystone_authtoken/cafile').with_value(params[:cafile]) :cache => 'somevalue',
is_expected.to contain_aodh_config('keystone_authtoken/certfile').with_value(params[:certfile]) :cafile => '/opt/stack/data/cafile.pem',
is_expected.to contain_aodh_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision]) :certfile => 'certfile.crt',
is_expected.to contain_aodh_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind]) :delay_auth_decision => false,
is_expected.to contain_aodh_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout]) :enforce_token_bind => 'permissive',
is_expected.to contain_aodh_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries]) :http_connect_timeout => '300',
is_expected.to contain_aodh_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog]) :http_request_max_retries => '3',
is_expected.to contain_aodh_config('keystone_authtoken/keyfile').with_value(params[:keyfile]) :include_service_catalog => true,
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout]) :keyfile => 'keyfile',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry]) :memcache_pool_conn_get_timeout => '9',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize]) :memcache_pool_dead_retry => '302',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout]) :memcache_pool_maxsize => '11',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout]) :memcache_pool_socket_timeout => '2',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key]) :memcache_pool_unused_timeout => '61',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy]) :memcache_secret_key => 'secret_key',
is_expected.to contain_aodh_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool]) :memcache_security_strategy => 'ENCRYPT',
is_expected.to contain_aodh_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211') :memcache_use_advanced_pool => true,
is_expected.to contain_aodh_config('keystone_authtoken/region_name').with_value(params[:region_name]) :memcached_servers => ['memcached01:11211','memcached02:11211'],
is_expected.to contain_aodh_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time]) :manage_memcache_package => true,
is_expected.to contain_aodh_config('keystone_authtoken/service_token_roles').with_value(params[:service_token_roles]) :region_name => 'region2',
is_expected.to contain_aodh_config('keystone_authtoken/service_token_roles_required').with_value(params[:service_token_roles_required]) :token_cache_time => '301',
is_expected.to contain_aodh_config('keystone_authtoken/interface').with_value(params[:interface]) :service_token_roles => ['service'],
end :service_token_roles_required => false,
:interface => 'internal',
it 'installs python memcache package' do )
is_expected.to contain_package('python-memcache')
end end
end end
end end
@ -140,7 +142,7 @@ describe 'aodh::keystone::authtoken' do
facts.merge!(OSDefaults.get_facts()) facts.merge!(OSDefaults.get_facts())
end end
it_configures 'aodh authtoken' it_configures 'aodh::keystone::authtoken'
end end
end end