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
Adds pre_create_command for running arbitrary commands #1243
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be using the mixlib-shellout wrapper method like everything else.
9db113c
to
4e8fd2d
Compare
Thanks for taking a look @coderanger. Updated, rebased and add some tests since tests are now passing 👍 |
spec/kitchen/driver/base_spec.rb
Outdated
@@ -88,6 +88,18 @@ class Slow < Base | |||
end | |||
end | |||
|
|||
describe ".pre_create_command" do | |||
it "run command" do | |||
config[:pre_create_command] = "echo works 2&>1 > /dev/null" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail on Windows. You can use driver.expects(:run_command).with("echo works 2&>1 > /dev/null")
to avoid actually running anything. Similarly with the fail test, that one is more technically okay but just for unit test speed it would be nice to use Mocha to stub it raising the exception rather than actually running a failed command :)
4e8fd2d
to
a256c68
Compare
This allows .kitchen.yml to contains the following: ```yaml driver: pre_create_command: echo 'this runs before a instance is created' ```
a256c68
to
d8b2e8e
Compare
Ugh Windows... Anyway updated and test are 🍏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will leave this open for a bit in case @cheeseplus wants to review too and he is music-ing for a few days. Thanks for the patch!
This allows .kitchen.yml to contains the following:
Adding this to core since the discussion at test-kitchen/kitchen-docker#249 kitchen-vagrant already has this functionally, but this adds it to all drivers.