-
Notifications
You must be signed in to change notification settings - Fork 628
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
feat: add semantic version utilities for e2e tests #2502
Conversation
e2e/testsuite/semver_test.go
Outdated
{"supported semantic version", "v6.1.0", true}, | ||
{"supported semantic version", "v7.1.0", true}, | ||
{"supported semantic version", "v22.5.1", true}, | ||
{"supported semantic version with v", "2.5.0", true}, |
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.
{"supported semantic version with v", "2.5.0", true}, | |
{"supported semantic version without v", "2.5.0", true}, |
e2e/testsuite/semver.go
Outdated
} | ||
} | ||
|
||
func ParseChainVersion(version string) (Version, bool) { |
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.
Is this function is only used in IsSupported
, can it be unexported? If it cannot, can we add a godoc then?
// or is greater than or equal to the list of minor releases it was included in. | ||
func (fr FeatureReleases) IsSupported(versionStr string) bool { | ||
// assume any non semantic version formatted version support the feature | ||
// this will be useful during development of the e2e test with the new feature |
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.
So this is to support images with names of working branches, right?
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.
right, this will mean a version of pr-1234
will "support" a feature.
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.
All right... maybe this is an edge case, but if we have a PR for a branch that does not support the feature (for example, a backport to release/v2.4.x
) then the test will fail, right? Because this will wrongly assume that the PR supports the feature... Although maybe this is not a problem if the metadata tests are only run as part of the compatibility check.
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.
The test cases look great ❤️
I think a lot of the custom logic that we have here can be replaced with the semver
package. Especially since our inputs are strings.
e2e/testsuite/semver.go
Outdated
return Version{ | ||
Major: major, | ||
Minor: minor, | ||
}, true |
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.
The majority of the parsing logic here seems to be duplicating semver.Major
and semver.Minor
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.
ah! I was looking for that, wasn't sure it existed, looks to be importable under "semver"?
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 looks like the import path is "golang.org/x/mod/semver"
After the refactor, the custom types to represent versions were removed in favour of strings which are natively supported by the |
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! Nice work @colin-axner and @chatton 🙏
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.
ACK, thanks @chatton! Feel free to merge for me whenever you feel ready
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.
nice work @colin-axner @chatton !
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.
Approve! (can't click approve button on github, feel free to do it on my behalf)
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.
(on behalf of @colin-axner ❤️ )
Description
closes: #XXXX
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes