Skip to content

Commit 9181834

Browse files
committed
All reference validation errors are now catalog errors
1 parent 6b94432 commit 9181834

File tree

2 files changed

+20
-41
lines changed

2 files changed

+20
-41
lines changed

lib/octocatalog-diff/errors.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class ConfigurationFileContentError < RuntimeError; end
1111
class BootstrapError < RuntimeError; end
1212
class CatalogError < RuntimeError; end
1313
class PuppetVersionError < RuntimeError; end
14-
class ReferenceValidationError < RuntimeError; end
1514
class GitCheckoutError < RuntimeError; end
1615

1716
# Error classes for retrieving facts

spec/octocatalog-diff/integration/reference_validation_spec.rb

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,16 @@ def self.catalog_contains_resource(result, type, title)
102102
expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result)
103103
end
104104

105-
if OctocatalogDiff::Spec.is_puppet5?
106-
it 'should raise CatalogError' do
107-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
108-
end
105+
it 'should raise CatalogError' do
106+
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
107+
end
109108

109+
if OctocatalogDiff::Spec.is_puppet5?
110110
it 'should pass through the error messages from Puppet' do
111111
msg = @result.exception.message
112112
expect(msg).to match(/Error: Could not find resource 'Exec\[subscribe target\]' in parameter 'subscribe' at/)
113113
end
114114
else
115-
it 'should raise ReferenceValidationError' do
116-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::ReferenceValidationError)
117-
end
118-
119115
# Multiple line numbers given because Puppet 4.x and 3.8 correspond to first and last line of resource, respectively.
120116
# rubocop:disable Metrics/LineLength
121117
it 'should have formatted error messages' do
@@ -139,20 +135,16 @@ def self.catalog_contains_resource(result, type, title)
139135
expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result)
140136
end
141137

142-
if OctocatalogDiff::Spec.is_puppet5?
143-
it 'should raise CatalogError' do
144-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
145-
end
138+
it 'should raise CatalogError' do
139+
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
140+
end
146141

142+
if OctocatalogDiff::Spec.is_puppet5?
147143
it 'should pass through the error messages from Puppet' do
148144
msg = @result.exception.message
149145
expect(msg).to match(/Error: Could not find resource 'Exec\[before target\]' in parameter 'before' at/)
150146
end
151147
else
152-
it 'should raise ReferenceValidationError' do
153-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::ReferenceValidationError)
154-
end
155-
156148
# rubocop:disable Metrics/LineLength
157149
it 'should have formatted error messages' do
158150
msg = @result.exception.message
@@ -171,20 +163,16 @@ def self.catalog_contains_resource(result, type, title)
171163
expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result)
172164
end
173165

174-
if OctocatalogDiff::Spec.is_puppet5?
175-
it 'should raise CatalogError' do
176-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
177-
end
166+
it 'should raise CatalogError' do
167+
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
168+
end
178169

170+
if OctocatalogDiff::Spec.is_puppet5?
179171
it 'should pass through the error messages from Puppet' do
180172
msg = @result.exception.message
181173
expect(msg).to match(/Error: Could not find resource 'Test::Foo::Bar\[notify target\]' in parameter 'notify' at/)
182174
end
183175
else
184-
it 'should raise ReferenceValidationError' do
185-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::ReferenceValidationError)
186-
end
187-
188176
# rubocop:disable Metrics/LineLength
189177
it 'should have formatted error messages' do
190178
msg = @result.exception.message
@@ -203,20 +191,16 @@ def self.catalog_contains_resource(result, type, title)
203191
expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result)
204192
end
205193

206-
if OctocatalogDiff::Spec.is_puppet5?
207-
it 'should raise CatalogError' do
208-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
209-
end
194+
it 'should raise CatalogError' do
195+
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
196+
end
210197

198+
if OctocatalogDiff::Spec.is_puppet5?
211199
it 'should pass through the error messages from Puppet' do
212200
msg = @result.exception.message
213201
expect(msg).to match(/Error: Could not find resource 'Exec\[require target\]' in parameter 'require' at/)
214202
end
215203
else
216-
it 'should raise ReferenceValidationError' do
217-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::ReferenceValidationError)
218-
end
219-
220204
# rubocop:disable Metrics/LineLength
221205
it 'should have formatted error messages' do
222206
msg = @result.exception.message
@@ -287,20 +271,16 @@ def self.catalog_contains_resource(result, type, title)
287271
expect(@result.exitcode).to eq(-1), OctocatalogDiff::Integration.format_exception(@result)
288272
end
289273

290-
if OctocatalogDiff::Spec.is_puppet5?
291-
it 'should raise CatalogError' do
292-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
293-
end
274+
it 'should raise CatalogError' do
275+
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::CatalogError)
276+
end
294277

278+
if OctocatalogDiff::Spec.is_puppet5?
295279
it 'should pass through the error messages from Puppet' do
296280
msg = @result.exception.message
297281
expect(msg).to match(/Error: Could not find resource 'Exec\[before alias target\]' in parameter 'before'/)
298282
end
299283
else
300-
it 'should raise ReferenceValidationError' do
301-
expect(@result.exception).to be_a_kind_of(OctocatalogDiff::Errors::ReferenceValidationError)
302-
end
303-
304284
# rubocop:disable Metrics/LineLength
305285
it 'should have formatted error messages' do
306286
msg = @result.exception.message

0 commit comments

Comments
 (0)