-
Notifications
You must be signed in to change notification settings - Fork 87
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
Output release asset contents to standard output #103
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.
@tonerdo LGTM. do you think we need test cases to check the behaviour for a single asset vs multiple assets?
@robmorgan I agree on test cases and I spent some time thinking through them.. Any idea how to mock a |
@tonerdo you could try to create an integration test in func TestFetchWithStdoutOption(t *testing.T) {
tmpDownloadPath, err := ioutil.TempDir("", "fetch-stdout-test")
require.NoError(t, err)
repoUrl := "https://github.com/gruntwork-io/fetch-test-public"
releaseTag := "v0.0.4"
releaseAsset := "hello+world.txt"
cmd := fmt.Sprintf("fetch --repo %s --tag %s --release-asset %s --stdout false %s", repoUrl, releaseTag, releaseAsset, tmpDownloadPath)
t.Logf("Testing command: %s", cmd)
stdoutput, _, err := runFetchCommandWithOutput(t, cmd)
require.NoError(t, err)
// Ensure the expected file was downloaded
assert.FileExists(t, JoinPath(tmpDownloadPath, releaseAsset))
// When --stdout is specified, ensure the file contents are piped to the standard output stream
assert.Contains(t, stdoutput, "hello world")
} Maybe if you do a loop with 2 test cases it might cover each code path? |
Ah! Didn't realize we had integration tests. Thanks for the pointer |
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.
Ok LGTM
Description
An initial stab at supporting sending the contents of a downloaded asset to standard output
Documentation
TODOs
Please ensure all of these TODOs are completed before asking for a review.
feature/new-vpc-endpoints-955
orbug/missing-count-param-434
.Related Issues
Addresses #101