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

migrate test-infra to testify for util/stmtsummary pkg #26420

Closed
Tracked by #33453
tisonkun opened this issue Jul 21, 2021 · 4 comments · Fixed by #26869 or #26871
Closed
Tracked by #33453

migrate test-infra to testify for util/stmtsummary pkg #26420

tisonkun opened this issue Jul 21, 2021 · 4 comments · Fixed by #26869 or #26871
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@tisonkun
Copy link
Contributor

No description provided.

@tisonkun tisonkun added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Jul 21, 2021
@feitian124
Copy link
Contributor

/assign

@feitian124
Copy link
Contributor

feitian124 commented Jul 31, 2021

i am alomst finish, see https://github.com/feitian124/tidb/tree/issue-26420
but i must fix 2 failed unit test.

❯ go test ./... --count=1
--- FAIL: TestPrevSQL (0.00s)
    statement_summary_test.go:1308: 
                Error Trace:    statement_summary_test.go:1308
                Error:          Not equal: 
                                expected: 2
                                actual  : 1
                Test:           TestPrevSQL
--- FAIL: TestAccessPrivilege (0.00s)
    statement_summary_test.go:1403: 
                Error Trace:    statement_summary_test.go:1403
                Error:          Not equal: 
                                expected: 32
                                actual  : 2
                Test:           TestAccessPrivilege
FAIL
FAIL    github.com/pingcap/tidb/util/stmtsummary        0.032s
FAIL

the orignal test implemented in gocheck suite, means 2 side effects:

  • whole suite share one stmtSummaryByDigestMap instance
  • the tests within a suite run in alphabetical order

while migrated to testify, i did not use suite, so it very likely the failed 2 is caused by shared states and order.

i need some dig, maybe for simple, change to use suite too.
stretchr/testify#194

could you please give some advise? thanks . @tisonkun

@tisonkun
Copy link
Contributor Author

You don't have to rely on global variable and just create ssmap for each test. Also in this way you can run test in parallel.

We don't keep bad smell legacy code and do mechanically migration.

You can take a look at patch.diff.txt.

@tisonkun
Copy link
Contributor Author

tisonkun commented Aug 6, 2021

part 0 won't close this issue, will update PR description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
2 participants