| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'cloudkitty::db::mysql' do |
| 4 |
|
| 5 |
let :pre_condition do |
| 6 |
'include mysql::server' |
| 7 |
end |
| 8 |
|
| 9 |
let :required_params do |
| 10 |
{ :password => 'cloudkittypass', } |
| 11 |
end |
| 12 |
|
| 13 |
shared_examples_for 'cloudkitty-db-mysql' do |
| 14 |
context 'with only required params' do |
| 15 |
let :params do |
| 16 |
required_params |
| 17 |
end |
| 18 |
|
| 19 |
it { is_expected.to contain_class('cloudkitty::deps') } |
| 20 |
|
| 21 |
it { is_expected.to contain_openstacklib__db__mysql('cloudkitty').with( |
| 22 |
:user => 'cloudkitty', |
| 23 |
:password => 'cloudkittypass', |
| 24 |
:dbname => 'cloudkitty', |
| 25 |
:host => '127.0.0.1', |
| 26 |
:charset => 'utf8', |
| 27 |
:collate => 'utf8_general_ci', |
| 28 |
)} |
| 29 |
end |
| 30 |
|
| 31 |
context 'overriding allowed_hosts param to array' do |
| 32 |
let :params do |
| 33 |
{ :allowed_hosts => ['127.0.0.1','%'] }.merge(required_params) |
| 34 |
end |
| 35 |
|
| 36 |
it { is_expected.to contain_openstacklib__db__mysql('cloudkitty').with( |
| 37 |
:user => 'cloudkitty', |
| 38 |
:password => 'cloudkittypass', |
| 39 |
:dbname => 'cloudkitty', |
| 40 |
:host => '127.0.0.1', |
| 41 |
:charset => 'utf8', |
| 42 |
:collate => 'utf8_general_ci', |
| 43 |
:allowed_hosts => ['127.0.0.1','%'] |
| 44 |
)} |
| 45 |
end |
| 46 |
|
| 47 |
describe 'overriding allowed_hosts param to string' do |
| 48 |
let :params do |
| 49 |
{ :allowed_hosts => '192.168.1.1' }.merge(required_params) |
| 50 |
end |
| 51 |
|
| 52 |
it { is_expected.to contain_openstacklib__db__mysql('cloudkitty').with( |
| 53 |
:user => 'cloudkitty', |
| 54 |
:password => 'cloudkittypass', |
| 55 |
:dbname => 'cloudkitty', |
| 56 |
:host => '127.0.0.1', |
| 57 |
:charset => 'utf8', |
| 58 |
:collate => 'utf8_general_ci', |
| 59 |
:allowed_hosts => '192.168.1.1' |
| 60 |
)} |
| 61 |
end |
| 62 |
end |
| 63 |
|
| 64 |
on_supported_os({ |
| 65 |
:supported_os => OSDefaults.get_supported_os |
| 66 |
}).each do |os,facts| |
| 67 |
context "on #{os}" do |
| 68 |
let (:facts) do |
| 69 |
facts.merge!(OSDefaults.get_facts()) |
| 70 |
end |
| 71 |
|
| 72 |
it_behaves_like 'cloudkitty-db-mysql' |
| 73 |
end |
| 74 |
end |
| 75 |
end |