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
storage: migrate test framework to testify #5139
Conversation
Signed-off-by: LLThomas <zs033@qq.com>
[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. |
When I run test, TestLoadMinServiceSafePoint can't pass.
Then, I test the original code.
"c.Assert(ssp, IsNil)" also has the same error. |
Codecov Report
@@ Coverage Diff @@
## master #5139 +/- ##
==========================================
+ Coverage 75.46% 75.56% +0.10%
==========================================
Files 309 309
Lines 30515 30515
==========================================
+ Hits 23028 23060 +32
+ Misses 5474 5450 -24
+ Partials 2013 2005 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -207,7 +198,7 @@ func (t *testHotRegionStorage) TestHotRegionDelete(c *C) { | |||
num := 0 | |||
for next, err := iter.Next(); next != nil && err == nil; next, err = iter.Next() { | |||
num++ | |||
c.Assert(reflect.DeepEqual(next, &historyHotRegions[defaultRemainDay-num]), IsTrue) | |||
re.True(reflect.DeepEqual(next, &historyHotRegions[defaultRemainDay-num])) |
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.
Equal is 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.
I think "re.True" is more suitable for functions that return bool value.
And I see an example that has been merged.
- c.Assert(rep.GetReplicationStatus().GetDrAutoSync().GetPauseRegionSplit(), IsTrue)
+ re.True(rep.GetReplicationStatus().GetDrAutoSync().GetPauseRegionSplit())
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.
See #5104, require.Equal
is used to replace reflect.DeepEqual
.
re.True(reflect.DeepEqual(next, &historyHotRegions[defaultRemainDay-num])) | |
re.Equal(&historyHotRegions[defaultRemainDay-num], next) |
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.
Oh, I got it, I'll fix it.
This test relies on the failpoint injection, you can see it is enabled on line 107. pd/server/storage/storage_gc_test.go Line 107 in 86a6821
To make the failpoint work, you should call |
Signed-off-by: LLThomas <zs033@qq.com>
Thanks! I got it. |
/merge |
@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests 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. |
This pull request has been accepted and is ready to merge. Commit hash: 633e6a7
|
ref tikv#4813 As the title says. Signed-off-by: LLThomas <zs033@qq.com>
Signed-off-by: LLThomas zs033@qq.com
What problem does this PR solve?
Issue Number: Ref #4813
What is changed and how does it work?
Check List
Tests
Release note