Skip to content

Commit

Permalink
(PDK-508) Prove that autorelations are working with puppet
Browse files Browse the repository at this point in the history
This test shows that the autorelations implementation of the Resource
API does build relations. Since rspec-puppet doesn't provide matching
on compile errors, this builds a test case that compiles when make_cycle
is false, thereby proving that there is no error in the manifest, but
fails with a dependency cycle error when make_cycle is set to true.
  • Loading branch information
DavidS committed Mar 9, 2018
1 parent b40c812 commit b2ea82d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions spec/classes/autorequire_cycle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@

it { is_expected.to compile }
end
context 'with make_cycle => true' do
let(:params) { { make_cycle: true } }

it { is_expected.not_to compile }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
target: {
type: 'String',
desc: 'The resource to autorequire.',
behaviour: :namevar,
behaviour: :parameter,
},
},
autorequire: {
Expand Down
10 changes: 9 additions & 1 deletion spec/fixtures/test_module/manifests/autorequire_cycle.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,13 @@
class test_module::autorequire_cycle (
Boolean $make_cycle
) {

test_autorequire { "a":
target => "b",
}
test_autorequire { "b":
target => "c",
}
test_autorequire { "c":
target => $make_cycle ? { true => "a", false => undef },
}
}

0 comments on commit b2ea82d

Please sign in to comment.