|
19 | 19 | end
|
20 | 20 | end
|
21 | 21 |
|
22 |
| - if ENV['PUPPET_VERSION'].start_with?('3') |
| 22 | + if ENV['PUPPET_VERSION'] && ENV['PUPPET_VERSION'].start_with?('3') |
23 | 23 | # Hiera 5 tests are not applicable
|
24 | 24 | else
|
25 | 25 | context 'with --hiera-path-strip and per-item data directory' do
|
|
79 | 79 | expect(to_catalog.resource(type: 'File', title: '/tmp/extra-special')['parameters']).to eq(param4)
|
80 | 80 | end
|
81 | 81 | end
|
| 82 | + |
| 83 | + # May be used to catalog-diff a migration from a global hiera file to an environment level one |
| 84 | + context 'with --from-hiera-config' do |
| 85 | + it 'should succeed in building the catalog and have proper diffs' do |
| 86 | + argv = [ |
| 87 | + '-n', 'rspec-node.github.net', |
| 88 | + '--from-hiera-config', 'config/hiera5-global.yaml', |
| 89 | + '--from-hiera-path-strip', '/var/lib/puppet' |
| 90 | + ] |
| 91 | + hash = { |
| 92 | + spec_fact_file: 'facts.yaml', |
| 93 | + spec_repo: 'hiera5' |
| 94 | + } |
| 95 | + result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
| 96 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 97 | + expect(result.diffs.size).to eq(2) |
| 98 | + |
| 99 | + diff1 = { |
| 100 | + diff_type: '~', |
| 101 | + type: 'File', |
| 102 | + title: '/tmp/common', |
| 103 | + structure: %w(parameters content), |
| 104 | + old_value: 'Greets from common', |
| 105 | + new_value: 'Greets from data/common' |
| 106 | + } |
| 107 | + expect(OctocatalogDiff::Spec.diff_match?(result.diffs, diff1)).to eq(true) |
| 108 | + |
| 109 | + diff2 = { |
| 110 | + diff_type: '~', |
| 111 | + type: 'File', |
| 112 | + title: '/tmp/nodes', |
| 113 | + structure: %w(parameters content), |
| 114 | + old_value: 'Greets from nodes', |
| 115 | + new_value: 'Greets from data/nodes' |
| 116 | + } |
| 117 | + expect(OctocatalogDiff::Spec.diff_match?(result.diffs, diff2)).to eq(true) |
| 118 | + end |
| 119 | + end |
82 | 120 | end
|
83 | 121 | end
|
0 commit comments