|
117 | 117 | 'port' => 2379, |
118 | 118 | 'tags' => ['foo', 'bar'], |
119 | 119 | 'keys' => ['baz', 'bat'], |
| 120 | + 'ssl' => true, |
| 121 | + 'ssl_keyfile' => '/etc/pki/tls/certs/localhost.crt', |
| 122 | + 'ssl_certfile' => '/path/to/cert.pem', |
| 123 | + 'ssl_ca_certs' => '/path/to/ca_certs', |
| 124 | + 'ssl_cert_reqs' => 0, |
120 | 125 | }, |
121 | 126 | { |
122 | 127 | 'host' => 'redis1', |
123 | 128 | 'password' => 'hunter2', |
124 | 129 | 'port' => 2380, |
125 | 130 | 'tags' => ['foo', 'bar'], |
126 | 131 | 'keys' => ['baz', 'bat'], |
| 132 | + 'ssl' => true, |
| 133 | + 'ssl_keyfile' => '/etc/pki/tls/certs/localhost.crt', |
| 134 | + 'ssl_certfile' => '/path/to/other/cert.pem', |
| 135 | + 'ssl_ca_certs' => '/path/to/other/ca_certs', |
| 136 | + 'ssl_cert_reqs' => 1, |
127 | 137 | }, |
128 | 138 | ], |
129 | 139 | } |
|
138 | 148 | it { is_expected.to contain_file(conf_file).without_content(%r{^[^#]*slowlog-max-len: 5309}) } |
139 | 149 | it { is_expected.to contain_file(conf_file).without_content(%r{warn_on_missing_keys: false}) } |
140 | 150 | it { is_expected.to contain_file(conf_file).without_content(%r{command_stats: true}) } |
| 151 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl: true}) } |
| 152 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_keyfile: /etc/pki/tls/certs/localhost.crt}) } |
| 153 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_certfile: /path/to/cert.pem}) } |
| 154 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_certfile: /path/to/other/cert.pem}) } |
| 155 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_ca_certs: /path/to/ca_certs}) } |
| 156 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_ca_certs: /path/to/other/ca_certs}) } |
| 157 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_cert_reqs: 0}) } |
| 158 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_cert_reqs: 1}) } |
141 | 159 | end |
142 | 160 |
|
143 | 161 | context 'with only keys' do |
|
181 | 199 | it { is_expected.to contain_file(conf_file).with_content(%r{port: 2379}) } |
182 | 200 | it { is_expected.to contain_file(conf_file).with_content(%r{tags:.*\s+- baz\s+- bat}) } |
183 | 201 | end |
| 202 | + |
| 203 | + context 'with ssl configs' do |
| 204 | + let(:params) do |
| 205 | + { |
| 206 | + instances: [ |
| 207 | + { |
| 208 | + 'host' => 'redis1', |
| 209 | + 'password' => 'hunter2', |
| 210 | + 'port' => 2379, |
| 211 | + 'ssl' => true, |
| 212 | + 'ssl_keyfile' => '/etc/pki/tls/certs/localhost.crt', |
| 213 | + 'ssl_certfile' => '/path/to/cert.pem', |
| 214 | + 'ssl_ca_certs' => '/path/to/ca_certs', |
| 215 | + 'ssl_cert_reqs' => 0, |
| 216 | + }, |
| 217 | + ], |
| 218 | + } |
| 219 | + end |
| 220 | + |
| 221 | + it { is_expected.to contain_file(conf_file).with_content(%r{host: redis1}) } |
| 222 | + it { is_expected.to contain_file(conf_file).with_content(%r{^[^#]*password: hunter2}) } |
| 223 | + it { is_expected.to contain_file(conf_file).with_content(%r{port: 2379}) } |
| 224 | + |
| 225 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl: true}) } |
| 226 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_keyfile: /etc/pki/tls/certs/localhost.crt}) } |
| 227 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_certfile: /path/to/cert.pem}) } |
| 228 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_ca_certs: /path/to/ca_certs}) } |
| 229 | + it { is_expected.to contain_file(conf_file).with_content(%r{ssl_cert_reqs: 0}) } |
| 230 | + end |
184 | 231 | end |
185 | 232 | end |
186 | 233 | end |
0 commit comments