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

util/stmtsummary: migrate test-infra to testify (part 0) #26869

Merged
merged 6 commits into from
Aug 6, 2021

Conversation

feitian124
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #26420
split from #26771, [0/2]

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 3, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • mmyj
  • xhebox

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 3, 2021
@feitian124
Copy link
Contributor Author

/cc @tisonkun
hi, please help review, thanks

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

@ti-chi-bot
Copy link
Member

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

LGTM

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
Copy link
Contributor

tisonkun commented Aug 5, 2021

/cc @xhebox @djshow832

PTAL. Thanks!


err := sv.setVariable(typeMaxStmtCount, "10", false)
c.Assert(err, IsNil)
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.

You can use NoError.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks

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

tisonkun commented Aug 6, 2021

/cc @mmyj

@ti-chi-bot
Copy link
Member

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

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

In response to this:

/cc @mmyj

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.

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, false)
require.Equal(t, false, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

require.LessOrEqual(t, en, 0) is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi, all this kind is fixed, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @mmyj , unit test failed due to Elements type not match, one is int64 and the other is int.
i am search testify api to see if there are some method can do the compare but ignore the int type, otherwise seems a convert is required.
if so, they orginal one seems more simple.
what your idea?

Copy link
Member

Choose a reason for hiding this comment

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

I think convert the int to int64 can resolve this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, fixed, please check

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, true)
require.Equal(t, true, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

require.Greater(t, en, 0) is better?

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, false)
require.Equal(t, false, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, true)
require.Equal(t, true, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, true)
require.Equal(t, true, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, false)
require.Equal(t, false, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

en = sv.getVariable(typeEnable)
c.Assert(en > 0, Equals, true)
require.Equal(t, true, en > 0)
Copy link
Member

Choose a reason for hiding this comment

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

ditto


err := sv.setVariable(typeMaxStmtCount, "10", false)
c.Assert(err, IsNil)
require.NoError(t, err)
st = sv.getVariable(typeMaxStmtCount)
Copy link
Member

Choose a reason for hiding this comment

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

It seems that we don't need the var st. How about the following code?

require.Equal(t, int64(10), sv.getVariable(typeMaxStmtCount))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for your suggestion.
please forgive me,but i think keep the var st there is more clear and more consistent with the err part

	err = sv.setVariable(typeEnable, "OFF", false)
	require.NoError(t, err)

another reason is that this is a migrate, less change may let the whole job faster done and less mistake injected.

Copy link
Member

Choose a reason for hiding this comment

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

OK.


err := sv.setVariable(typeEnable, "OFF", false)
c.Assert(err, IsNil)
require.NoError(t, err)
en = sv.getVariable(typeEnable)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

sv := newSysVars()
err := sv.setVariable(typeMaxStmtCount, "0", false)
c.Assert(err, IsNil)
require.NoError(t, err)
v := sv.getVariable(typeMaxStmtCount)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@@ -65,31 +65,31 @@ func TestSetBoolVariable(t *testing.T) {
err := sv.setVariable(typeEnable, "OFF", false)
require.NoError(t, err)
en = sv.getVariable(typeEnable)
require.Equal(t, false, en > 0)
require.LessOrEqual(t, en, 0 )
Copy link
Member

Choose a reason for hiding this comment

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

format it.

err = sv.setVariable(typeEnable, "OFF", true)
require.NoError(t, err)
en = sv.getVariable(typeEnable)
require.Equal(t, false, en > 0)
require.LessOrEqual(t, en, 0 )
Copy link
Member

Choose a reason for hiding this comment

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

ditto

err = sv.setVariable(typeEnable, "", true)
require.NoError(t, err)
en = sv.getVariable(typeEnable)
require.Equal(t, false, en > 0)
require.LessOrEqual(t, en, 0 )
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Member

@mmyj mmyj left a comment

Choose a reason for hiding this comment

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

lgtm

@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 Aug 6, 2021
@mmyj
Copy link
Member

mmyj commented Aug 6, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 2be4a6f

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

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

@feitian124
Copy link
Contributor Author

/run-check_dev_2

@ti-chi-bot ti-chi-bot merged commit b8107d7 into pingcap:master Aug 6, 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/L Denotes a PR that changes 100-499 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
Development

Successfully merging this pull request may close these issues.

migrate test-infra to testify for util/stmtsummary pkg
5 participants