| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'cloudkitty::storage::influxdb' do |
| 4 |
|
| 5 |
let :params do |
| 6 |
{ :username => '<SERVICE DEFAULT>', |
| 7 |
:password => '<SERVICE DEFAULT>', |
| 8 |
:database => '<SERVICE DEFAULT>', |
| 9 |
:retention_policy => '<SERVICE DEFAULT>', |
| 10 |
:host => '<SERVICE DEFAULT>', |
| 11 |
:port => '<SERVICE DEFAULT>', |
| 12 |
:use_ssl => '<SERVICE DEFAULT>', |
| 13 |
:insecure => '<SERVICE DEFAULT>', |
| 14 |
:cafile => '<SERVICE DEFAULT>', |
| 15 |
} |
| 16 |
end |
| 17 |
|
| 18 |
|
| 19 |
shared_examples_for 'cloudkitty::storage::influxdb' do |
| 20 |
it { should contain_class('cloudkitty::deps') } |
| 21 |
|
| 22 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/username').with_value( params[:username])} |
| 23 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/password').with( value: params[:password], secret: true)} |
| 24 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/database').with_value( params[:database])} |
| 25 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/retention_policy').with_value( params[:retention_policy])} |
| 26 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/host').with_value( params[:host])} |
| 27 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/port').with_value( params[:port])} |
| 28 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/use_ssl').with_value( params[:use_ssl])} |
| 29 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/insecure').with_value( params[:insecure])} |
| 30 |
it { is_expected.to contain_cloudkitty_config('storage_influxdb/cafile').with_value( params[:cafile])} |
| 31 |
end |
| 32 |
|
| 33 |
on_supported_os({ |
| 34 |
:supported_os => OSDefaults.get_supported_os |
| 35 |
}).each do |os,facts| |
| 36 |
context "on #{os}" do |
| 37 |
let (:facts) do |
| 38 |
facts.merge!(OSDefaults.get_facts()) |
| 39 |
end |
| 40 |
|
| 41 |
context 'with default parameters' do |
| 42 |
it_behaves_like 'cloudkitty::storage::influxdb' |
| 43 |
end |
| 44 |
|
| 45 |
context 'when overriding parameters' do |
| 46 |
before do |
| 47 |
params.merge!({ |
| 48 |
:username => 'kittycloud', |
| 49 |
:password => 'nice', |
| 50 |
:database => 'kittycloud', |
| 51 |
:retention_policy => 'policy', |
| 52 |
:host => 'kitty.heaven.org', |
| 53 |
:port => 42, |
| 54 |
:use_ssl => 'true', |
| 55 |
:insecure => 'true', |
| 56 |
:cafile => '/tmp/cafile.crt', |
| 57 |
}) |
| 58 |
end |
| 59 |
it_behaves_like 'cloudkitty::storage::influxdb' |
| 60 |
end |
| 61 |
end |
| 62 |
end |
| 63 |
end |