Rspec tests for containment based relationships?

asked 2014-10-31 16:38:32 -0600

cbarbour gravatar image

updated 2014-11-03 19:53:33 -0600

Is there a way to check the relationship between two resources based on the dependency graph rather than on explicit resource relationships?

rspec-puppet has relationship matchers, but they will only match an explicit relationship directly between two resources.

E.g: This will pass:

it { should contain_class('install').that_comes_before("Class['config']") }

But this will fail even if those two resources have an implicit relationship based upon class ordering.

it { should contain_package('httpd').that_comes_before("File['/etc/httpd/conf/httpd.conf']") }

Puppet its self includes relationship graph matchers, and while I can find examples of them being used in the Puppet spec tests, they do not have any documentation.

edit retag flag offensive close merge delete