Do not test service_user parameters directly
The service_user parameters are not managed directly but managed by the keystone::resource::service_user resource type. Thus we should avoid testing parameters directly otherwise any change in the resource type can cause test failures. Change-Id: Idc1324b4eb683a0ec0e57e20bca25238149adb0f
This commit is contained in:
parent
1ae066c60b
commit
688e39654c
|
@ -1,6 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'cinder::keystone::service_user' do
|
describe 'cinder::keystone::service_user' do
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:password => 'cinder_password',
|
:password => 'cinder_password',
|
||||||
|
@ -8,60 +9,66 @@ describe 'cinder::keystone::service_user' do
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'cinder service_user' do
|
shared_examples 'cinder service_user' do
|
||||||
|
|
||||||
context 'with default parameters' do
|
context 'with default parameters' do
|
||||||
|
|
||||||
it 'configure service_user' do
|
it 'configure service_user' do
|
||||||
is_expected.to contain_cinder_config('service_user/username').with_value('cinder')
|
is_expected.to contain_keystone__resource__service_user('cinder_config').with(
|
||||||
is_expected.to contain_cinder_config('service_user/password').with_value('cinder_password')
|
:username => 'cinder',
|
||||||
is_expected.to contain_cinder_config('service_user/auth_url').with_value('http://localhost:5000')
|
:password => 'cinder_password',
|
||||||
is_expected.to contain_cinder_config('service_user/project_name').with_value('services')
|
:auth_url => 'http://localhost:5000',
|
||||||
is_expected.to contain_cinder_config('service_user/user_domain_name').with_value('Default')
|
:project_name => 'services',
|
||||||
is_expected.to contain_cinder_config('service_user/project_domain_name').with_value('Default')
|
:user_domain_name => 'Default',
|
||||||
is_expected.to contain_cinder_config('service_user/send_service_user_token').with_value(false)
|
:project_domain_name => 'Default',
|
||||||
is_expected.to contain_cinder_config('service_user/insecure').with_value('<SERVICE DEFAULT>')
|
:insecure => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_cinder_config('service_user/auth_type').with_value('password')
|
:send_service_user_token => false,
|
||||||
is_expected.to contain_cinder_config('service_user/auth_version').with_value('<SERVICE DEFAULT>')
|
:auth_type => 'password',
|
||||||
is_expected.to contain_cinder_config('service_user/cafile').with_value('<SERVICE DEFAULT>')
|
:auth_version => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_cinder_config('service_user/certfile').with_value('<SERVICE DEFAULT>')
|
:cafile => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_cinder_config('service_user/keyfile').with_value('<SERVICE DEFAULT>')
|
:certfile => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_cinder_config('service_user/region_name').with_value('<SERVICE DEFAULT>')
|
:keyfile => '<SERVICE DEFAULT>',
|
||||||
|
:region_name => '<SERVICE DEFAULT>',
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when overriding parameters' do
|
context 'when overriding parameters' do
|
||||||
before do
|
before do
|
||||||
params.merge!({
|
params.merge!({
|
||||||
:username => 'myuser',
|
:username => 'myuser',
|
||||||
:password => 'mypasswd',
|
:password => 'mypasswd',
|
||||||
:auth_url => 'https://127.0.0.1:5000',
|
:auth_url => 'http://127.0.0.1:5000',
|
||||||
:project_name => 'service_project',
|
:project_name => 'service_project',
|
||||||
:user_domain_name => 'domainX',
|
:user_domain_name => 'domainX',
|
||||||
:project_domain_name => 'domainX',
|
:project_domain_name => 'domainX',
|
||||||
:send_service_user_token => true,
|
:send_service_user_token => true,
|
||||||
:insecure => false,
|
:insecure => false,
|
||||||
:auth_type => 'password',
|
:auth_type => 'password',
|
||||||
:auth_version => 'v3',
|
:auth_version => 'v3',
|
||||||
:cafile => '/opt/stack/data/cafile.pem',
|
:cafile => '/opt/stack/data/cafile.pem',
|
||||||
:certfile => 'certfile.crt',
|
:certfile => 'certfile.crt',
|
||||||
:keyfile => 'keyfile',
|
:keyfile => 'keyfile',
|
||||||
:region_name => 'region2',
|
:region_name => 'region2',
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'configure service_user' do
|
it 'configure service_user' do
|
||||||
is_expected.to contain_cinder_config('service_user/username').with_value(params[:username])
|
is_expected.to contain_keystone__resource__service_user('cinder_config').with(
|
||||||
is_expected.to contain_cinder_config('service_user/password').with_value(params[:password]).with_secret(true)
|
:username => 'myuser',
|
||||||
is_expected.to contain_cinder_config('service_user/auth_url').with_value(params[:auth_url])
|
:password => 'mypasswd',
|
||||||
is_expected.to contain_cinder_config('service_user/project_name').with_value(params[:project_name])
|
:auth_url => 'http://127.0.0.1:5000',
|
||||||
is_expected.to contain_cinder_config('service_user/user_domain_name').with_value(params[:user_domain_name])
|
:project_name => 'service_project',
|
||||||
is_expected.to contain_cinder_config('service_user/project_domain_name').with_value(params[:project_domain_name])
|
:user_domain_name => 'domainX',
|
||||||
is_expected.to contain_cinder_config('service_user/send_service_user_token').with_value(params[:send_service_user_token])
|
:project_domain_name => 'domainX',
|
||||||
is_expected.to contain_cinder_config('service_user/insecure').with_value(params[:insecure])
|
:send_service_user_token => true,
|
||||||
is_expected.to contain_cinder_config('service_user/auth_type').with_value(params[:auth_type])
|
:insecure => false,
|
||||||
is_expected.to contain_cinder_config('service_user/auth_version').with_value(params[:auth_version])
|
:auth_type => 'password',
|
||||||
is_expected.to contain_cinder_config('service_user/cafile').with_value(params[:cafile])
|
:auth_version => 'v3',
|
||||||
is_expected.to contain_cinder_config('service_user/certfile').with_value(params[:certfile])
|
:cafile => '/opt/stack/data/cafile.pem',
|
||||||
is_expected.to contain_cinder_config('service_user/keyfile').with_value(params[:keyfile])
|
:certfile => 'certfile.crt',
|
||||||
is_expected.to contain_cinder_config('service_user/region_name').with_value(params[:region_name])
|
:keyfile => 'keyfile',
|
||||||
|
:region_name => 'region2',
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -77,4 +84,5 @@ describe 'cinder::keystone::service_user' do
|
||||||
it_behaves_like 'cinder service_user'
|
it_behaves_like 'cinder service_user'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue