|
192 | 192 | hiera_config: OctocatalogDiff::Spec.fixture_path('repos/default/config/hiera.yaml'), |
193 | 193 | hiera_path_strip: '/var/lib/puppet' |
194 | 194 | ) |
195 | | - logger, _logger_str = OctocatalogDiff::Spec.setup_logger |
| 195 | + logger, logger_str = OctocatalogDiff::Spec.setup_logger |
196 | 196 | testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger) |
197 | 197 | hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml') |
198 | 198 | expect(File.file?(hiera_yaml)).to eq(true) |
199 | 199 | hiera_cfg = YAML.load_file(hiera_yaml) |
200 | 200 | expect(hiera_cfg[:backends]).to eq(['yaml']) |
201 | 201 | expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata')) |
| 202 | + expect(logger_str.string).not_to match(/Hiera datadir for yaml doesn't seem to exist/) |
202 | 203 | end |
203 | 204 | end |
204 | 205 |
|
|
213 | 214 | end.to raise_error(ArgumentError, /Called install_hiera_config with a Symbol argument/) |
214 | 215 | end |
215 | 216 | end |
| 217 | + |
| 218 | + context 'warning if directory not found' do |
| 219 | + it 'should warn about not finding the hiera data directory' do |
| 220 | + options = default_options.merge( |
| 221 | + hiera_config: OctocatalogDiff::Spec.fixture_path('repos/default/config/hiera.yaml'), |
| 222 | + hiera_path: 'aksdfjlkfjk' |
| 223 | + ) |
| 224 | + logger, logger_str = OctocatalogDiff::Spec.setup_logger |
| 225 | + testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger) |
| 226 | + hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml') |
| 227 | + expect(File.file?(hiera_yaml)).to eq(true) |
| 228 | + hiera_cfg = YAML.load_file(hiera_yaml) |
| 229 | + expect(hiera_cfg[:backends]).to eq(['yaml']) |
| 230 | + expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'aksdfjlkfjk')) |
| 231 | + expect(logger_str.string).to match(%r{WARNING: Hiera datadir for yaml.+/environments/production/aksdfjlkfjk}) |
| 232 | + end |
| 233 | + end |
216 | 234 | end |
217 | 235 |
|
218 | 236 | describe '#install_fact_file' do |
|
0 commit comments