-
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
ddl/table_test.go: migrate infra to testify #29288
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 @clovis1122! |
cc: @tisonkun, can you let me know if this is good enough? |
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.
Please take a look at #27747 to know how to migrate a test suite. After you migrate "pingcap/check" to "testify", suite magic doesn't work and you should change the pattern.
Also, a basic sanity check is that after the migration, the files in issue should not import "pingcap/check".
You should be able to run ddl test locally by
make failpoint-enable
cd ddl
go test
otherwise you make invalid changes.
Got it, thanks yeah I was looking at earlier PRs to figure out how to proceed. I cannot run all the tests because my laptop runs out of memory (I'm using Windows w/ wsl, I have 16GB but limited WSL to I believe). I'm currently seeing some failed tests on the CI and got some ideas to try in order to fix it (will try later today or tomorrow). Just wanted to check if it's OK for me to touch so many files. I hope it doesn't make code review hard 😅. One thing that wasn't super obvious for me is... which tests should be parallel (call Also, I hope it is OK to leave pingcap/check on the files that I didn't intend to fix... I mostly changed references outside |
It's totally OK to touch multiple files. Never mind. But yes please keep necessary changes only :)
Of course. |
5a6955c
to
af0d09c
Compare
c.Assert(err, IsNil) | ||
require.NoError(t, err) | ||
|
||
_, err = infosync.GlobalInfoSyncerInit(context.Background(), "t", func() uint64 { return 1 }, nil, true) |
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 may be overlooking something, but I had to add this initializer somewhere, otherwise, the Table* tests would fail after migrating it to Testify.
My guess is that infosync
on this context was already being initialized somewhere else, but I could not figure it out... the other place I see is the TestT
function in this same file, but that is not being used by the Table* tests.
4c7478e
to
173b33d
Compare
c402f31
to
f5f8897
Compare
@tisonkun is there flakiness in the tests? It looks like all the ddl tests are passing by now... but this test on an unrelated file: |
@clovis1122 unfortunately yes. You can try to find all unstable tests #25899 and for the known |
@tisonkun it sounds like I should trigger the tests until they pass or until I consistently get the same test error? How do I do that? |
/run-all-tests |
Ohhh they finally passed! Can I get a review? @tisonkun |
@clovis1122 you also touch other files beyond adjust methods but change every line from pingcap/check to testify. It makes a 1000 lines diff which is hard to review. Please consider revert unnecessary changes or take over relate issues and separate different purpose into dedicated commit. |
} | ||
|
||
func (s *testColumnChangeSuite) TestModifyAutoRandColumnWithMetaKeyChanged(c *C) { | ||
func TestModifyAutoRandColumnWithMetaKeyChanged(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.
For example, this file is not under ddl/table
. If reviewers found a 1000 lines diff including non trivial change, most of them will simply give up to review.
Take a look at #26022 and see that we either run parallel tests, or serial test in xxx_serial_test.go
.
ddl/ddl_test.go
Outdated
c.Assert(historyJob.BinlogInfo.SchemaVersion, Equals, args.ver) | ||
c.Assert(historyJob.BinlogInfo.DBInfo, DeepEquals, args.db) | ||
require.Equal(t, historyJob.BinlogInfo.SchemaVersion, args.ver) | ||
if !reflect.DeepEqual(historyJob.BinlogInfo.DBInfo, args.db) { |
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.
require.Equal
is bitwise equality checks. BTW this file is also not under ddl/table
. We break down subtasks for small changes easy to review and merge, and then repeat it for the next iteration.
From #29288 (comment)
It's totally OK to touch multiple files. Never mind. But yes please keep necessary changes only :)
Please notice please keep necessary changes only.
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! Changed it to require.Equal.
And actually you mean |
Fine. I can see that due to the out of order code arrange in |
@tisonkun yes, it's exactly as you said :(. 7 different tests including (There are more dependencies, this is just one of them). We could temporally duplicate the code if the review is hard... |
/run-all-tests |
Is it possible to move the tests in |
@zimulala not possible because Some ideas:
|
9b89968
to
9bb9a33
Compare
@clovis1122 you can fix the conflict and I'll review it this week. /cc |
efa7164
to
0ca8779
Compare
0ca8779
to
be7e01b
Compare
I'll rebase and fix the conflicts later today! |
518def9
to
0d3e9bf
Compare
@tisonkun to save everybody's time, I think it may be best to start with smaller changes. I'll work on a series of small PRs to decouple the utils functions in I created another PR, #29964. I hope to re-open this PR when the change is small enough so that it can be reviewed and merged without problems. |
What problem does this PR solve?
Issue Number: close #29116
Problem Summary:
What is changed and how it works?
Uses testify for
ddl/table_test.go
. In the process, I had to make the same change across multiple test files for the tests to compile.Could not fully run tests on my machine as it went out of memory very fast.
Check List
Tests
Side effects
Documentation
Release note