Loading manifests/ldap.pp +5 −3 Original line number Diff line number Diff line Loading @@ -14,8 +14,10 @@ # include postfix::ldap # class postfix::ldap { package {'postfix-ldap': } case $::osfamily { 'debian': { package {'postfix-ldap': } } default: {} } if ! $postfix::ldap_base { fail 'Missing $postfix::ldap_base !' Loading @@ -36,6 +38,6 @@ class postfix::ldap { owner => 'root', group => 'postfix', content => template('postfix/postfix-ldap-aliases.cf.erb'), require => Package['postfix-ldap'], #TODO: Figure out if should have require package here } } spec/classes/postfix_spec.rb +48 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ describe 'postfix' do context 'when on RedHat' do let (:facts) { { :lsbdistcodename => 'Maipo', :fqdn => 'fqdn.example.com', :operatingsystem => 'RedHat', :operatingsystemmajrelease => '7', Loading Loading @@ -162,8 +163,53 @@ describe 'postfix' do end end context 'when enabling ldap' do it 'should do stuff' do skip 'need to write this still' context 'when on Debian' do let (:params) { { :ldap => true, :ldap_base => 'dc=example,dc=com', :ldap_host => 'host.example.com', } } let (:facts) { { :operatingsystem => 'Debian', :osfamily => 'Debian', :fqdn => 'fqdn.example.com', :lsbdistcodename => 'wheezy', } } it { should contain_package('postfix-ldap') } it { should contain_file('/etc/postfix/ldap-aliases.cf').with( :owner => 'root', :group => 'postfix' ).with_content(/search_base = /) } end context 'when on RedHat' do let (:params) { { :ldap => true, :ldap_base => 'dc=example,dc=com', :ldap_host => 'host.example.com', } } let (:facts) { { :operatingsystem => 'RedHat', :osfamily => 'RedHat', :operatingsystemmajrelease => '7', :lsbdistcodename => 'Maipo', :fqdn => 'fqdn.example.com', } } it do expect { should_not contain_package('postfix-ldap') } end it { should contain_file('/etc/postfix/ldap-aliases.cf').with( :owner => 'root', :group => 'postfix').with_content(/search_base = /) } end end context 'when a custom mail_user is specified' do Loading Loading
manifests/ldap.pp +5 −3 Original line number Diff line number Diff line Loading @@ -14,8 +14,10 @@ # include postfix::ldap # class postfix::ldap { package {'postfix-ldap': } case $::osfamily { 'debian': { package {'postfix-ldap': } } default: {} } if ! $postfix::ldap_base { fail 'Missing $postfix::ldap_base !' Loading @@ -36,6 +38,6 @@ class postfix::ldap { owner => 'root', group => 'postfix', content => template('postfix/postfix-ldap-aliases.cf.erb'), require => Package['postfix-ldap'], #TODO: Figure out if should have require package here } }
spec/classes/postfix_spec.rb +48 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ describe 'postfix' do context 'when on RedHat' do let (:facts) { { :lsbdistcodename => 'Maipo', :fqdn => 'fqdn.example.com', :operatingsystem => 'RedHat', :operatingsystemmajrelease => '7', Loading Loading @@ -162,8 +163,53 @@ describe 'postfix' do end end context 'when enabling ldap' do it 'should do stuff' do skip 'need to write this still' context 'when on Debian' do let (:params) { { :ldap => true, :ldap_base => 'dc=example,dc=com', :ldap_host => 'host.example.com', } } let (:facts) { { :operatingsystem => 'Debian', :osfamily => 'Debian', :fqdn => 'fqdn.example.com', :lsbdistcodename => 'wheezy', } } it { should contain_package('postfix-ldap') } it { should contain_file('/etc/postfix/ldap-aliases.cf').with( :owner => 'root', :group => 'postfix' ).with_content(/search_base = /) } end context 'when on RedHat' do let (:params) { { :ldap => true, :ldap_base => 'dc=example,dc=com', :ldap_host => 'host.example.com', } } let (:facts) { { :operatingsystem => 'RedHat', :osfamily => 'RedHat', :operatingsystemmajrelease => '7', :lsbdistcodename => 'Maipo', :fqdn => 'fqdn.example.com', } } it do expect { should_not contain_package('postfix-ldap') } end it { should contain_file('/etc/postfix/ldap-aliases.cf').with( :owner => 'root', :group => 'postfix').with_content(/search_base = /) } end end context 'when a custom mail_user is specified' do Loading