|
231 | 231 | expect(logger_str.string).to match(%r{WARNING: Hiera datadir for yaml.+/environments/production/aksdfjlkfjk}) |
232 | 232 | end |
233 | 233 | end |
| 234 | + |
| 235 | + context 'using other backends' do |
| 236 | + it 'should rewrite all datadir' do |
| 237 | + options = default_options.merge( |
| 238 | + hiera_config: OctocatalogDiff::Spec.fixture_path('repos/default/config/hiera-other-backends.yaml'), |
| 239 | + hiera_path: 'hieradata' |
| 240 | + ) |
| 241 | + logger, logger_str = OctocatalogDiff::Spec.setup_logger |
| 242 | + testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger) |
| 243 | + hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml') |
| 244 | + expect(File.file?(hiera_yaml)).to eq(true) |
| 245 | + hiera_cfg = YAML.load_file(hiera_yaml) |
| 246 | + expect(hiera_cfg[:backends]).to eq(%w(eyaml yaml json)) |
| 247 | + expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata')) |
| 248 | + expect(hiera_cfg[:eyaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata')) |
| 249 | + expect(hiera_cfg[:json]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata')) |
| 250 | + expect(logger_str.string).not_to match(/Hiera datadir for yaml doesn't seem to exist/) |
| 251 | + expect(logger_str.string).not_to match(/Hiera datadir for eyaml doesn't seem to exist/) |
| 252 | + expect(logger_str.string).not_to match(/Hiera datadir for json doesn't seem to exist/) |
| 253 | + end |
| 254 | + end |
234 | 255 | end |
235 | 256 |
|
236 | 257 | describe '#install_fact_file' do |
|
0 commit comments