commit
8fbd595f89
3 changed files with 38 additions and 12 deletions
|
@ -58,12 +58,25 @@ class mysql::server (
|
|||
anchor { 'mysql::server::start': }
|
||||
anchor { 'mysql::server::end': }
|
||||
|
||||
Anchor['mysql::server::start'] ->
|
||||
Class['mysql::server::install'] ->
|
||||
Class['mysql::server::config'] ->
|
||||
Class['mysql::server::service'] ->
|
||||
Class['mysql::server::root_password'] ->
|
||||
Class['mysql::server::providers'] ->
|
||||
Anchor['mysql::server::end']
|
||||
if $restart {
|
||||
Anchor['mysql::server::start'] ->
|
||||
Class['mysql::server::install'] ->
|
||||
# Only difference between the blocks is that we use ~> to restart if
|
||||
# restart is set to true.
|
||||
Class['mysql::server::config'] ~>
|
||||
Class['mysql::server::service'] ->
|
||||
Class['mysql::server::root_password'] ->
|
||||
Class['mysql::server::providers'] ->
|
||||
Anchor['mysql::server::end']
|
||||
} else {
|
||||
Anchor['mysql::server::start'] ->
|
||||
Class['mysql::server::install'] ->
|
||||
Class['mysql::server::config'] ->
|
||||
Class['mysql::server::service'] ->
|
||||
Class['mysql::server::root_password'] ->
|
||||
Class['mysql::server::providers'] ->
|
||||
Anchor['mysql::server::end']
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ class mysql::server::config {
|
|||
owner => 'root',
|
||||
group => $mysql::server::root_group,
|
||||
mode => '0400',
|
||||
notify => Class['mysql::server::service'],
|
||||
}
|
||||
|
||||
file { '/etc/mysql':
|
||||
|
|
|
@ -55,7 +55,7 @@ describe 'mysql class' do
|
|||
end
|
||||
|
||||
describe file(mycnf) do
|
||||
it { should contain 'key_buffer = 16M' }
|
||||
it { should contain 'key_buffer_size = 16M' }
|
||||
it { should contain 'max_binlog_size = 100M' }
|
||||
it { should contain 'query_cache_size = 16M' }
|
||||
end
|
||||
|
@ -134,15 +134,29 @@ describe 'mysql class' do
|
|||
end
|
||||
|
||||
describe 'restart' do
|
||||
it 'stops the service restarting if set' do
|
||||
it 'restart => true' do
|
||||
pp = <<-EOS
|
||||
class { 'mysql::server':
|
||||
restart => false,
|
||||
override_options => { 'mysqld' => { 'test' => 'value' } }
|
||||
restart => true,
|
||||
override_options => { 'mysqldump' => { 'default-character-set' => 'UTF-8' } }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.exit_code).to eq(2)
|
||||
expect(r.stdout).to match(/Scheduling refresh/)
|
||||
end
|
||||
end
|
||||
it 'restart => false' do
|
||||
pp = <<-EOS
|
||||
class { 'mysql::server':
|
||||
restart => false,
|
||||
override_options => { 'mysqldump' => { 'default-character-set' => 'UTF-16' } }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.exit_code).to eq(2)
|
||||
expect(r.stdout).to_not match(/Scheduling refresh/)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue