|
12 | 12 |
|
13 | 13 | it { is_expected.to contain_class('profiles::ca_certificates').with( |
14 | 14 | 'disabled_ca_certificates' => [], |
| 15 | + 'puppet_ca' => true, |
15 | 16 | 'publiq_development_ca' => false |
16 | 17 | ) } |
17 | 18 |
|
|
20 | 21 |
|
21 | 22 | it { is_expected.to have_augeas_resource_count(0) } |
22 | 23 |
|
| 24 | + it { is_expected.to contain_file('Puppet CA certificate directory').with( |
| 25 | + 'ensure' => 'directory', |
| 26 | + 'path' => '/usr/local/share/ca-certificates/puppet' |
| 27 | + ) } |
| 28 | + |
| 29 | + it { is_expected.to contain_file('Puppet CA certificate').with( |
| 30 | + 'ensure' => 'file', |
| 31 | + 'path' => '/usr/local/share/ca-certificates/puppet/puppet-ca.crt', |
| 32 | + 'source' => '/etc/puppetlabs/puppet/ssl/certs/ca.pem' |
| 33 | + ) } |
| 34 | + |
23 | 35 | it { is_expected.to contain_exec('Update CA certificates').with( |
24 | 36 | 'command' => 'update-ca-certificates', |
25 | 37 | 'path' => [ '/usr/local/bin', '/usr/bin', '/usr/sbin', '/bin'], |
26 | 38 | 'refreshonly' => true |
27 | 39 | ) } |
| 40 | + |
| 41 | + it { is_expected.to contain_file('Puppet CA certificate').that_requires('File[Puppet CA certificate directory]') } |
| 42 | + it { is_expected.to contain_file('Puppet CA certificate').that_notifies('Exec[Update CA certificates]') } |
28 | 43 | end |
29 | 44 |
|
30 | | - context "with disabled_ca_certificates => 'foobar'" do |
| 45 | + context "with disabled_ca_certificates => 'foobar' and puppet_ca => false" do |
31 | 46 | let(:params) { { |
32 | | - 'disabled_ca_certificates' => 'foobar' |
| 47 | + 'disabled_ca_certificates' => 'foobar', |
| 48 | + 'puppet_ca' => false |
33 | 49 | } } |
34 | 50 |
|
35 | 51 | it { is_expected.not_to contain_apt__source('publiq-tools') } |
|
43 | 59 | 'changes' => 'set *[.= \'foobar\'] \'!foobar\'', |
44 | 60 | ) } |
45 | 61 |
|
| 62 | + it { is_expected.to contain_file('Puppet CA certificate directory').with( |
| 63 | + 'ensure' => 'directory', |
| 64 | + 'path' => '/usr/local/share/ca-certificates/puppet' |
| 65 | + ) } |
| 66 | + |
| 67 | + it { is_expected.to contain_file('Puppet CA certificate').with( |
| 68 | + 'ensure' => 'absent', |
| 69 | + 'path' => '/usr/local/share/ca-certificates/puppet/puppet-ca.crt' |
| 70 | + ) } |
| 71 | + |
46 | 72 | it { is_expected.to contain_exec('Update CA certificates').with( |
47 | 73 | 'command' => 'update-ca-certificates', |
48 | 74 | 'path' => [ '/usr/local/bin', '/usr/bin', '/usr/sbin', '/bin'], |
49 | 75 | 'refreshonly' => true |
50 | 76 | ) } |
51 | 77 |
|
52 | 78 | it { is_expected.to contain_augeas('Disable CA certificate foobar').that_notifies('Exec[Update CA certificates]') } |
| 79 | + it { is_expected.to contain_file('Puppet CA certificate').that_notifies('Exec[Update CA certificates]') } |
53 | 80 | end |
54 | 81 |
|
55 | 82 | context "with disabled_ca_certificates => ['badcert', 'expiredcert'] and publiq_development_root_ca => true" do |
|
0 commit comments