-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
VStreamer unit tests: refactor pending test #15845
VStreamer unit tests: refactor pending test #15845
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15845 +/- ##
=======================================
Coverage 68.45% 68.45%
=======================================
Files 1559 1559
Lines 196825 196825
=======================================
+ Hits 134736 134737 +1
+ Misses 62089 62088 -1 ☔ View full report in Codecov by Sentry. |
@@ -511,8 +511,12 @@ func (ts *TestSpec) getFieldEvent(table *schemadiff.CreateTableEntity) *TestFiel | |||
tc.len = int64(len(col.Type.EnumValues) + 1) | |||
tc.colType = fmt.Sprintf("%s(%s)", tc.dataTypeLowered, strings.Join(col.Type.EnumValues, ",")) | |||
ts.metadata[getMetadataKey(table.Name(), tc.name)] = col.Type.EnumValues | |||
case "json": | |||
tc.colType = "json" | |||
tc.len = lengthJSON |
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.
You probably already know, but this is the length of a longblob
(2^32 - 1) type because that's what is used within InnoDB for the JSON storage:
- https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html#data-types-storage-reqs-json
- https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html#data-types-storage-reqs-strings
Might be worth a comment since some of the length consts we have are not for a given type but the current usage (e.g. the SET ones).
It's only relevant in that these lengths are tied to types. So at some point we may add mediumblob
/mediumtext
longblob
/longtext
etc fields too. So I'm only thinking of how this might be (more) obvious to future readers / writers.
default: | ||
log.Infof(fmt.Sprintf("unknown sqlTypeString %s", tc.dataTypeLowered)) | ||
ts.t.Fatalf("unknown sqlTypeString %s", tc.dataTypeLowered) |
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.
We should not be using t.Fatal
in new code but using require.Fail[Now]
instead. We've had efforts to remove/replace this usage across the code base in the past so we shouldn't introduce new usage -- that's my thinking.
for l < col.len { | ||
val = append(val, "\x00"...) | ||
l++ | ||
} | ||
case "json": | ||
sval := strings.Trim(string(val), "'") | ||
sval = strings.Replace(sval, "\\", "", -1) |
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.
Nit, but IMO strings.ReplaceAll
is a bit more clear.
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
… for now Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
6749832
to
778ea66
Compare
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Description
Final PR on porting over the vstreamer unit tests. Only one test
TestJSON
has been ported. Remaining ones are too specific and will require disproportional changes in the test framework for each test and those have been left as-is.Related Issue(s)
#14903
Checklist
Deployment Notes