puppet-tuskar/spec/classes/tuskar_db_mysql_spec.rb
Emilien Macchi c29c2610a3 MySQL: change default MySQL collate to utf8_general_ci
Install & configure MySQL database by using utf8_general_ci collation
which is the way documented in OpenStack [1] and already the default
in puppetlabs-mysql [2].

[1] http://goo.gl/GA5gyZ
[2] https://github.com/puppetlabs/puppetlabs-mysql/blob/master/manifests/db.pp#L7

Change-Id: I1116cb941e9e432edb6228950c2b0cb4b2790802
Closes-bug: #1446375
2015-04-22 15:28:01 +02:00

96 lines
2.4 KiB
Ruby

#
# Unit tests for tuskar::db::mysql
#
require 'spec_helper'
describe 'tuskar::db::mysql' do
let :pre_condition do
[
'include mysql::server',
'include tuskar::db::sync'
]
end
let :params do
{ :dbname => 'tuskar',
:password => 's3cr3t',
:user => 'tuskar',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:host => '127.0.0.1',
}
end
shared_examples_for 'tuskar mysql database' do
context 'when omiting the required parameter password' do
before { params.delete(:password) }
it { expect { is_expected.to raise_error(Puppet::Error) } }
end
it 'creates a mysql database' do
is_expected.to contain_openstacklib__db__mysql('tuskar').with(
:user => params[:user],
:dbname => params[:dbname],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:host => params[:host],
:charset => params[:charset]
)
end
context 'overriding allowed_hosts param to array' do
before :each do
params.merge!(
:allowed_hosts => ['127.0.0.1','%']
)
end
it {
is_expected.to contain_openstacklib__db__mysql('tuskar').with(
:user => params[:user],
:dbname => params[:dbname],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:host => params[:host],
:charset => params[:charset],
:allowed_hosts => ['127.0.0.1','%']
)}
end
context 'overriding allowed_hosts param to string' do
before :each do
params.merge!(
:allowed_hosts => '192.168.1.1'
)
end
it {
is_expected.to contain_openstacklib__db__mysql('tuskar').with(
:user => params[:user],
:dbname => params[:dbname],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:host => params[:host],
:charset => params[:charset],
:allowed_hosts => '192.168.1.1'
)}
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'tuskar mysql database'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'tuskar mysql database'
end
end