|
18 | 18 |
|
19 | 19 | pidfile = nil |
20 | 20 |
|
21 | | - if facts.dig(:os, 'family').nil? |
22 | | - if facts[:osfamily] |
23 | | - puts "Skipping tests on on platform #{facts[:osfamily]} due to missing facts[:os][:family]" |
24 | | - else |
25 | | - puts "Skipping tests on on platform #{facts[:kernel]} due to missing facts[:os][:family]" |
26 | | - end |
27 | | - next |
28 | | - end |
29 | | - |
30 | 21 | case facts[:os]['family'] |
31 | 22 | when 'Debian' |
32 | 23 | pidfile = '/run/unbound.pid' |
|
67 | 58 | it { is_expected.to contain_file(keys_d_dir) } |
68 | 59 | it { is_expected.to contain_file(hints_file) } |
69 | 60 |
|
| 61 | + context 'on Linux', if: facts[:kernel] == 'Linux' do |
| 62 | + it { is_expected.to contain_systemd__timer('roothints.timer') } |
| 63 | + end |
| 64 | + |
70 | 65 | it do |
71 | 66 | expect(subject).to contain_file(unbound_conf_d).with( |
72 | 67 | 'ensure' => 'directory', |
|
1038 | 1033 | end |
1039 | 1034 | end |
1040 | 1035 |
|
1041 | | - context 'no root hints in config' do |
1042 | | - let(:params) do |
1043 | | - { |
1044 | | - hints_file: 'builtin' |
1045 | | - } |
| 1036 | + context 'roothints' do |
| 1037 | + context 'no root hints in config' do |
| 1038 | + let(:params) do |
| 1039 | + { |
| 1040 | + hints_file: 'builtin' |
| 1041 | + } |
| 1042 | + end |
| 1043 | + |
| 1044 | + it do |
| 1045 | + expect(subject).to contain_concat__fragment( |
| 1046 | + 'unbound-header' |
| 1047 | + ).without_content(%r{root-hints}) |
| 1048 | + end |
| 1049 | + |
| 1050 | + it { is_expected.not_to contain_systemd__timer('roothints.timer') } |
1046 | 1051 | end |
1047 | 1052 |
|
1048 | | - it do |
1049 | | - expect(subject).to contain_concat__fragment( |
1050 | | - 'unbound-header' |
1051 | | - ).without_content(%r{root-hints}) |
| 1053 | + context 'no root hints in config and update_root_hints=unmanaged' do |
| 1054 | + let(:params) do |
| 1055 | + { |
| 1056 | + hints_file: 'builtin', |
| 1057 | + update_root_hints: 'unmanaged' |
| 1058 | + } |
| 1059 | + end |
| 1060 | + |
| 1061 | + it do |
| 1062 | + expect(subject).to contain_concat__fragment( |
| 1063 | + 'unbound-header' |
| 1064 | + ).without_content(%r{root-hints}) |
| 1065 | + end |
| 1066 | + |
| 1067 | + it { is_expected.not_to contain_systemd__timer('roothints.timer') } |
1052 | 1068 | end |
1053 | | - end |
1054 | 1069 |
|
1055 | | - context 'hieradata root hints' do |
1056 | | - let(:params) do |
1057 | | - { |
1058 | | - skip_roothints_download: true, |
1059 | | - hints_file_content: File.read('spec/classes/expected/hieradata-root-hint.conf'), |
1060 | | - } |
| 1070 | + context 'no root hints in config and update_root_hints=absent' do |
| 1071 | + let(:params) do |
| 1072 | + { |
| 1073 | + hints_file: 'builtin', |
| 1074 | + update_root_hints: 'absent' |
| 1075 | + } |
| 1076 | + end |
| 1077 | + |
| 1078 | + it do |
| 1079 | + expect(subject).to contain_concat__fragment( |
| 1080 | + 'unbound-header' |
| 1081 | + ).without_content(%r{root-hints}) |
| 1082 | + end |
| 1083 | + |
| 1084 | + it { is_expected.to contain_systemd__timer('roothints.timer').with_ensure('absent') } |
1061 | 1085 | end |
1062 | 1086 |
|
1063 | | - it do |
1064 | | - expect(subject).to contain_file(hints_file).with( |
1065 | | - 'ensure' => 'file', |
1066 | | - 'mode' => '0444', |
1067 | | - 'content' => File.read('spec/classes/expected/hieradata-root-hint.conf') |
1068 | | - ) |
| 1087 | + context 'update_root_hints=absent' do |
| 1088 | + let(:params) do |
| 1089 | + { |
| 1090 | + update_root_hints: 'absent' |
| 1091 | + } |
| 1092 | + end |
| 1093 | + |
| 1094 | + it { is_expected.to contain_systemd__timer('roothints.timer').with_ensure('absent') } |
1069 | 1095 | end |
1070 | | - end |
1071 | 1096 |
|
1072 | | - context 'with File defaults' do |
1073 | | - let(:pre_condition) { "File { mode => '0644', owner => 'root', group => 'root' }" } |
| 1097 | + context 'hieradata root hints' do |
| 1098 | + let(:params) do |
| 1099 | + { |
| 1100 | + skip_roothints_download: true, |
| 1101 | + hints_file_content: File.read('spec/classes/expected/hieradata-root-hint.conf'), |
| 1102 | + } |
| 1103 | + end |
1074 | 1104 |
|
1075 | | - it { is_expected.to compile.with_all_deps } |
| 1105 | + it do |
| 1106 | + expect(subject).to contain_file(hints_file).with( |
| 1107 | + 'ensure' => 'file', |
| 1108 | + 'mode' => '0444', |
| 1109 | + 'content' => File.read('spec/classes/expected/hieradata-root-hint.conf') |
| 1110 | + ) |
| 1111 | + end |
| 1112 | + end |
| 1113 | + |
| 1114 | + context 'with File defaults' do |
| 1115 | + let(:pre_condition) { "File { mode => '0644', owner => 'root', group => 'root' }" } |
| 1116 | + |
| 1117 | + it { is_expected.to compile.with_all_deps } |
| 1118 | + end |
1076 | 1119 | end |
1077 | 1120 |
|
1078 | 1121 | context 'RPZs config' do |
|
0 commit comments