Files
puppet-glance/spec/classes/glance_backend_defaults_swift_spec.rb
Takashi Kajinami 17823ff226 Add support for [backend_defaults] options
The latest release of glance_store introduced the mechanism to define
default values used for all backends, by using the [backend_defaults]
options. Add support for these options so that users can leverage
this new feature to simplify config management.

Depends-on: https://review.opendev.org/946512
Change-Id: I6a8e5470e212db1cb30eca72e59265aa0e848ea4
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
2025-07-11 15:45:47 +09:00

89 lines
6.2 KiB
Ruby

require 'spec_helper'
describe 'glance::backend::defaults::swift' do
shared_examples_for 'glance::backend::defaults::swift' do
describe 'when default parameters' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('backend_defaults/swift_store_large_object_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_large_object_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_create_container_on_put').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_endpoint_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_service_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_buffer_on_upload').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_upload_buffer_dir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_retry_get_count').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_large_object_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_large_object_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_create_container_on_put').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_endpoint_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_service_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_buffer_on_upload').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_upload_buffer_dir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_retry_get_count').with_value('<SERVICE DEFAULT>')
end
end
describe 'when overriding parameters' do
let :params do
{
:swift_store_large_object_size => '100',
:swift_store_large_object_chunk_size => '50',
:swift_store_container => 'swift',
:swift_store_create_container_on_put => true,
:swift_store_endpoint_type => 'publicURL',
:swift_store_service_type => 'object-store',
:swift_store_region => 'RegionTwo',
:swift_buffer_on_upload => true,
:swift_upload_buffer_dir => '/var/glance/swift',
:swift_store_retry_get_count => 3,
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('backend_defaults/swift_store_container').with_value('swift')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_api_config('backend_defaults/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_large_object_chunk_size').with_value('50')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_service_type').with_value('object-store')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_api_config('backend_defaults/swift_buffer_on_upload').with_value(true)
is_expected.to contain_glance_api_config('backend_defaults/swift_upload_buffer_dir').with_value('/var/glance/swift')
is_expected.to contain_glance_api_config('backend_defaults/swift_store_retry_get_count').with_value(3)
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_container').with_value('swift')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_large_object_chunk_size').with_value('50')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_service_type').with_value('object-store')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_cache_config('backend_defaults/swift_buffer_on_upload').with_value(true)
is_expected.to contain_glance_cache_config('backend_defaults/swift_upload_buffer_dir').with_value('/var/glance/swift')
is_expected.to contain_glance_cache_config('backend_defaults/swift_store_retry_get_count').with_value(3)
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::backend::defaults::swift'
end
end
end