diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/hieradata/roles/all.yaml b/spec/octocatalog-diff/fixtures/repos/reference-validation/hieradata/roles/all.yaml new file mode 100644 index 0000000..a1d0887 --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/hieradata/roles/all.yaml @@ -0,0 +1,10 @@ +--- + classes: + - test::before_callers + - test::before_targets + - test::notify_callers + - test::notify_targets + - test::require_callers + - test::require_targets + - test::subscribe_callers + - test::subscribe_targets diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/before_callers.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/before_callers.pp new file mode 100644 index 0000000..3c78088 --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/before_callers.pp @@ -0,0 +1,6 @@ +class test::before_callers { + exec { 'before caller': + command => '/bin/true', + before => Exec['before target'], + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/before_targets.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/before_targets.pp new file mode 100644 index 0000000..7321dbb --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/before_targets.pp @@ -0,0 +1,5 @@ +class test::before_targets { + exec { 'before target': + command => '/bin/true', + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/init.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/init.pp index ff8f882..2df24f6 100644 --- a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/init.pp +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/init.pp @@ -4,21 +4,4 @@ class test { file { '/tmp/test-main': content => 'it works', } - - # Targets for require, before, subscribe, notify - exec { 'target 1': - command => '/bin/true', - } - - exec { 'target 2': - command => '/bin/true', - } - - exec { 'target 3': - command => '/bin/true', - } - - exec { 'target 4': - command => '/bin/true', - } } diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/notify_callers.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/notify_callers.pp new file mode 100644 index 0000000..bf12d3c --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/notify_callers.pp @@ -0,0 +1,6 @@ +class test::notify_callers { + exec { 'notify caller': + command => '/bin/true', + notify => Exec['notify target'], + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/notify_targets.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/notify_targets.pp new file mode 100644 index 0000000..825f97b --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/notify_targets.pp @@ -0,0 +1,5 @@ +class test::notify_targets { + exec { 'notify target': + command => '/bin/true', + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/require_callers.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/require_callers.pp new file mode 100644 index 0000000..3d56bd6 --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/require_callers.pp @@ -0,0 +1,6 @@ +class test::require_callers { + exec { 'require caller': + command => '/bin/true', + require => Exec['require target'], + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/require_targets.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/require_targets.pp new file mode 100644 index 0000000..e2b60cb --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/require_targets.pp @@ -0,0 +1,5 @@ +class test::require_targets { + exec { 'require target': + command => '/bin/true', + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/subscribe_callers.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/subscribe_callers.pp new file mode 100644 index 0000000..22bf27e --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/subscribe_callers.pp @@ -0,0 +1,6 @@ +class test::subscribe_callers { + exec { 'subscribe caller': + command => '/bin/true', + subscribe => Exec['subscribe target'], + } +} diff --git a/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/subscribe_targets.pp b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/subscribe_targets.pp new file mode 100644 index 0000000..492fadc --- /dev/null +++ b/spec/octocatalog-diff/fixtures/repos/reference-validation/modules/test/manifests/subscribe_targets.pp @@ -0,0 +1,5 @@ +class test::subscribe_targets { + exec { 'subscribe target': + command => '/bin/true', + } +} diff --git a/spec/octocatalog-diff/integration/reference_validation_spec.rb b/spec/octocatalog-diff/integration/reference_validation_spec.rb index 6fdfc38..a36609e 100644 --- a/spec/octocatalog-diff/integration/reference_validation_spec.rb +++ b/spec/octocatalog-diff/integration/reference_validation_spec.rb @@ -41,7 +41,16 @@ end describe 'validation of references' do context 'with valid catalog' do - it 'should not throw error' do + before(:all) do + @result = OctocatalogDiff::Spec.reference_validation_catalog('all', %w(before require subscribe notify)) + end + + it 'should succeed' do + expect(@result.exitcode).to eq(2) + end + + it 'should not raise any exceptions' do + expect(@result.exception).to be_nil, OctocatalogDiff::Integration.format_exception(@result) end end