puppet-cinder/spec/classes/cinder_backend_defaults_spec.rb
Takashi Kajinami faf117f9f8 Support image volume cache options
This introduces support for the options to customize the image volume
cache feature. This feature is added to the default class as well as
the defined resource type for each volume driver, so that users can
configure the global options as well as the backend specific options.

Note that rbd driver and vmware driver are intentionally excluded,
because for these drivers the specific image store drivers are more
popular method to use in-storage copy when creating a volume from
an image.

Change-Id: I09480346f3a2f05b5ab0aad7033f1b37a31648db
2023-12-26 18:17:30 +09:00

47 lines
1.8 KiB
Ruby

require 'spec_helper'
describe 'cinder::backend::defaults' do
shared_examples 'cinder backend defaults' do
context 'with defaults' do
it 'should configure cinder with default backend_defaults parameters' do
is_expected.to contain_cinder_config('backend_defaults/use_multipath_for_image_xfer').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('backend_defaults/image_volume_cache_enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('backend_defaults/image_volume_cache_max_size_gb').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('backend_defaults/image_volume_cache_max_count').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters' do
let(:params) do
{
:use_multipath_for_image_xfer => true,
:image_volume_cache_enabled => true,
:image_volume_cache_max_size_gb => 100,
:image_volume_cache_max_count => 101,
}
end
it 'should configure cinder with user defined backend_defaults parameters' do
is_expected.to contain_cinder_config('backend_defaults/use_multipath_for_image_xfer').with_value(true)
is_expected.to contain_cinder_config('backend_defaults/image_volume_cache_enabled').with_value(true)
is_expected.to contain_cinder_config('backend_defaults/image_volume_cache_max_size_gb').with_value(100)
is_expected.to contain_cinder_config('backend_defaults/image_volume_cache_max_count').with_value(101)
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 'cinder backend defaults'
end
end
end