| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'cloudkitty::storage::elasticsearch' do |
| 4 |
|
| 5 |
let :params do |
| 6 |
{ |
| 7 |
:host => '<SERVICE DEFAULT>', |
| 8 |
:index_name => '<SERVICE DEFAULT>', |
| 9 |
:insecure => '<SERVICE DEFAULT>', |
| 10 |
:cafile => '<SERVICE DEFAULT>', |
| 11 |
:scroll_duration => '<SERVICE DEFAULT>', |
| 12 |
} |
| 13 |
end |
| 14 |
|
| 15 |
|
| 16 |
shared_examples_for 'cloudkitty::storage::elasticsearch' do |
| 17 |
it { should contain_class('cloudkitty::deps') } |
| 18 |
|
| 19 |
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/host').with_value( params[:host])} |
| 20 |
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/index_name').with_value( params[:index_name])} |
| 21 |
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/insecure').with_value( params[:insecure])} |
| 22 |
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/cafile').with_value( params[:cafile])} |
| 23 |
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/scroll_duration').with_value( params[:scroll_duration])} |
| 24 |
end |
| 25 |
|
| 26 |
on_supported_os({ |
| 27 |
:supported_os => OSDefaults.get_supported_os |
| 28 |
}).each do |os,facts| |
| 29 |
context "on #{os}" do |
| 30 |
let (:facts) do |
| 31 |
facts.merge!(OSDefaults.get_facts()) |
| 32 |
end |
| 33 |
|
| 34 |
context 'with default parameters' do |
| 35 |
it_behaves_like 'cloudkitty::storage::elasticsearch' |
| 36 |
end |
| 37 |
|
| 38 |
context 'when overriding parameters' do |
| 39 |
before do |
| 40 |
params.merge!({ |
| 41 |
:host => 'http://localhost:9200', |
| 42 |
:index_name => 'cloudkitty', |
| 43 |
:insecure => true, |
| 44 |
:cafile => '/tmp/cafile.crt', |
| 45 |
:scroll_duration => 30, |
| 46 |
}) |
| 47 |
end |
| 48 |
it_behaves_like 'cloudkitty::storage::elasticsearch' |
| 49 |
end |
| 50 |
end |
| 51 |
end |
| 52 |
end |