File tree Expand file tree Collapse file tree
spec/octocatalog-diff/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ def validate_references
187187 return
188188 end
189189
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+
190194 # Iterate over all the resources and check each one that has one of the attributes being checked.
191195 # Keep track of all references that are missing for ultimate inclusion in the error message.
192196 missing = [ ]
Original file line number Diff line number Diff line change 463463 expect ( result ) . to be_nil
464464 end
465465
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+
466478 it 'should raise error if reference validation is requested' do
467479 opts = {
468480 compare_file_text : false ,
471483 json : File . read ( OctocatalogDiff ::Spec . fixture_path ( 'catalogs/reference-validation-broken.json' ) )
472484 }
473485 catalog = OctocatalogDiff ::Catalog . new ( opts )
486+ allow ( catalog ) . to receive ( :puppet_version ) . and_return ( '4.10.0' )
474487 catalog . compilation_dir = '/var/folders/dw/5ftmkqk972j_kw2fdjyzdqdw0000gn/T/d20161223-46780-x10xaf/environments/production'
475488 error_str = [
476489 '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