ansible-role-certbot/test/integration/certbot/serverspec/certbot_spec.rb

44 lines
1 KiB
Ruby
Raw Normal View History

2018-06-10 17:34:06 +00:00
require 'serverspec'
set :backend, :exec
describe package('certbot') do
it { should be_installed }
end
describe file('/var/www/acme') do
it { should exist }
it { should be_directory }
it { should be_mode 755 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end
2018-07-07 17:24:56 +00:00
describe file('/etc/cron.d/certbot') do
it { should exist }
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should contain '--renew-hook /usr/local/bin/certbot-renew' }
end
describe file('/etc/letsencrypt/renew.cfg') do
it { should exist }
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should contain 'test.local = echo OK > /tmp/test.txt' }
end
describe command('RENEWED_DOMAINS=test.local /usr/local/bin/certbot-renew') do
its(:exit_status) { should eq 0 }
end
describe file('/tmp/test.txt') do
it { should exist }
it { should be_file }
it { should contain 'OK' }
end