|
80 | 80 | end
|
81 | 81 | end
|
82 | 82 |
|
| 83 | + # May be used to catalog-diff an upgrade from Hiera 3 to Hiera 5 |
| 84 | + context 'with --from-hiera-config and --to-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/hiera3-global.yaml', |
| 89 | + '--from-hiera-path', 'data', |
| 90 | + '--to-hiera-config', 'config/hiera5-global.yaml', |
| 91 | + '--to-hiera-path-strip', '/var/lib/puppet' |
| 92 | + ] |
| 93 | + hash = { |
| 94 | + spec_fact_file: 'facts.yaml', |
| 95 | + spec_repo: 'hiera5' |
| 96 | + } |
| 97 | + result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
| 98 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 99 | + expect(result.diffs.size).to eq(3) |
| 100 | + |
| 101 | + diff1 = { |
| 102 | + diff_type: '~', |
| 103 | + type: 'File', |
| 104 | + title: '/tmp/special', |
| 105 | + structure: %w(parameters content), |
| 106 | + old_value: 'Should not be displayed from common', |
| 107 | + new_value: 'Greets from special' |
| 108 | + } |
| 109 | + expect(OctocatalogDiff::Spec.diff_match?(result.diffs, diff1)).to eq(true) |
| 110 | + |
| 111 | + diff2 = { |
| 112 | + diff_type: '~', |
| 113 | + type: 'File', |
| 114 | + title: '/tmp/nodes', |
| 115 | + structure: %w(parameters content), |
| 116 | + old_value: 'Greets from data/nodes', |
| 117 | + new_value: 'Greets from nodes' |
| 118 | + } |
| 119 | + expect(OctocatalogDiff::Spec.diff_match?(result.diffs, diff2)).to eq(true) |
| 120 | + |
| 121 | + diff3 = { |
| 122 | + diff_type: '~', |
| 123 | + type: 'File', |
| 124 | + title: '/tmp/common', |
| 125 | + structure: %w(parameters content), |
| 126 | + old_value: 'Greets from data/common', |
| 127 | + new_value: 'Greets from common' |
| 128 | + } |
| 129 | + expect(OctocatalogDiff::Spec.diff_match?(result.diffs, diff3)).to eq(true) |
| 130 | + end |
| 131 | + end |
| 132 | + |
83 | 133 | # May be used to catalog-diff a migration from a global hiera file to an environment level one
|
84 | 134 | context 'with --from-hiera-config' do
|
85 | 135 | it 'should succeed in building the catalog and have proper diffs' do
|
|
0 commit comments