|
1 | 1 | require_relative '../spec_helper' |
2 | | -require_relative '../../lib/puppet-check/regression_check' |
| 2 | +begin |
| 3 | + require_relative '../../lib/puppet-check/regression_check' |
3 | 4 |
|
4 | | -# once a good config is loaded, bad configs would have no effect so failures are tested first; config is also tested before compilation so that the good config can be loaded at the end and used for compilation and regression tests |
5 | | -describe RegressionCheck do |
6 | | - context '.config' do |
7 | | - # json gem got messed up for the EOL Ruby versions |
8 | | - it 'raise an appropriate error if the file is malformed' do |
9 | | - expect { RegressionCheck.config("#{fixtures_dir}metadata.json") }.to raise_error(OctocatalogDiff::Errors::ConfigurationFileContentError, 'Configuration must define OctocatalogDiff::Config!') |
10 | | - end |
11 | | - it 'loads in a good octocatalog-diff config file' do |
12 | | - expect { RegressionCheck.config("#{octocatalog_diff_dir}octocatalog_diff.cfg.rb") }.not_to raise_exception |
13 | | - end |
14 | | - it 'loads in the settings from the file correctly' do |
15 | | - # TODO |
| 5 | + # once a good config is loaded, bad configs would have no effect so failures are tested first; config is also tested before compilation so that the good config can be loaded at the end and used for compilation and regression tests |
| 6 | + describe RegressionCheck do |
| 7 | + context '.config' do |
| 8 | + # json gem is messed up for the EOL Ruby versions |
| 9 | + it 'raise an appropriate error if the file is malformed' do |
| 10 | + expect { RegressionCheck.config("#{fixtures_dir}metadata.json") }.to raise_error(OctocatalogDiff::Errors::ConfigurationFileContentError, 'Configuration must define OctocatalogDiff::Config!') |
| 11 | + end |
| 12 | + it 'loads in a good octocatalog-diff config file' do |
| 13 | + expect { RegressionCheck.config("#{octocatalog_diff_dir}octocatalog_diff.cfg.rb") }.not_to raise_exception |
| 14 | + end |
| 15 | + it 'loads in the settings from the file correctly' do |
| 16 | + # TODO |
| 17 | + end |
16 | 18 | end |
17 | | - end |
18 | 19 |
|
19 | | - context '.smoke' do |
20 | | - # octocatalog-diff is returning a blank error for these tests |
21 | | - unless ENV['CIRCLECI'] == 'true' || ENV['GITHUB_ACTIONS'] == 'true' |
22 | | - it 'returns a pass for a successful catalog compilation' do |
23 | | - expect { RegressionCheck.smoke(['good.example.com'], "#{octocatalog_diff_dir}octocatalog_diff.cfg.rb") }.not_to raise_exception |
| 20 | + context '.smoke' do |
| 21 | + # octocatalog-diff is returning a blank error for these tests |
| 22 | + unless ENV['CIRCLECI'] == 'true' || ENV['GITHUB_ACTIONS'] == 'true' |
| 23 | + it 'returns a pass for a successful catalog compilation' do |
| 24 | + expect { RegressionCheck.smoke(['good.example.com'], "#{octocatalog_diff_dir}octocatalog_diff.cfg.rb") }.not_to raise_exception |
| 25 | + end |
| 26 | + it 'returns a failure for a catalog with an error' do |
| 27 | + expect { RegressionCheck.smoke(['does_not_exist.example.com'], "#{octocatalog_diff_dir}octocatalog_diff.cfg.rb") }.to raise_error(OctocatalogDiff::Errors::CatalogError) |
| 28 | + end |
24 | 29 | end |
25 | | - it 'returns a failure for a catalog with an error' do |
26 | | - expect { RegressionCheck.smoke(['does_not_exist.example.com'], "#{octocatalog_diff_dir}octocatalog_diff.cfg.rb") }.to raise_error(OctocatalogDiff::Errors::CatalogError) |
| 30 | + it 'returns a failure for a good and bad catalog' do |
| 31 | + # RegressionCheck.smoke(['good.example.com', 'syntax_error.example.com'], "#{fixtures_dir}octocatalog_diff.cfg.rb") |
27 | 32 | end |
28 | 33 | end |
29 | | - it 'returns a failure for a good and bad catalog' do |
30 | | - # RegressionCheck.smoke(['good.example.com', 'syntax_error.example.com'], "#{fixtures_dir}octocatalog_diff.cfg.rb") |
31 | | - end |
32 | | - end |
33 | 34 |
|
34 | | - context '.regression' do |
35 | | - # TODO |
| 35 | + context '.regression' do |
| 36 | + # TODO |
| 37 | + end |
36 | 38 | end |
| 39 | +rescue NameError |
| 40 | + puts 'octocatalog-diff is not installed, and its unit tests will be skipped' |
37 | 41 | end |
0 commit comments