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

Updated schema tool to work with full semantic versions, i.e., MAJOR.MINOR.PATCH #2417

Merged
merged 6 commits into from
Jan 28, 2022
Merged

Updated schema tool to work with full semantic versions, i.e., MAJOR.MINOR.PATCH #2417

merged 6 commits into from
Jan 28, 2022

Conversation

roselander
Copy link

No description provided.

@roselander roselander requested review from wxing1292, yiminc and a team January 25, 2022 21:42

if hasEndVer && cmpVersion(startVer, endVer) > 0 {
return nil, fmt.Errorf("startVer (%v) must be less than or equal to endVer (%v)", startVer, endVer)
if startVersionExclusive.Compare(*endVersionInclusive) >= 0 {
Copy link
Member

Choose a reason for hiding this comment

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

needs to check when there is no schema update, this won't fail any pipeline (in case they call this using same start/end ver).

Copy link
Author

Choose a reason for hiding this comment

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

Done

Comment on lines +88 to 90
ans, err = readSchemaDir(s.versionsDir, "10.2", "", s.logger)
s.NoError(err)
s.Equal(0, len(ans))
Copy link
Member

Choose a reason for hiding this comment

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

Both test cases with envVer="" return empty result. We need to add one more case to cover envVer="" and result is non-empty, like startVer=v2.5, endVer="".

Copy link
Author

Choose a reason for hiding this comment

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

Good catch. Done.

@roselander roselander enabled auto-merge (squash) January 26, 2022 03:32
t *testing.T
}

func (l testLogger) Debug(msg string, tags ...tag.Tag) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(l testLogger) -> (l *testLogger)

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

not related to this pr, but shall we use https://pkg.go.dev/go.uber.org/zap/zaptest#NewLogger for test logger?

Copy link
Author

Choose a reason for hiding this comment

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

I was not aware of zaptest.NewLogger. That's kind of what I was looking for, but I need a temporal log.Logger, not a zap.Logger. It seems like there should be a way to wrap a zap.Logger as a log.Logger, but I'm not seeing it.

Copy link
Author

Choose a reason for hiding this comment

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

D'oh. NewZapLogger. I'm good now.

@@ -80,6 +77,7 @@ const (

var (
whitelistedCQLPrefixes = [4]string{"CREATE", "ALTER", "INSERT", "DROP"}
versionDirectoryRegex = regexp.MustCompile(`^v[\d.]+`)
Copy link
Contributor

Choose a reason for hiding this comment

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

does this also match v.3 ?

Copy link
Author

Choose a reason for hiding this comment

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

It does, but it would fail to parse as a semver. The only reason that we need this regex is to enforce the 'v' prefix. Otherwise we should just leave parsing up to the semver library.

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.

4 participants