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

util/rowcodec: migrate test-infra to testify #27048

Closed
wants to merge 7 commits into from

Conversation

UBarney
Copy link
Contributor

@UBarney UBarney commented Aug 10, 2021

What problem does this PR solve?

Issue Number: close #26413

Release note

None

@ti-chi-bot
Copy link
Member

[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 /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. labels Aug 10, 2021
@ti-chi-bot
Copy link
Member

Welcome @UBarney!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@ti-chi-bot ti-chi-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 10, 2021
@UBarney UBarney marked this pull request as ready for review August 10, 2021 03:23
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2021
@ti-chi-bot
Copy link
Member

@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:

/cc @Reviewer

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.

@UBarney
Copy link
Contributor Author

UBarney commented Aug 10, 2021

/cc @tisonkun

@ti-chi-bot ti-chi-bot requested a review from tisonkun August 10, 2021 07:06
Copy link
Contributor

@tisonkun tisonkun left a 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.

util/rowcodec/rowcodec_test.go Show resolved Hide resolved
util/rowcodec/rowcodec_test.go Outdated Show resolved Hide resolved
util/rowcodec/rowcodec_test.go Outdated Show resolved Hide resolved
util/rowcodec/rowcodec_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 11, 2021
Signed-off-by: tison <wander4096@gmail.com>
Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Member

@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:

LGTM

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.

@tisonkun
Copy link
Contributor

/cc @xhebox @tiancaiamao @mmyj

PTAL.

It seems CI fails due to jenkins failure.

@ti-chi-bot ti-chi-bot requested a review from tiancaiamao August 11, 2021 10:44
@ti-chi-bot
Copy link
Member

@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:

/cc @xhebox @tiancaiamao @mmyj

PTAL.

It seems CI fails due to jenkins failure.

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.

@ti-chi-bot ti-chi-bot requested a review from xhebox August 11, 2021 10:44
dtNilData := []testData{
}

func TestNilAndDefault(t *testing.T) {
Copy link
Contributor

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.

@UBarney UBarney marked this pull request as draft August 15, 2021 13:59
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2021
Copy link
Contributor Author

@UBarney UBarney left a 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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. what's diffierence between dt and bt
  2. Does testData.def mean default value ?

Copy link
Contributor

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?

Copy link
Contributor

@lysu lysu Aug 16, 2021

Choose a reason for hiding this comment

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

  1. dt should be "input" and bt 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

types.NewDurationDatum(getDuration("4:00:00")),
types.NewIntDatum(14400000000000),

  1. yes def means default value and only this case use it

getDatumPoint(types.NewUintDatum(9)),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it; Thanks

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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
}

Copy link
Contributor

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.

@tisonkun
Copy link
Contributor

Please fix the wrong license header, you may try to use license header from other files that pass the check.

@tiancaiamao
Copy link
Contributor

If it's ready for review, please remove the Draft @UBarney

@UBarney
Copy link
Contributor Author

UBarney commented Aug 24, 2021

Sorry, I have been busy recently. There is no time to change this pr. Close it for now

@UBarney UBarney closed this Aug 24, 2021
@tisonkun
Copy link
Contributor

@UBarney ok. I'll take it over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate test-infra to testify for util/rowcodec pkg
6 participants