diff --git a/spec/classes/mysql_server_spec.rb b/spec/classes/mysql_server_spec.rb index fcf11e2c8..7a30ead36 100644 --- a/spec/classes/mysql_server_spec.rb +++ b/spec/classes/mysql_server_spec.rb @@ -97,6 +97,19 @@ it { is_expected.to contain_file('/tmp/error.log') } end + context 'default bind-address' do + it { is_expected.to contain_file('mysql-config-file').with_content(%r{^bind-address = 127.0.0.1}) } + end + context 'with defined bind-address' do + let(:params) { { override_options: { 'mysqld' => { 'bind-address' => '1.1.1.1' } } } } + + it { is_expected.to contain_file('mysql-config-file').with_content(%r{^bind-address = 1.1.1.1}) } + end + context 'without bind-address' do + let(:params) { { override_options: { 'mysqld' => { 'bind-address' => :undef } } } } + + it { is_expected.to contain_file('mysql-config-file').without_content(%r{^bind-address}) } + end end context 'mysql::server::root_password' do