|
2 | 2 |
|
3 | 3 | require_relative 'integration_helper' |
4 | 4 |
|
5 | | -OctocatalogDiff::Spec.require_path('/catalog') |
| 5 | +OctocatalogDiff::Spec.require_path('/catalog-diff/cli/catalogs') |
6 | 6 |
|
7 | 7 | describe 'preserve environments integration' do |
8 | 8 | context 'without --preserve-environments set' do |
9 | | - before(:all) do |
10 | | - @result = OctocatalogDiff::Integration.integration( |
11 | | - spec_fact_file: 'facts.yaml', |
12 | | - spec_repo: 'preserve-environments', |
13 | | - argv: [ |
14 | | - '-n', 'rspec-node.github.net', |
15 | | - '--retry-failed-catalog', '0' |
16 | | - ] |
17 | | - ) |
18 | | - end |
| 9 | + context 'without --environment set' do |
| 10 | + before(:all) do |
| 11 | + @result = OctocatalogDiff::Integration.integration( |
| 12 | + spec_fact_file: 'facts.yaml', |
| 13 | + spec_repo: 'preserve-environments', |
| 14 | + argv: [ |
| 15 | + '-n', 'rspec-node.github.net', |
| 16 | + '--retry-failed-catalog', '0' |
| 17 | + ] |
| 18 | + ) |
| 19 | + end |
| 20 | + |
| 21 | + it 'should exit with error status' do |
| 22 | + expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 23 | + end |
| 24 | + |
| 25 | + it 'should raise OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError' do |
| 26 | + expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 27 | + end |
19 | 28 |
|
20 | | - it 'should exit with error status' do |
21 | | - expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 29 | + it 'should fail because ::bar could not be located' do |
| 30 | + expect(@result.exception.message).to match(/Could not find class ::bar for rspec-node.github.net/) |
| 31 | + end |
22 | 32 | end |
23 | 33 |
|
24 | | - it 'should raise OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError' do |
25 | | - expect(@result.exception).to be_a_kind_of(OctocatalogDiff::CatalogDiff::Cli::Catalogs::CatalogError) |
| 34 | + context 'with --environment set' do |
| 35 | + before(:all) do |
| 36 | + @result = OctocatalogDiff::Integration.integration( |
| 37 | + spec_fact_file: 'facts.yaml', |
| 38 | + spec_repo_old: 'default', |
| 39 | + argv: [ |
| 40 | + '-n', 'rspec-node.github.net', |
| 41 | + '--environment', 'asdfgh', |
| 42 | + '--to-catalog', OctocatalogDiff::Spec.fixture_path('catalogs/default-catalog-v4.json'), |
| 43 | + '--hiera-config', 'environments/production/config/hiera.yaml', |
| 44 | + '--hiera-path-strip', '/var/lib/puppet' |
| 45 | + ] |
| 46 | + ) |
| 47 | + end |
| 48 | + |
| 49 | + it 'should exit without error' do |
| 50 | + expect(@result.exitcode).to eq(0), OctocatalogDiff::Integration.format_exception(@result) |
| 51 | + expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 52 | + end |
| 53 | + |
| 54 | + it 'should log warning about --environment being useless in this context' do |
| 55 | + expect(@result.logs).to match(/WARN -- : --environment is ignored unless --preserve-environment is used/) |
| 56 | + end |
26 | 57 | end |
27 | 58 |
|
28 | | - it 'should fail because ::bar could not be located' do |
29 | | - expect(@result.exception.message).to match(/Could not find class ::bar for rspec-node.github.net/) |
| 59 | + context 'with --create-symlinks set' do |
| 60 | + before(:all) do |
| 61 | + @result = OctocatalogDiff::Integration.integration( |
| 62 | + spec_fact_file: 'facts.yaml', |
| 63 | + spec_repo_old: 'default', |
| 64 | + argv: [ |
| 65 | + '-n', 'rspec-node.github.net', |
| 66 | + '--create-symlinks', 'asdfgh,asldfk', |
| 67 | + '--to-catalog', OctocatalogDiff::Spec.fixture_path('catalogs/default-catalog-v4.json'), |
| 68 | + '--hiera-config', 'environments/production/config/hiera.yaml', |
| 69 | + '--hiera-path-strip', '/var/lib/puppet' |
| 70 | + ] |
| 71 | + ) |
| 72 | + end |
| 73 | + |
| 74 | + it 'should exit without error' do |
| 75 | + expect(@result.exitcode).to eq(0), OctocatalogDiff::Integration.format_exception(@result) |
| 76 | + expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) |
| 77 | + end |
| 78 | + |
| 79 | + it 'should log warning about --create-symlinks being useless in this context' do |
| 80 | + expect(@result.logs).to match(/WARN -- : --create-symlinks is ignored unless --preserve-environment is used/) |
| 81 | + end |
30 | 82 | end |
31 | 83 | end |
32 | 84 |
|
|
0 commit comments