3 RSpec.shared_examples "managing the CRL on the client" do |setting|
4 describe "when manage_crl is false" do
5 let(:params) {{'manage_crl' => false}}
7 it "doesn't manage the hostcrl on the client" do
8 should_not contain_file(client_hostcrl)
12 describe "when manage_crl is true" do
13 let(:params) {{'manage_crl' => true}}
15 it "manages the hostcrl on the client from the server '#{setting}' setting" do
16 should contain_file(client_hostcrl).with(
17 'ensure' => 'present',
18 'content' => Puppet.settings.setting(setting).open(&:read),
25 RSpec.describe 'certregen::client' do
26 include_context "Initialize CA"
28 let(:client_localcacert) { tmpfilename('ca.pem') }
29 let(:client_hostcrl) { tmpfilename('crl.pem') }
33 'localcacert' => client_localcacert,
34 'hostcrl' => client_hostcrl,
35 'pe_build' => '2016.4.0',
40 Puppet.settings.setting(:localcacert).open('w') { |f| f.write("local CA cert") }
41 Puppet.settings.setting(:hostcrl).open('w') { |f| f.write("local CRL") }
44 describe 'when the compile master has CA ssl files' do
46 Puppet.settings.setting(:cacert).open('w') { |f| f.write("CA cert") }
47 Puppet.settings.setting(:cacrl).open('w') { |f| f.write("CA CRL") }
50 describe "managing the localcacert on the client" do
52 should contain_file(client_localcacert).with(
53 'ensure' => 'present',
54 'content' => Puppet.settings.setting(:cacert).open(&:read),
60 it_behaves_like "managing the CRL on the client", :cacrl
63 describe "when the compile master only has agent SSL files" do
65 FileUtils.rm(Puppet[:cacert])
66 FileUtils.rm(Puppet[:cacrl])
69 describe "managing the localcacert on the client" do
70 it 'manages the client CA cert from the `localcacert` setting' do
71 should contain_file(client_localcacert).with(
72 'ensure' => 'present',
73 'content' => Puppet.settings.setting(:localcacert).open(&:read),
79 it_behaves_like "managing the CRL on the client", :hostcrl