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
Port shell resource and tests #101
Conversation
return "", 0, err | ||
} | ||
|
||
// TODO: does this create a race condition? |
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 is unclear to me if the resulting string will always be the same, depending on the shell command. Does it really matter? There is no race condition on the go side, because go makes sure only one of stdin and stderr will write to the buffer at a time.
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.
it doesn't, AFAICT.
the tests in template were omitted because they're doing basically nothing. I do need to find a way to stub in a renderer to test. This one does need tests since it's doing shell script validation, which needs to not backtrack. |
Indeed, stubbing in a renderer is what I was trying to figure out for that. |
probably something like |
@@ -27,3 +28,44 @@ func TestPreparerInterface(t *testing.T) { | |||
|
|||
assert.Implements(t, (*resource.Resource)(nil), new(shell.Preparer)) | |||
} | |||
|
|||
func TestShellValidateValid(t *testing.T) { |
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.
s/ShellValidate/Prepare/g
but otherwise LGTM!
@ajhager looks good, thanks! |
I was able to copy and paste the original code with only minor changes. Some of the tests for validating the scripts were dropped, since it is unclear how to port them. Similar tests were dropped from the template resource when it was ported, though.