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 cookbooks #25

Closed
chris-rock opened this issue Dec 14, 2015 · 6 comments
Closed

Reuse the same test for multiple cookbooks #25

chris-rock opened this issue Dec 14, 2015 · 6 comments
Labels
Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Enhancement Adds new functionality.

Comments

@chris-rock
Copy link
Collaborator

@coderanger and @cheeseplus pointed out, that it is not possible to reuse test across different cookbooks easily. He used shared tests like: https://github.com/poise/poise-service-spechelper/blob/master/lib/poise_service/spec_helper/helper.rb
in
https://github.com/poise/poise-service/blob/master/test/integration/default/serverspec/default_spec.rb#L17

We need to find a way to solve this problem with kitchen-inspec. Possible ways:

  • write busser implementation
  • allow test-kitchen to load a remote test suite

Any other ideas?

@coderanger
Copy link
Contributor

Where does the inspec code itself actually run right now? My understanding is it is local on my workstation. If so, I can do the same trick but in the local Gemfile.

@chris-rock
Copy link
Collaborator Author

@coderanger Inspec is running where test-kitchen runs, therefore on your workstation. Since we face the problem at other areas as well eg. https://github.com/hardening-io would like to use the same test for Chef, Puppet and Ansible implementation. They currently use a Thor task to fetch the tests.

The way going forward from my perspective:

  • Step 1: Merge RFC: Compliance Profile Structure inspec#252 into InSpec This eases the way to write standalone test suites
  • Step 2: Add a feature to test-kitchen or kitchen-inspec to be able to load tests from a local directory or a remote directory.

Until Step 2 is done, I recommend to add shared test via a git submodule. I know, not perfect.

@coderanger
Copy link
Contributor

@chris-rock If you look at the linked stuff, the shared tests are already in an external gem that is shared between projects, so that isn't the issue. It sounds like this should work with the current kitchen-inspec structure, but it should probably be called out more that this is really different from busser-serverspec.

@chris-rock
Copy link
Collaborator Author

@coderanger I would like to ensure that we are able to solve your use case. I find your implementation is super cool, especially how you have done it with serverspec and rspec. We got a lot of requests regarding this use case to run shared tests. At the same time, I learned that most users are not advanced ruby developers. They just want to have one git repo with all the tests. They are not happy to being forced to push anything to ruby gems. On top the gem approach is may not be well suited for users who need to have everything in private.

I try to avoid to force users to write a gem for running shared tests. Would be very interested in your opinion.

@coderanger
Copy link
Contributor

Sure, my solution was driven entirely by that being the only way to get it done with busser-serverspec. What I would want to see if possible is the ability to pull tests from another cookbook as a core feature, but I'm not really sure where that would start.

@clintoncwolfe
Copy link
Contributor

We think this is almost certainly covered by inspec profile dependency resolution. Please re-open if discussion is needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Needs Information Indicates an issue needs more information in order to work on it. Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

4 participants