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

pre_create_command #249

Closed
wants to merge 1 commit into from
Closed

pre_create_command #249

wants to merge 1 commit into from

Conversation

merrykju
Copy link

kitchen-vagrant allows to run shell command prior to the creation of the VM. Here's an adaptation of its pre_create_command option for kitchen-docker.

@coderanger
Copy link
Contributor

As mentioned on SO, what are you trying to do?

@codecov-io
Copy link

codecov-io commented Dec 21, 2016

Current coverage is 33.33% (diff: 16.66%)

Merging #249 into master will decrease coverage by 0.43%

@@             master       #249   diff @@
==========================================
  Files             2          2          
  Lines           228        234     +6   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits             77         78     +1   
- Misses          151        156     +5   
  Partials          0          0          

Powered by Codecov. Last update b2b44ba...1741e45

@merrykju
Copy link
Author

@coderanger In order to converge our chef-run I have to prepare a test data bag (chef-vault fallback) on the developer machines containing a real password which isn't allowed to live in git. We have a script which creates this data bag, and this script must be run prior to spinning up the docker machines. In kitchen-vagrant this script is defined as a pre_create_command.

@coderanger
Copy link
Contributor

That's probably not a good thing to do in Test Kitchen at all. If we want to support this pattern in TK it should probably be implemented in the core system so it works in every driver. That said, use of real data in TK at all should be considered a major problem. Create fixture data used only for testing and put that in git. Ping @cheeseplus re: moving this up the stack.

@merrykju
Copy link
Author

@coderanger Well, in my case it is not possible to check out stash repos during provisioning without a real password, and not having passwords in git also is a valid sec guideline...

@coderanger
Copy link
Contributor

Then don't test with stash repos, make some fake repos for testing purposes that can have less secure access credentials (or none at all, I keep a bunch of test_* repos in my Poise org for exactly this reason).

@coderanger
Copy link
Contributor

Also related https://github.com/poise/application_git/blob/master/test/cookbook/recipes/default.rb#L40 in case you want to hax0r my test repo :)

ysgard added a commit to ysgard/kitchen-docker_cli that referenced this pull request May 7, 2018
This is following [equivalent work for
kitchen-docker](test-kitchen/kitchen-docker#249)

Example use case marcy-terui#1:  Logging into AWS ECR prior to running a kitchen test so the test images can be retrieved
Example use case marcy-terui#2:  Running `bundle exec berks update` to refresh the
Berksfile.lock prior to running tests
@jeffreycoe
Copy link
Contributor

It looks like this feature has been implemented in the test kitchen base driver class unless I'm missing something. Also, due to inactivity, I'm going to close this PR. Please open a new PR if this feature is still needed. Thanks!

@jeffreycoe jeffreycoe closed this Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants