Skip to content

Commit 2fc2b20

Browse files
author
Kevin Paulisse
committed
Finish test for catalogs
1 parent e2e822b commit 2fc2b20

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

lib/octocatalog-diff/util/catalogs.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ def build_catalog_parallelizer
115115
# Things have succeeded if the :to and :from catalogs exist at this point. If not, things have
116116
# failed, and an exception should be thrown.
117117
return result if result.key?(:to) && result.key?(:from)
118+
119+
# This is believed to be a bug condition.
120+
# :nocov:
118121
raise OctocatalogDiff::Errors::CatalogError, 'One or more catalogs failed to compile.'
122+
# :nocov:
119123
end
120124

121125
# Get catalog compilation tasks.

spec/octocatalog-diff/tests/util/catalogs_spec.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,18 @@ def valid?
294294
it 'should raise OctocatalogDiff::Errors::CatalogError if either catalog fails' do
295295
options = {
296296
to_catalog: OctocatalogDiff::Spec.fixture_path('catalogs/tiny-catalog.json'),
297-
puppetdb_url: 'https://puppetdb.local',
297+
from_fact_file: OctocatalogDiff::Spec.fixture_path('facts/facts.yaml'),
298+
bootstrapped_from_dir: OctocatalogDiff::Spec.fixture_path('repos/failing-catalog'),
298299
node: 'tiny-catalog-2-puppetdb',
299-
basedir: '/asdflkj/asdflkj/asldfjk',
300300
from_branch: 'foo',
301-
from_env: 'foo-env'
301+
from_env: 'foo-env',
302+
puppet_binary: OctocatalogDiff::Spec::PUPPET_BINARY
302303
}
303-
expect(OctocatalogDiff::PuppetDB).to receive(:new) { |*_arg| OctocatalogDiff::Mocks::PuppetDB.new }
304304
logger, logger_str = OctocatalogDiff::Spec.setup_logger
305305
testobj = OctocatalogDiff::Util::Catalogs.new(options, logger)
306-
expect { testobj.send(:build_catalog_parallelizer) }.to raise_error(OctocatalogDiff::Errors::CatalogError)
307-
expect(logger_str.string).to match(/Failed build_catalog for foo-env: OctocatalogDiff::Errors::FactRetrievalError/)
306+
expect do
307+
testobj.send(:build_catalog_parallelizer)
308+
end.to raise_error(OctocatalogDiff::Errors::CatalogError)
308309
expect(logger_str.string).to match(/Failed build_catalog for foo-env/)
309310
end
310311
end

0 commit comments

Comments
 (0)