3 describe 'openstacklib::db::postgresql' do
4 password_hash = 'AA1420F182E88B9E5F874F6FBE7459291E8F4601'
8 let :required_params do
9 { :password_hash => password_hash }
12 context 'on a RedHat osfamily' do
15 :postgres_default_version => '8.4',
20 context 'with only required parameters' do
25 it { is_expected.to contain_postgresql__server__db(title).with(
27 :password => password_hash
31 context 'when overriding encoding' do
33 { :encoding => 'latin1' }.merge(required_params)
35 it { is_expected.to contain_postgresql__server__db(title).with_encoding(params[:encoding]) }
38 context 'when omitting the required parameter password_hash' do
40 required_params.delete(:password_hash)
43 it { expect { is_expected.to raise_error(Puppet::Error) } }
46 context 'when notifying other resources' do
48 'exec { "nova-db-sync": }'
51 { :notify => 'Exec[nova-db-sync]'}.merge(required_params)
54 it {is_expected.to contain_exec('nova-db-sync').that_subscribes_to("Openstacklib::Db::Postgresql[#{title}]") }
57 context 'when required for other openstack services' do
59 'service {"keystone":}'
65 { :before => 'Service[keystone]'}.merge(required_params)
68 it { is_expected.to contain_service('keystone').that_requires("Openstacklib::Db::Postgresql[keystone]") }
73 context 'on a Debian osfamily' do
80 context 'with only required parameters' do
85 it { is_expected.to contain_postgresql__server__db(title).with(
87 :password => password_hash
91 context 'when overriding encoding' do
93 { :encoding => 'latin1' }.merge(required_params)
95 it { is_expected.to contain_postgresql__server__db(title).with_encoding(params[:encoding]) }
98 context 'when omitting the required parameter password_hash' do
100 required_params.delete(:password_hash)
103 it { expect { is_expected.to raise_error(Puppet::Error) } }
106 context 'when notifying other resources' do
107 let :pre_condition do
108 'exec { "nova-db-sync": }'
111 { :notify => 'Exec[nova-db-sync]'}.merge(required_params)
114 it {is_expected.to contain_exec('nova-db-sync').that_subscribes_to("Openstacklib::Db::Postgresql[#{title}]") }
117 context 'when required for other openstack services' do
118 let :pre_condition do
119 'service {"keystone":}'
125 { :before => 'Service[keystone]'}.merge(required_params)
128 it { is_expected.to contain_service('keystone').that_requires("Openstacklib::Db::Postgresql[keystone]") }