Files
puppet-cloudkitty/spec/classes/cloudkitty_storage_elasticsearch_spec.rb
Takashi Kajinami 2072b01aac Add support for Elasticsearch storage backend
Change-Id: I9b3b74f3c32a43ae982f0c429c95819dc387bf80
2022-08-17 13:59:17 +09:00

53 lines
1.8 KiB
Ruby

require 'spec_helper'
describe 'cloudkitty::storage::elasticsearch' do
let :params do
{
:host => '<SERVICE DEFAULT>',
:index_name => '<SERVICE DEFAULT>',
:insecure => '<SERVICE DEFAULT>',
:cafile => '<SERVICE DEFAULT>',
:scroll_duration => '<SERVICE DEFAULT>',
}
end
shared_examples_for 'cloudkitty::storage::elasticsearch' do
it { should contain_class('cloudkitty::deps') }
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/host').with_value( params[:host])}
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/index_name').with_value( params[:index_name])}
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/insecure').with_value( params[:insecure])}
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/cafile').with_value( params[:cafile])}
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/scroll_duration').with_value( params[:scroll_duration])}
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
context 'with default parameters' do
it_behaves_like 'cloudkitty::storage::elasticsearch'
end
context 'when overriding parameters' do
before do
params.merge!({
:host => 'http://localhost:9200',
:index_name => 'cloudkitty',
:insecure => true,
:cafile => '/tmp/cafile.crt',
:scroll_duration => 30,
})
end
it_behaves_like 'cloudkitty::storage::elasticsearch'
end
end
end
end