-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
util/rowcodec: migrate test-infra to testify #27048
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Welcome @UBarney! |
@UBarney: GitHub didn't allow me to request PR reviews from the following users: reviewer. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cc @tisonkun |
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.
Generally looks good. Suggestions on tests organizing.
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
@tisonkun: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
/cc @xhebox @tiancaiamao @mmyj PTAL. It seems CI fails due to jenkins failure. |
@tisonkun: GitHub didn't allow me to request PR reviews from the following users: mmyj. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
util/rowcodec/rowcodec_test.go
Outdated
dtNilData := []testData{ | ||
} | ||
|
||
func TestNilAndDefault(t *testing.T) { |
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.
Maybe add this test as a subtest into TestTypesNewRowCodec
. The diff of this PR is hard to review. Inline expands the code too much.
In such case, I would like to see reusing as much as possible, e.g. merging two tests of encodeAndDecode
into one.
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.
hi @tisonkun, I have some questions. Please answer when you have time
var _ = Suite(&testSuite{}) | ||
|
||
type testSuite struct{} | ||
|
||
type testData struct { |
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.
- what's diffierence between
dt
andbt
- Does
testData.def
mean default value ?
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'd like to refer to the original author @lysu . Any idea on this snippet of code?
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.
dt
should be "input" andbt
should be "output"..sorry for use such short name 😭
for example, some type like duration input will decode as flatten type -- int
in this rowcodec level(but will unflatten later in little upper level
tidb/util/rowcodec/rowcodec_test.go
Lines 426 to 427 in da5574a
types.NewDurationDatum(getDuration("4:00:00")), | |
types.NewIntDatum(14400000000000), |
- yes
def
means default value and only this case use it
tidb/util/rowcodec/rowcodec_test.go
Line 656 in da5574a
getDatumPoint(types.NewUintDatum(9)), |
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.
Got it; Thanks
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.
@UBarney we can rename the variable to fix the readability in this pass, though - by pushing a dedicated commit.
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, I'll do it
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.
how about we change testData
to
type testData struct {
id int64
ft *types.FieldType
inputDatum types.Datum
expected types.Datum
defaultDatum *types.Datum
handle 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.
I'd prefer
type testData struct {
id int64
ft *types.FieldType
input types.Datum
output types.Datum
default *types.Datum
handle bool
}
we don't have to repeat the field type and keep input and output symmetric. An output from testdata is expected data obviously IMO.
Please fix the wrong license header, you may try to use license header from other files that pass the check. |
If it's ready for review, please remove the Draft @UBarney |
Sorry, I have been busy recently. There is no time to change this pr. Close it for now |
@UBarney ok. I'll take it over. |
What problem does this PR solve?
Issue Number: close #26413
Release note