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
Fix unit test ValidateFeedURL
and ValidateURL
#1160
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.
Thanks for fixing Porter on go 1.14! I often end up regretting asserting on the entire error message 😅
If you wouldn't mind tweaking which assert you are using, then this is ready to merge.
pkg/pkgmgmt/install_test.go
Outdated
@@ -75,7 +77,8 @@ func TestInstallOptions_ValidateFeedURL(t *testing.T) { | |||
FeedURL: "$://example.com", | |||
} | |||
err := opts.validateFeedURL() | |||
require.EqualError(t, err, "invalid --feed-url $://example.com: parse $://example.com: first path segment in URL cannot contain colon") | |||
assert.True(t, strings.Contains(err.Error(), fmt.Sprintf("invalid --feed-url %s", opts.FeedURL))) |
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.
I wanted to let you know about another testify function assert.Contains
that can simplify your checks and improve the error message when the check fails:
assert.True(t, strings.Contains(err.Error(), fmt.Sprintf("invalid --feed-url %s", opts.FeedURL))) | |
assert.Contains(t, err.Error(), fmt.Sprintf("invalid --feed-url %s", opts.FeedURL)) |
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.
Thanks for getting us go 1.14 ready! 💯
What does this change
Fix a failing unit test when running porter with go 1.14
Checklist
If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇♀️