|
68 | 68 | end
|
69 | 69 | end
|
70 | 70 | end
|
| 71 | + |
| 72 | + context 'with hiera 5 non-global, environment specific configuration' do |
| 73 | + if ENV['PUPPET_VERSION'].start_with?('3') |
| 74 | + it 'should run but not use hiera values under puppet 3' do |
| 75 | + argv = ['-n', 'rspec-node.github.net'] |
| 76 | + hash = { |
| 77 | + spec_fact_file: 'facts.yaml', |
| 78 | + spec_repo: 'hiera5', |
| 79 | + spec_catalog_old: 'catalog-empty.json' |
| 80 | + } |
| 81 | + result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
| 82 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 83 | + |
| 84 | + to_catalog = result.to |
| 85 | + |
| 86 | + param1 = { 'content' => 'hard-coded' } |
| 87 | + expect(to_catalog.resource(type: 'File', title: '/tmp/nodes')['parameters']).to eq(param1) |
| 88 | + |
| 89 | + param2 = { 'content' => 'hard-coded' } |
| 90 | + expect(to_catalog.resource(type: 'File', title: '/tmp/special')['parameters']).to eq(param2) |
| 91 | + |
| 92 | + param3 = { 'content' => 'hard-coded' } |
| 93 | + expect(to_catalog.resource(type: 'File', title: '/tmp/common')['parameters']).to eq(param3) |
| 94 | + end |
| 95 | + else |
| 96 | + it 'should succeed in building the catalog' do |
| 97 | + argv = ['-n', 'rspec-node.github.net'] |
| 98 | + hash = { |
| 99 | + spec_fact_file: 'facts.yaml', |
| 100 | + spec_repo: 'hiera5', |
| 101 | + spec_catalog_old: 'catalog-empty.json' |
| 102 | + } |
| 103 | + result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
| 104 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 105 | + |
| 106 | + to_catalog = result.to |
| 107 | + |
| 108 | + param1 = { 'content' => 'Greets from nodes' } |
| 109 | + expect(to_catalog.resource(type: 'File', title: '/tmp/nodes')['parameters']).to eq(param1) |
| 110 | + |
| 111 | + param2 = { 'content' => 'Greets from special' } |
| 112 | + expect(to_catalog.resource(type: 'File', title: '/tmp/special')['parameters']).to eq(param2) |
| 113 | + |
| 114 | + param3 = { 'content' => 'Greets from common' } |
| 115 | + expect(to_catalog.resource(type: 'File', title: '/tmp/common')['parameters']).to eq(param3) |
| 116 | + end |
| 117 | + end |
| 118 | + end |
71 | 119 | end
|
0 commit comments