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

expression: migrate test-infra to testify for expression/constant_test.go (#28854) #28895

Merged

Conversation

agneum
Copy link
Contributor

@agneum agneum commented Oct 17, 2021

What problem does this PR solve?

Issue Number: close #28854, #29140, #29138

Problem Summary:

What is changed and how it works?

What's Changed:

Tests

  • Unit test

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 17, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • tisonkun
  • xiongjiwei

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 17, 2021
@ti-chi-bot
Copy link
Member

Welcome @agneum!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

@agneum
Copy link
Contributor Author

agneum commented Oct 17, 2021

/cc @Reviewer

@ti-chi-bot
Copy link
Member

@agneum: GitHub didn't allow me to request PR reviews from the following users: reviewer.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @Reviewer

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 kubernetes/test-infra repository.

@agneum
Copy link
Contributor Author

agneum commented Oct 20, 2021

/cc @tisonkun

@agneum
Copy link
Contributor Author

agneum commented Oct 25, 2021

@tisonkun Could you please review the PR?

@tisonkun tisonkun self-requested a review October 25, 2021 16:56
"time"

. "github.com/pingcap/check"
"github.com/stretchr/testify/assert"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please try to use require consistently

@@ -56,7 +55,7 @@ func newFunction(funcName string, args ...Expression) Expression {
return NewFunctionInternal(mock.NewContext(), funcName, typeLong, args...)
}

func (*testExpressionSuite) TestConstantPropagation(c *C) {
func TestConstantPropagation(t *testing.T) {
tests := []struct {
solver []PropagateConstantSolver
conditions []Expression
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please verify running these tests in parallel with t.Parallel(). Otherwise rename the file as xxx_serial_test.go

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto others

@@ -177,12 +176,12 @@ func (*testExpressionSuite) TestConstantPropagation(c *C) {
result = append(result, v.String())
}
sort.Strings(result)
c.Assert(strings.Join(result, ", "), Equals, tt.result, Commentf("different for expr %s", tt.conditions))
assert.Equal(t, tt.result, strings.Join(result, ", "), fmt.Sprintf("different for expr %s", tt.conditions))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require.Equalf will help.


d, _, err := cstInt.EvalInt(ctx, chunk.Row{})
c.Assert(err, IsNil)
c.Assert(d, Equals, int64(1))
require.Nil(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require.NoError(t, err)

ditto others.

m := &MockExpr{}
ctx := mock.NewContext()
cst := &Constant{DeferredExpr: m, RetType: newIntFieldType()}
m.i, m.err = nil, fmt.Errorf("ERROR")
_, _, err := cst.EvalInt(ctx, chunk.Row{})
c.Assert(err, NotNil)
assert.NotNil(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require.Error(t, err), ditto others

@tisonkun
Copy link
Contributor

Comments inline. Generally three suggestions:

  1. use require
  2. try to run in parallel
  3. precise assertions

@agneum
Copy link
Contributor Author

agneum commented Oct 26, 2021

Comments inline. Generally three suggestions:

1. use `require`

2. try to run in parallel

3. precise assertions

@tisonkun Thanks for the review. I've fixed these comments

Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please also assign #29140 #29138 to yourself and update the PR description to close these two issues.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 27, 2021
@tisonkun
Copy link
Contributor

/cc @xiongjiwei

@ti-chi-bot ti-chi-bot requested a review from xiongjiwei October 27, 2021 00:37
@agneum
Copy link
Contributor Author

agneum commented Oct 27, 2021

LGTM. Please also assign #29140 #29138 to yourself and update the PR description to close these two issues.

Thanks, done

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 27, 2021
@xiongjiwei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 1c6941a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 27, 2021
@ti-chi-bot
Copy link
Member

@agneum: 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.

@ti-chi-bot ti-chi-bot merged commit bfe344c into pingcap:master Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
4 participants