postfix-cookbook/spec/default_spec.rb
Lance Albertson be94e35b22
Update tested platforms (#175)
* Update tested platforms

- Remove CentOS 8, Debian 9 & Ubuntu 16.04
- Add CentOS Stream 8, Alma Linux 8, Rocky Linux 8, Debian 11
- Remove SmartOS from ChefSpec as the platform will deprecated soon

Signed-off-by: Lance Albertson <lance@osuosl.org>

* Switch to using lint-unit job instead of chef-delivery

Signed-off-by: Lance Albertson <lance@osuosl.org>

* Remove delivery and move to calling RSpec directly via a reusable workflow

Signed-off-by: Lance Albertson <lance@osuosl.org>
2022-02-02 09:31:55 -08:00

36 lines
1.2 KiB
Ruby

require 'spec_helper'
describe 'postfix::default' do
before do
stub_command('/usr/bin/test /etc/alternatives/mta -ef /usr/sbin/sendmail.postfix').and_return(true)
end
context 'on Centos 8' do
cached(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'centos', version: '8').converge(described_recipe)
end
it '[COOK-4423] renders file main.cf with /etc/pki/tls/cert.pem' do
expect(chef_run).to render_file('/etc/postfix/main.cf').with_content(%r{smtp_tls_CAfile += +/etc/pki/tls/cert.pem})
end
it '[COOK-4619] does not set recipient_delimiter' do
expect(chef_run).to_not render_file('/etc/postfix/main.cf').with_content('recipient_delimiter')
end
end
context 'on Ubuntu 20.04' do
cached(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: 20.04).converge(described_recipe)
end
it '[COOK-4423] renders file main.cf with /etc/postfix/cacert.pem' do
expect(chef_run).to render_file('/etc/postfix/main.cf').with_content(%r{smtp_tls_CAfile += +/etc/ssl/certs/ca-certificates.crt})
end
it '[COOK-4619] does not set recipient_delimiter' do
expect(chef_run).to_not render_file('/etc/postfix/main.cf').with_content('recipient_delimiter')
end
end
end