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

Port shell resource and tests #101

Merged
merged 5 commits into from Jul 21, 2016
Merged

Conversation

ajhager
Copy link
Contributor

@ajhager ajhager commented Jul 21, 2016

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.

return "", 0, err
}

// TODO: does this create a race condition?
Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't, AFAICT.

@BrianHicks
Copy link
Contributor

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.

@ajhager
Copy link
Contributor Author

ajhager commented Jul 21, 2016

Indeed, stubbing in a renderer is what I was trying to figure out for that.

@BrianHicks
Copy link
Contributor

probably something like helpers/fakerenderer would do it. Just do a straight pass through of strings to start.

@@ -27,3 +28,44 @@ func TestPreparerInterface(t *testing.T) {

assert.Implements(t, (*resource.Resource)(nil), new(shell.Preparer))
}

func TestShellValidateValid(t *testing.T) {
Copy link
Contributor

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!

@BrianHicks BrianHicks merged commit 217b5e9 into feature/preparers Jul 21, 2016
@BrianHicks BrianHicks deleted the feature/shell-module branch July 21, 2016 17:13
@BrianHicks
Copy link
Contributor

@ajhager looks good, thanks!

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.

None yet

2 participants