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

Support for data bags in Cookbooks under test #129

Closed
KAllan357 opened this issue May 28, 2013 · 6 comments
Closed

Support for data bags in Cookbooks under test #129

KAllan357 opened this issue May 28, 2013 · 6 comments

Comments

@KAllan357
Copy link

I have some logic in my LWRP that I'd like to test that requires a data bag. Usually I would accomplish this by setting chef.data_bags_path in my Vagrantfile.

@fnichol
Copy link
Contributor

fnichol commented May 29, 2013

I have some good news for you: data bags and roles are supported!

If you create a test/integration/data_bags/ directory then this will be used in your instance. Same goes for test/integration/roles/. If you have a suite called "server_only" and need special suite-specific data bags or roles, then put that data in test/integration/server_only/data_bags/ and test/integration/server_only/roles/. The more specific match will win and the shared version will be ignored.

The work in #124 will only apply to the parent directory for all cookbooks, not for other files and directories. The work underway in #128 changes strategy slightly to dump all files and directories needed for chef-* into a tmpdir before uploading everything in one shot to the instance. Data bags, roles, and encrypted data bag secret files are still supported as before.

Would it be useful to support a data_bags_path in the .kitchen.yml file in case you're pulling in data bags from another source?

Thanks!

@KAllan357
Copy link
Author

Thank you @fnichol, this is exactly what I needed.

I'm not sure if an additional path is necessary. I'm not sure what the use case would be for that. Feel free to close this ticket.

@ekrupnik
Copy link

I do believe that a "data_bags_path" and a "roles" path would be very useful to have - this way we can simply point to a location, instead of having to copy the data_bags and roles into "/test/integration/"

@fnichol
Copy link
Contributor

fnichol commented Jul 23, 2013

Excellent, @gondoi was kind enough to ship us an implementation in #161 which has landed in master! I'll close this out and please re-open if we've missed anything.

😎

@fnichol fnichol closed this as completed Jul 23, 2013
@ekrupnik
Copy link

Great - the custom paths are going to be a great help! However, I am running test-kitchen version 1.0.0.alpha.7 and that code is not in that version. What version would I have to install (gem install test-kitchen -v=____ )

@fnichol
Copy link
Contributor

fnichol commented Jul 24, 2013

@ekrupnik sorry, forgot to mention try: gem install test-kitchen -v=1.0.0.beta.1 or gem install test-kitchen --pre

@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants