|
20 | 20 | end
|
21 | 21 |
|
22 | 22 | context 'with --hiera-path-strip and per-item data directory' do
|
23 |
| - it 'should succeed in building the catalog' do |
24 |
| - argv = ['-n', 'rspec-node.github.net', '--hiera-path-strip', '/var/lib/puppet'] |
25 |
| - hash = { |
26 |
| - hiera_config: 'config/hiera5-global.yaml', |
27 |
| - spec_fact_file: 'facts.yaml', |
28 |
| - spec_repo: 'hiera5', |
29 |
| - spec_catalog_old: 'catalog-empty.json' |
30 |
| - } |
31 |
| - result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
32 |
| - expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 23 | + if ENV['PUPPET_VERSION'].start_with?('3') |
| 24 | + it 'should run but not use hiera values under puppet 3' do |
| 25 | + argv = ['-n', 'rspec-node.github.net', '--hiera-path-strip', '/var/lib/puppet'] |
| 26 | + hash = { |
| 27 | + hiera_config: 'config/hiera5-global.yaml', |
| 28 | + spec_fact_file: 'facts.yaml', |
| 29 | + spec_repo: 'hiera5', |
| 30 | + spec_catalog_old: 'catalog-empty.json' |
| 31 | + } |
| 32 | + result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
| 33 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 34 | + |
| 35 | + to_catalog = result.to |
| 36 | + |
| 37 | + param1 = { 'content' => 'hard-coded' } |
| 38 | + expect(to_catalog.resource(type: 'File', title: '/tmp/nodes')['parameters']).to eq(param1) |
| 39 | + |
| 40 | + param2 = { 'content' => 'hard-coded' } |
| 41 | + expect(to_catalog.resource(type: 'File', title: '/tmp/special')['parameters']).to eq(param2) |
| 42 | + |
| 43 | + param3 = { 'content' => 'hard-coded' } |
| 44 | + expect(to_catalog.resource(type: 'File', title: '/tmp/common')['parameters']).to eq(param3) |
| 45 | + end |
| 46 | + else |
| 47 | + it 'should succeed in building the catalog' do |
| 48 | + argv = ['-n', 'rspec-node.github.net', '--hiera-path-strip', '/var/lib/puppet'] |
| 49 | + hash = { |
| 50 | + hiera_config: 'config/hiera5-global.yaml', |
| 51 | + spec_fact_file: 'facts.yaml', |
| 52 | + spec_repo: 'hiera5', |
| 53 | + spec_catalog_old: 'catalog-empty.json' |
| 54 | + } |
| 55 | + result = OctocatalogDiff::Integration.integration(hash.merge(argv: argv)) |
| 56 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
33 | 57 |
|
34 |
| - to_catalog = result.to |
| 58 | + to_catalog = result.to |
35 | 59 |
|
36 |
| - param1 = { 'content' => 'Greets from nodes' } |
37 |
| - expect(to_catalog.resource(type: 'File', title: '/tmp/nodes')['parameters']).to eq(param1) |
| 60 | + param1 = { 'content' => 'Greets from nodes' } |
| 61 | + expect(to_catalog.resource(type: 'File', title: '/tmp/nodes')['parameters']).to eq(param1) |
38 | 62 |
|
39 |
| - param2 = { 'content' => 'Greets from special' } |
40 |
| - expect(to_catalog.resource(type: 'File', title: '/tmp/special')['parameters']).to eq(param2) |
| 63 | + param2 = { 'content' => 'Greets from special' } |
| 64 | + expect(to_catalog.resource(type: 'File', title: '/tmp/special')['parameters']).to eq(param2) |
41 | 65 |
|
42 |
| - param3 = { 'content' => 'Greets from common' } |
43 |
| - expect(to_catalog.resource(type: 'File', title: '/tmp/common')['parameters']).to eq(param3) |
| 66 | + param3 = { 'content' => 'Greets from common' } |
| 67 | + expect(to_catalog.resource(type: 'File', title: '/tmp/common')['parameters']).to eq(param3) |
| 68 | + end |
44 | 69 | end
|
45 | 70 | end
|
46 | 71 | end
|
0 commit comments