2013-05-03 01:25:55 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2013-08-05 13:20:54 -04:00
|
|
|
describe 'neutron::db::mysql' do
|
2013-05-03 01:25:55 -04:00
|
|
|
let :pre_condition do
|
|
|
|
'include mysql::server'
|
|
|
|
end
|
|
|
|
|
|
|
|
let :params do
|
2015-11-16 16:33:41 +00:00
|
|
|
{
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass',
|
2014-02-18 13:28:47 +11:00
|
|
|
}
|
2013-05-03 01:25:55 -04:00
|
|
|
end
|
2015-06-09 12:20:49 -07:00
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
shared_examples 'neutron::db::mysql' do
|
2020-10-09 09:59:55 +08:00
|
|
|
it { is_expected.to contain_class('neutron::deps') }
|
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
context 'with only required params' do
|
|
|
|
it { should contain_openstacklib__db__mysql('neutron').with(
|
2020-05-19 20:27:12 +09:00
|
|
|
:user => 'neutron',
|
|
|
|
:password => 'neutronpass',
|
|
|
|
:host => '127.0.0.1',
|
|
|
|
:charset => 'utf8',
|
|
|
|
:collate => 'utf8_general_ci',
|
2018-11-28 17:43:42 +01:00
|
|
|
) }
|
2013-08-01 15:04:58 +08:00
|
|
|
end
|
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
context "overriding allowed_hosts param to array" do
|
|
|
|
let :params do
|
|
|
|
{
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass',
|
|
|
|
:allowed_hosts => ['127.0.0.1','%'],
|
2018-11-28 17:43:42 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should contain_openstacklib__db__mysql('neutron').with(
|
2015-11-16 16:33:41 +00:00
|
|
|
:user => 'neutron',
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass',
|
2015-11-16 16:33:41 +00:00
|
|
|
:host => '127.0.0.1',
|
|
|
|
:charset => 'utf8',
|
|
|
|
:collate => 'utf8_general_ci',
|
2018-11-28 17:43:42 +01:00
|
|
|
:allowed_hosts => ['127.0.0.1','%'],
|
|
|
|
) }
|
|
|
|
end
|
2015-11-16 16:33:41 +00:00
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
context "overriding allowed_hosts param to string" do
|
|
|
|
let :params do
|
|
|
|
{
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass2',
|
|
|
|
:allowed_hosts => '192.168.1.1',
|
2018-11-28 17:43:42 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should contain_openstacklib__db__mysql('neutron').with(
|
|
|
|
:user => 'neutron',
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass2',
|
2018-11-28 17:43:42 +01:00
|
|
|
:host => '127.0.0.1',
|
|
|
|
:charset => 'utf8',
|
|
|
|
:collate => 'utf8_general_ci',
|
|
|
|
:allowed_hosts => '192.168.1.1',
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
context "overriding allowed_hosts param equals to host param " do
|
|
|
|
let :params do
|
|
|
|
{
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass2',
|
|
|
|
:allowed_hosts => '127.0.0.1',
|
2018-11-28 17:43:42 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should contain_openstacklib__db__mysql('neutron').with(
|
|
|
|
:user => 'neutron',
|
2020-05-19 20:27:12 +09:00
|
|
|
:password => 'neutronpass2',
|
2018-11-28 17:43:42 +01:00
|
|
|
:host => '127.0.0.1',
|
|
|
|
:charset => 'utf8',
|
|
|
|
:collate => 'utf8_general_ci',
|
|
|
|
:allowed_hosts => '127.0.0.1',
|
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
2013-08-01 15:04:58 +08:00
|
|
|
end
|
2015-11-16 16:33:41 +00:00
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
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
|
2013-08-01 15:04:58 +08:00
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
it_behaves_like 'neutron::db::mysql'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|