Files
puppet-openstacklib/spec/acceptance/mysql_spec.rb
Takashi Kajinami da8f422e3b Ubuntu: Use utf8mb3_general_ci collate in MySQL
Currently idempotency in Ubuntu is broken because of the below change
detected in collate in MySQL.

```
/Stage[main]/Keystone::Db::Mysql/Openstacklib::Db::Mysql[keystone]/
Mysql_database[keystone]/collate: collate changed 'utf8mb3_general_ci'
to 'utf8_general_ci'
```

Similarly to what we observed in the past about charset[1], it seems
MySQL in Ubuntu is automatically converting the collate value and that
is causing the "unexpected" change detected in the 2nd puppet run.

This fixes the idempotency by using utf8mb3_general_ci in Ubuntu to
avoid the mismatch caused by internal translation.

[1] 697cbb83db

Change-Id: I20dfe31776251be63eac1b69501f1714fdae40d7
2022-08-17 13:34:15 +09:00

43 lines
985 B
Ruby

require 'spec_helper_acceptance'
describe 'openstacklib mysql' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
class { 'mysql::server': }
$charset = $::operatingsystem ? {
'Ubuntu' => 'utf8mb3',
default => 'utf8',
}
openstacklib::db::mysql { 'ci':
charset => $charset,
collate => "${charset}_general_ci",
password_hash => mysql::password('keystone'),
allowed_hosts => '127.0.0.1',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe port(3306) do
it { is_expected.to be_listening.with('tcp') }
end
it 'should have ci database' do
command("mysql -e 'show databases;' | grep -q ci") do |r|
expect(r.exit_code).to eq 0
end
end
end
end