puppet-glance/spec/classes/glance_limit_spec.rb
Takashi Kajinami 27db72f4a0 Accept system scope credentials for Keystone API request
This change is the first step to support secure RBAC and allows usage
of system scope credentials for Keystone API request.

This change covers the following three items.
 - assignment of system scope roles to system user
 - credential parameters for authtoken middleware
 - credential parameters for oslo.limit library

Note that the credential parameters for authtoken middleware are
used in some providers, and these providers still require a project
scope credential. This will be fixed by the subsequent change.

Depends-on: https://review.opendev.org/804325
Depends-on: https://review.opendev.org/823629
Change-Id: Ic7682993b341a7d45b0957f102f5c3dbd52f9043
2022-01-06 18:00:46 +09:00

82 lines
2.7 KiB
Ruby

require 'spec_helper'
describe 'glance::limit' do
shared_examples_for 'glance::limit' do
let :params do
{
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
:password => 'glance_password',
}
end
it 'configure limit default params' do
is_expected.to contain_oslo__limit('glance_api_config').with(
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
:username => 'glance',
:password => 'glance_password',
:auth_url => 'http://localhost:5000',
:project_name => 'services',
:user_domain_name => 'Default',
:project_domain_name => 'Default',
:system_scope => '<SERVICE DEFAULT>',
:auth_type => 'password',
:service_type => '<SERVICE DEFAULT>',
:valid_interfaces => '<SERVICE DEFAULT>',
:region_name => '<SERVICE DEFAULT>',
:endpoint_override => '<SERVICE DEFAULT>',
)
end
context 'with specific parameters' do
before :each do
params.merge!({
:username => 'alt_glance',
:auth_url => 'http://192.168.0.1:5000',
:project_name => 'alt_services',
:user_domain_name => 'domainX',
:project_domain_name => 'domainX',
:system_scope => 'all',
:auth_type => 'v3password',
:service_type => 'identity',
:valid_interfaces => 'public',
:region_name => 'regionOne',
:endpoint_override => 'http://192.168.0.2:5000',
})
end
it 'configure limit params' do
is_expected.to contain_oslo__limit('glance_api_config').with(
:endpoint_id => 'b41eeaed-d2ae-4add-9bfd-9ea8ac912d64',
:username => 'alt_glance',
:password => 'glance_password',
:auth_url => 'http://192.168.0.1:5000',
:project_name => 'alt_services',
:user_domain_name => 'domainX',
:project_domain_name => 'domainX',
:system_scope => 'all',
:auth_type => 'v3password',
:service_type => 'identity',
:valid_interfaces => 'public',
:region_name => 'regionOne',
:endpoint_override => 'http://192.168.0.2:5000',
)
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_behaves_like 'glance::limit'
end
end
end