Skip to content

Commit 30a0a1d

Browse files
committed
skip regression check unit tests if octo-diff absent
1 parent 69be75a commit 30a0a1d

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed
Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
require_relative '../spec_helper'
2-
require_relative '../../lib/puppet-check/regression_check'
2+
begin
3+
require_relative '../../lib/puppet-check/regression_check'
34

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
1618
end
17-
end
1819

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
2429
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")
2732
end
2833
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
3334

34-
context '.regression' do
35-
# TODO
35+
context '.regression' do
36+
# TODO
37+
end
3638
end
39+
rescue NameError
40+
puts 'octocatalog-diff is not installed, and its unit tests will be skipped'
3741
end

0 commit comments

Comments
 (0)