1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
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
|