-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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/checksum: migrate to testify #26252
Conversation
/run-check_dev |
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 for submitting this PR @Ranxy !
May you shuffle helper functions after test functions? Always we focus on test functions first and optionally take a look at its helpers.
@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. |
@tisonkun Updated. |
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.
Rest LGTM
@Ranxy I'm creating a PR for you, please wait to make other changes. |
This reverts commit 4ef1ead.
Signed-off-by: tison <wander4096@gmail.com>
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've created a PR for you. You can take a look at Ranxy#1 .
Basically it reduces unnecessary file operation and improve ticase comments.
@tisonkun Your modifications are very effective, and I think @xhebox's proposal is also very good, and we can completely replace type fakeFile struct {
buf *bytes.Buffer
}
func (f *fakeFile) Write(p []byte) (n int, err error) {
return f.buf.Write(p)
}
func (f *fakeFile) Close() error {
return nil
}
func (f *fakeFile) ReadAt(p []byte, off int64) (n int, err error) {
w := f.buf.Bytes()
lp := int64(len(p))
lw := int64(len(w))
if off > lw {
return 0, io.EOF
}
if off+lp > lw {
copy(p[:lw-off], w[off:])
return int(lw - off), io.EOF
}
copy(p, w[off:off+lp])
return len(p), nil
} |
Checksum testify patch 1
/run-check_dev_2 |
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. |
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.
Rest LGTM
simplification check file is same
/run-check_dev_2 |
[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. |
/run-check_dev_2 |
@tiancaiamao @xhebox Thanks for your review! May you help with merging this PR? |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: ddd56a0
|
} else { | ||
c.Assert(err, check.Equals, errChecksumFail) | ||
assert.ErrorIs(t, err, errChecksumFail) |
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.
This line now creates unstable test
[2021-09-23T16:00:22.934Z] --- FAIL: TestModifyOneByte (0.00s)
[2021-09-23T16:00:22.934Z] --- FAIL: TestModifyOneByte/encrypted (0.00s)
[2021-09-23T16:00:22.934Z] checksum_test.go:179:
[2021-09-23T16:00:22.934Z] Error Trace: checksum_test.go:179
[2021-09-23T16:00:22.934Z] checksum_test.go:150
[2021-09-23T16:00:22.934Z] Error: Target error should be in err chain:
[2021-09-23T16:00:22.934Z] expected: "error checksum"
[2021-09-23T16:00:22.934Z] in chain:
[2021-09-23T16:00:22.934Z] Test: TestModifyOneByte/encrypted
What problem does this PR solve?
Issue Number: close #26169
What is changed and how it works?
What's Changed:
remove pingcap/check for utils/hack
refactor duplicate code
Release note