-
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/decoder: migrate test-infra to testify #26629
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
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. |
/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. Comment inline that you can extract the method in this pass. Ask me for help if you need it.
util/rowDecoder/decoder_test.go
Outdated
} | ||
} | ||
} | ||
|
||
// TODO: local copy of testutil.MustNewCommonHandle,should use function in testutil after it migrate to testify | ||
func MustNewCommonHandle(t *testing.T, values ...interface{}) kv.Handle { |
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 can just create a file named, for example, "handle.go" under "testkit" and do the todo a favor.
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.
sure, a little busy now hope finish before bed
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.
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.
sorry, i met some problems and not sure how to resolve.
- decoder_test.go unit test failed for goleak
goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 21 in state select, with go.opencensus.io/stats/view.(*worker).start on top of the stack:
goroutine 21 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc000162410)
/home/ming/go/pkg/mod/[email protected]/stats/view/worker.go:154 +0xcd
created by go.opencensus.io/stats/view.init.0
/home/ming/go/pkg/mod/[email protected]/stats/view/worker.go:32 +0x57
- key_test.go and keydecoder_test.go have cycle import with util/testkit/handle.go
# github.com/pingcap/tidb/kv
FAIL github.com/pingcap/tidb/kv [setup failed]
package github.com/pingcap/tidb/kv (test)
imports github.com/pingcap/tidb/util/testkit
imports github.com/pingcap/tidb/domain
FAIL
imports github.com/pingcap/tidb/bindinfo
imports github.com/pingcap/tidb/sessionctx
imports github.com/pingcap/tidb/kv: import cycle not allowed in test
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 need some dig to resolve the 2 problems, any suggestion is appreciated
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.
For goleak, it is a known goroutine that doesn't exit, you can ignore by
opts := []goleak.Option{
goleak.IgnoreTopFunction("go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop"),
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
}
goleak.VerifyTestMain(m, opts...)
for cycle import, you can try to change package keydecoder
to package keydecoder_test
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.
thanks, helps a lot
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.
updated, please review again, thanks
@tisonkun: Request changes is only allowed for the reviewers in list. 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. |
Signed-off-by: tison <[email protected]>
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. |
Signed-off-by: tison <[email protected]>
hello @tisonkun , anything else need me to do to merge this pr? |
@feitian124 thanks for ping me. I'll ping other reviewers for you. /cc @xhebox @tiancaiamao @mmyj |
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
@mmyj may you help on merging as there are 2 approvals? |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 8b1e4a0
|
ci failed, i checked a few latest pr merged to this branch and try run unit test(i did not check all the prs):
----------------------------------------------------------------------
FAIL: handle_test.go:2984: testStatsSuite.TestIncrementalModifyCountUpdate
handle_test.go:3024:
// Check the count / modify_count changes during the analyze are not lost.
tk.MustQuery(fmt.Sprintf("select count, modify_count from mysql.stats_meta where table_id = %d", tid)).Check(testkit.Rows(
"6 3",
))
/home/ming/learn/go/pingcap_projects/tidb/util/testkit/testkit.go:63:
res.c.Assert(resBuff.String(), check.Equals, needBuff.String(), res.comment)
... obtained string = "[6 0]\n"
... expected string = "[6 3]\n"
... sql:select count, modify_count from mysql.stats_meta where table_id = 386, args:[]
OOPS: 109 passed, 1 skipped, 3 FAILED, 1 PANICKED
--- FAIL: TestT (24.31s)
/home/ming/learn/go/pingcap_projects/tidb/util/testkit/testkit.go:63:
res.c.Assert(resBuff.String(), check.Equals, needBuff.String(), res.comment)
... obtained string = "" +
... "[IndexReader_6 1.36 root index:IndexRangeScan_5]\n" +
... "[└─IndexRangeScan_5 1.36 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false]\n"
... expected string = "" +
... "[IndexReader_6 0.00 root index:IndexRangeScan_5]\n" +
... "[└─IndexRangeScan_5 0.00 cop[tikv] table:exp_backoff, index:idx(a, b, c, d) range:[1 1 1 3,1 1 1 5], keep order:false]\n"
... sql:explain select * from exp_backoff where a = 1 and b = 1 and c = 1 and d >= 3 and d<= 5, args:[]
OOPS: 58 passed, 1 FAILED
--- FAIL: TestT (7.62s) |
/run-check_dev_2 |
@feitian124 you can check #25899 to see if there is a ticket for this test. |
/merge |
@tisonkun: 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. |
not found, may be need add the above 2. |
Yes. It is one thing our community struggle for...hopefully we converge with the subtasks of tracking issue done one by one and you can digest some of them when migrate tests. |
/run-unit-test |
@feitian124: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
What problem does this PR solve?
Issue Number: close #26414
Release note