|
2 | 2 |
|
3 | 3 | describe 'mysql::server' do
|
4 | 4 | context 'my.cnf template' do
|
5 |
| - on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms| |
6 |
| - pe_platforms.each do |pe_platform,facts| |
7 |
| - describe "on #{pe_version} #{pe_platform}" do |
8 |
| - let(:facts) { facts } |
| 5 | + on_supported_os.each do |os, facts| |
| 6 | + context "on #{os}" do |
| 7 | + let(:facts) { |
| 8 | + facts.merge({ |
| 9 | + :root_home => '/root', |
| 10 | + }) |
| 11 | + } |
9 | 12 |
|
10 |
| - context 'normal entry' do |
11 |
| - let(:params) {{ :override_options => { 'mysqld' => { 'socket' => '/var/lib/mysql/mysql.sock' } } }} |
12 |
| - it do |
13 |
| - is_expected.to contain_file('mysql-config-file').with({ |
14 |
| - :mode => '0644', |
15 |
| - :selinux_ignore_defaults => true, |
16 |
| - }).with_content(/socket = \/var\/lib\/mysql\/mysql.sock/) |
17 |
| - end |
18 |
| - end |
19 |
| - |
20 |
| - describe 'array entry' do |
21 |
| - let(:params) {{ :override_options => { 'mysqld' => { 'replicate-do-db' => ['base1', 'base2'], } }}} |
22 |
| - it do |
23 |
| - is_expected.to contain_file('mysql-config-file').with_content( |
24 |
| - /.*replicate-do-db = base1\nreplicate-do-db = base2.*/ |
25 |
| - ) |
26 |
| - end |
| 13 | + context 'normal entry' do |
| 14 | + let(:params) {{ :override_options => { 'mysqld' => { 'socket' => '/var/lib/mysql/mysql.sock' } } }} |
| 15 | + it do |
| 16 | + is_expected.to contain_file('mysql-config-file').with({ |
| 17 | + :mode => '0644', |
| 18 | + :selinux_ignore_defaults => true, |
| 19 | + }).with_content(/socket = \/var\/lib\/mysql\/mysql.sock/) |
27 | 20 | end
|
| 21 | + end |
28 | 22 |
|
29 |
| - describe 'ssl set to true' do |
30 |
| - let(:params) {{ :override_options => { 'mysqld' => { 'ssl' => true }}}} |
31 |
| - it { is_expected.to contain_file('mysql-config-file').with_content(/ssl/) } |
32 |
| - it { is_expected.to contain_file('mysql-config-file').without_content(/ssl = true/) } |
| 23 | + describe 'array entry' do |
| 24 | + let(:params) {{ :override_options => { 'mysqld' => { 'replicate-do-db' => ['base1', 'base2'], } }}} |
| 25 | + it do |
| 26 | + is_expected.to contain_file('mysql-config-file').with_content( |
| 27 | + /.*replicate-do-db = base1\nreplicate-do-db = base2.*/ |
| 28 | + ) |
33 | 29 | end
|
| 30 | + end |
34 | 31 |
|
35 |
| - describe 'ssl set to false' do |
36 |
| - let(:params) {{ :override_options => { 'mysqld' => { 'ssl' => false }}}} |
37 |
| - it { is_expected.to contain_file('mysql-config-file').with_content(/ssl = false/) } |
38 |
| - end |
| 32 | + describe 'ssl set to true' do |
| 33 | + let(:params) {{ :override_options => { 'mysqld' => { 'ssl' => true }}}} |
| 34 | + it { is_expected.to contain_file('mysql-config-file').with_content(/ssl/) } |
| 35 | + it { is_expected.to contain_file('mysql-config-file').without_content(/ssl = true/) } |
| 36 | + end |
39 | 37 |
|
40 |
| - # ssl-disable (and ssl) are special cased within mysql. |
41 |
| - describe 'possibility of disabling ssl completely' do |
42 |
| - let(:params) {{ :override_options => { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true }}}} |
43 |
| - it { is_expected.to contain_file('mysql-config-file').without_content(/ssl = true/) } |
44 |
| - end |
| 38 | + describe 'ssl set to false' do |
| 39 | + let(:params) {{ :override_options => { 'mysqld' => { 'ssl' => false }}}} |
| 40 | + it { is_expected.to contain_file('mysql-config-file').with_content(/ssl = false/) } |
| 41 | + end |
45 | 42 |
|
46 |
| - describe 'a non ssl option set to true' do |
47 |
| - let(:params) {{ :override_options => { 'mysqld' => { 'test' => true }}}} |
48 |
| - it { is_expected.to contain_file('mysql-config-file').with_content(/^test$/) } |
49 |
| - it { is_expected.to contain_file('mysql-config-file').without_content(/test = true/) } |
50 |
| - end |
| 43 | + # ssl-disable (and ssl) are special cased within mysql. |
| 44 | + describe 'possibility of disabling ssl completely' do |
| 45 | + let(:params) {{ :override_options => { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true }}}} |
| 46 | + it { is_expected.to contain_file('mysql-config-file').without_content(/ssl = true/) } |
| 47 | + end |
51 | 48 |
|
52 |
| - context 'with includedir' do |
53 |
| - let(:params) {{ :includedir => '/etc/my.cnf.d' }} |
54 |
| - it 'makes the directory' do |
55 |
| - is_expected.to contain_file('/etc/my.cnf.d').with({ |
56 |
| - :ensure => :directory, |
57 |
| - :mode => '0755', |
58 |
| - }) |
59 |
| - end |
| 49 | + describe 'a non ssl option set to true' do |
| 50 | + let(:params) {{ :override_options => { 'mysqld' => { 'test' => true }}}} |
| 51 | + it { is_expected.to contain_file('mysql-config-file').with_content(/^test$/) } |
| 52 | + it { is_expected.to contain_file('mysql-config-file').without_content(/test = true/) } |
| 53 | + end |
60 | 54 |
|
61 |
| - it { is_expected.to contain_file('mysql-config-file').with_content(/!includedir/) } |
| 55 | + context 'with includedir' do |
| 56 | + let(:params) {{ :includedir => '/etc/my.cnf.d' }} |
| 57 | + it 'makes the directory' do |
| 58 | + is_expected.to contain_file('/etc/my.cnf.d').with({ |
| 59 | + :ensure => :directory, |
| 60 | + :mode => '0755', |
| 61 | + }) |
62 | 62 | end
|
63 | 63 |
|
64 |
| - context 'without includedir' do |
65 |
| - let(:params) {{ :includedir => '' }} |
66 |
| - it 'shouldnt contain the directory' do |
67 |
| - is_expected.not_to contain_file('mysql-config-file').with({ |
68 |
| - :ensure => :directory, |
69 |
| - :mode => '0755', |
70 |
| - }) |
71 |
| - end |
| 64 | + it { is_expected.to contain_file('mysql-config-file').with_content(/!includedir/) } |
| 65 | + end |
72 | 66 |
|
73 |
| - it { is_expected.to contain_file('mysql-config-file').without_content(/!includedir/) } |
| 67 | + context 'without includedir' do |
| 68 | + let(:params) {{ :includedir => '' }} |
| 69 | + it 'shouldnt contain the directory' do |
| 70 | + is_expected.not_to contain_file('mysql-config-file').with({ |
| 71 | + :ensure => :directory, |
| 72 | + :mode => '0755', |
| 73 | + }) |
74 | 74 | end
|
| 75 | + |
| 76 | + it { is_expected.to contain_file('mysql-config-file').without_content(/!includedir/) } |
75 | 77 | end
|
76 | 78 | end
|
77 | 79 | end
|
|
0 commit comments