File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
spec/octocatalog-diff/tests Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ def validate_references
187
187
return
188
188
end
189
189
190
+ # Puppet 5 has reference validation built-in and enabled, so there won't even be a valid catalog if
191
+ # there were invalid references. It's pointless to perform validation of our own.
192
+ return if puppet_version && puppet_version >= '5.0.0'
193
+
190
194
# Iterate over all the resources and check each one that has one of the attributes being checked.
191
195
# Keep track of all references that are missing for ultimate inclusion in the error message.
192
196
missing = [ ]
Original file line number Diff line number Diff line change 463
463
expect ( result ) . to be_nil
464
464
end
465
465
466
+ it 'should not attempt reference validation under puppet 5' do
467
+ opts = {
468
+ compare_file_text : false ,
469
+ validate_references : %w( before notify require subscribe ) ,
470
+ node : 'my.rspec.node' ,
471
+ json : File . read ( OctocatalogDiff ::Spec . fixture_path ( 'catalogs/reference-validation-broken.json' ) )
472
+ }
473
+ catalog = OctocatalogDiff ::Catalog . new ( opts )
474
+ allow ( catalog ) . to receive ( :puppet_version ) . and_return ( '5.0.0' )
475
+ expect { catalog . validate_references } . not_to raise_error
476
+ end
477
+
466
478
it 'should raise error if reference validation is requested' do
467
479
opts = {
468
480
compare_file_text : false ,
471
483
json : File . read ( OctocatalogDiff ::Spec . fixture_path ( 'catalogs/reference-validation-broken.json' ) )
472
484
}
473
485
catalog = OctocatalogDiff ::Catalog . new ( opts )
486
+ allow ( catalog ) . to receive ( :puppet_version ) . and_return ( '4.10.0' )
474
487
catalog . compilation_dir = '/var/folders/dw/5ftmkqk972j_kw2fdjyzdqdw0000gn/T/d20161223-46780-x10xaf/environments/production'
475
488
error_str = [
476
489
'Catalog has broken references: exec[subscribe caller 1](modules/test/manifests/subscribe_callers.pp:2)' \
You can’t perform that action at this time.
0 commit comments