Skip to content

Commit e2e822b

Browse files
author
Kevin Paulisse
committed
Add additional test coverage for util/catalogs
1 parent c2e254f commit e2e822b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,23 @@ def valid?
290290
expect(result[:from].builder.to_s).to eq('OctocatalogDiff::Catalog::PuppetDB')
291291
expect(result[:to].builder.to_s).to eq('OctocatalogDiff::Catalog::JSON')
292292
end
293+
294+
it 'should raise OctocatalogDiff::Errors::CatalogError if either catalog fails' do
295+
options = {
296+
to_catalog: OctocatalogDiff::Spec.fixture_path('catalogs/tiny-catalog.json'),
297+
puppetdb_url: 'https://puppetdb.local',
298+
node: 'tiny-catalog-2-puppetdb',
299+
basedir: '/asdflkj/asdflkj/asldfjk',
300+
from_branch: 'foo',
301+
from_env: 'foo-env'
302+
}
303+
expect(OctocatalogDiff::PuppetDB).to receive(:new) { |*_arg| OctocatalogDiff::Mocks::PuppetDB.new }
304+
logger, logger_str = OctocatalogDiff::Spec.setup_logger
305+
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/)
308+
expect(logger_str.string).to match(/Failed build_catalog for foo-env/)
309+
end
293310
end
294311

295312
describe '#add_parallel_result' do

0 commit comments

Comments
 (0)