Search code examples
chef-infratest-kitchenserverspec

In chef, is it possible to include serverspec tests of one cookbook into another cookbook?


Consider this, I have two cookbooks A and B with each having their own integration testing using serverspec tests and kitchen. Everything works fine if I want to test just one cookbook against its own test suites. Now, if I create a cookbook C that include cookbook A and B along with its own implementation and corresponding integration testing code. Can I reuse the serverspec tests of A and B in C's serverspec tests?


Solution

  • Not currently, other than some manual require '../../../../othercookbook/test/integration/default/serverspec/other_spec' or similar wonkiness which will depend on the precise folder layout you happen to use.

    InSpec makes this a bit easier, as both cookbooks could use a single, shared InSpec test profile.