Skip to content

Commit 8eaa915

Browse files
author
Ashley Penney
committed
Merge pull request #302 from apenney/test-my-cnf
Extend coverage to the contents of /etc/my.cnf.
2 parents 45d734b + 1d59505 commit 8eaa915

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

spec/system/mysql_server_spec.rb

+47-5
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,56 @@ class { 'mysql::server': }
2727
r.exit_code.should be_zero
2828
end
2929
end
30+
31+
describe package(package_name) do
32+
it { should be_installed }
33+
end
34+
35+
describe service(service_name) do
36+
it { should be_running }
37+
it { should be_enabled }
38+
end
3039
end
3140

32-
describe package(package_name) do
33-
it { should be_installed }
41+
describe 'my.cnf' do
42+
it 'should contain sensible values' do
43+
pp = <<-EOS
44+
class { 'mysql::server': }
45+
EOS
46+
puppet_apply(pp) do |r|
47+
r.exit_code.should_not == 1
48+
end
49+
end
50+
51+
describe file('/etc/my.cnf') do
52+
it { should contain 'key_buffer = 16M' }
53+
it { should contain 'max_binlog_size = 100M' }
54+
it { should contain 'query_cache_size = 16M' }
55+
end
3456
end
3557

36-
describe service(service_name) do
37-
it { should be_running }
38-
it { should be_enabled }
58+
describe 'my.cnf changes' do
59+
it 'sets values' do
60+
pp = <<-EOS
61+
class { 'mysql::server':
62+
override_options => { 'mysqld' =>
63+
{ 'key_buffer' => '32M',
64+
'max_binlog_size' => '200M',
65+
'query_cache_size' => '32M',
66+
}
67+
}
68+
}
69+
EOS
70+
puppet_apply(pp) do |r|
71+
r.exit_code.should_not == 1
72+
end
73+
end
74+
75+
describe file('/etc/my.cnf') do
76+
it { should contain 'key_buffer = 32M' }
77+
it { should contain 'max_binlog_size = 200M' }
78+
it { should contain 'query_cache_size = 32M' }
79+
end
3980
end
81+
4082
end

0 commit comments

Comments
 (0)