Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse the same test for multiple test suites in one cookbook #97

Closed
ceilfors opened this issue Aug 19, 2016 · 5 comments
Closed

Reuse the same test for multiple test suites in one cookbook #97

ceilfors opened this issue Aug 19, 2016 · 5 comments
Labels
Type: Enhancement Adds new functionality.
Milestone

Comments

@ceilfors
Copy link

Generated from inspec/inspec#338
Depends on inspec/inspec#719

ServerSpec is supporting test reusability and customisability via shared_examples. An example from elasticsearch cookbook:

@chris-rock
Copy link
Collaborator

@ceilfors We need to add attributes support into kitchen-inspec. Instead of having a separate attributes yml file, those should be defined in kitchen.yml

@chris-rock
Copy link
Collaborator

See inspec/inspec#719

ceilfors added a commit to ceilfors/cookbook-opengrok that referenced this issue Aug 26, 2016
@chris-rock chris-rock added this to the 0.16.0 milestone Oct 31, 2016
@kbaltrinic
Copy link

kbaltrinic commented Apr 25, 2017

+1 for this. We have lots of server cookbooks with an "active" and "standby" suite where 90% of the configuration and hence the tests for active vs standby servers is the same. So obviously we would like to use the same tests for both suites to cover that 90%. Similar situations for primary vs secondary servers in a cluster, etc.

@xmik
Copy link

xmik commented May 19, 2017

For now we can use: https://github.com/chef/kitchen-inspec/blob/master/README.md#use-remote-inspec-profiles . E.g. keep test/integration/helpers directory, as previously with serverspec. Then, put all the common tests into test/integration/helpers/inspec/ and in .kitchen.yml use:

verifier:
  name: inspec
  sudo: true
  inspec_tests:
    - path: test/integration/helpers/inspec

This takes care, that in addition to running the tests for a current suite, tests from test/integration/helpers/inspec are run too (for each suite).

@adamleff
Copy link
Contributor

kitchen-inspec now supports passing of attributes to the profiles, and inspec_tests can be configured per suite if needed. There are no currently plans to support the "shared examples" model. If there are use cases where you folks feel that's necessary, please log an issue on the chef/inspec project as that would be a feature of InSpec itself, not the kitchen verifier plugin. Thank you!

@tas50 tas50 added Type: Enhancement Adds new functionality. and removed enhancement labels Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

6 participants