2012-05-16 09:54:49 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'glance::db::mysql' do
|
|
|
|
let :facts do
|
|
|
|
{
|
|
|
|
:osfamily => 'Debian'
|
|
|
|
}
|
2012-10-14 00:23:20 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
'include mysql::server'
|
|
|
|
end
|
2012-05-16 10:00:13 -05:00
|
|
|
|
2012-05-16 09:54:49 -05:00
|
|
|
describe "with default params" do
|
|
|
|
let :params do
|
2012-10-14 00:23:20 -07:00
|
|
|
{
|
2014-02-18 01:45:00 +11:00
|
|
|
:password => 'glancepass1',
|
|
|
|
:mysql_module => '0.9'
|
2012-05-16 09:54:49 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2014-02-18 01:45:00 +11:00
|
|
|
it { should contain_class('mysql::python') }
|
2012-05-16 10:00:13 -05:00
|
|
|
|
|
|
|
it { should contain_mysql__db('glance').with(
|
|
|
|
:password => 'glancepass1',
|
2012-05-16 10:04:29 -05:00
|
|
|
:require => 'Class[Mysql::Config]',
|
|
|
|
:charset => 'latin1'
|
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "overriding default params" do
|
|
|
|
let :params do
|
2012-10-14 00:23:20 -07:00
|
|
|
{
|
2013-07-30 19:04:34 +08:00
|
|
|
:password => 'glancepass2',
|
|
|
|
:dbname => 'glancedb2',
|
|
|
|
:charset => 'utf8',
|
2012-05-16 10:04:29 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it { should contain_mysql__db('glancedb2').with(
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:charset => 'utf8'
|
2012-05-16 10:00:13 -05:00
|
|
|
)}
|
|
|
|
|
2012-05-16 09:54:49 -05:00
|
|
|
end
|
2012-05-16 10:00:13 -05:00
|
|
|
|
2013-07-30 19:04:34 +08:00
|
|
|
describe "overriding allowed_hosts param to array" do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:dbname => 'glancedb2',
|
|
|
|
:allowed_hosts => ['127.0.0.1','%']
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it {should_not contain_glance__db__mysql__host_access("127.0.0.1").with(
|
|
|
|
:user => 'glance',
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:database => 'glancedb2'
|
|
|
|
)}
|
|
|
|
it {should contain_glance__db__mysql__host_access("%").with(
|
|
|
|
:user => 'glance',
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:database => 'glancedb2'
|
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "overriding allowed_hosts param to string" do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:dbname => 'glancedb2',
|
|
|
|
:allowed_hosts => '192.168.1.1'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it {should contain_glance__db__mysql__host_access("192.168.1.1").with(
|
|
|
|
:user => 'glance',
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:database => 'glancedb2'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "overriding allowed_hosts param equals to host param " do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:dbname => 'glancedb2',
|
|
|
|
:allowed_hosts => '127.0.0.1'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
it {should_not contain_glance__db__mysql__host_access("127.0.0.1").with(
|
|
|
|
:user => 'glance',
|
|
|
|
:password => 'glancepass2',
|
|
|
|
:database => 'glancedb2'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2012-05-16 09:54:49 -05:00
|
|
|
end
|