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

test(pkg/version): migrate test-infra to testify for pkg/version pkg #2920

Merged
merged 6 commits into from
Oct 2, 2021
Merged

test(pkg/version): migrate test-infra to testify for pkg/version pkg #2920

merged 6 commits into from
Oct 2, 2021

Conversation

maxshuang
Copy link
Contributor

What problem does this PR solve?

migrate test-infra to testify for pkg/version pkg, close #2919

What is changed and how it works?

  1. migrate test-infra from gocheck to testify
  2. migrate leak test from leaktest to goleak

Check List

Tests

  • Unit test
  • Integration test

Release note

migrate test-infra to testify for pkg/version pkg

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 26, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • ben1009
  • overvenus

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 Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 26, 2021
@overvenus overvenus added the component/test Unit tests and integration tests component. label Sep 26, 2021
Comment on lines 28 to 29
"github.com/stretchr/testify/require"

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

??? what's the difference?

Copy link
Member

Choose a reason for hiding this comment

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

@overvenus He should have meant the empty line below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so, it's a problem adding an empty line here?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@amyangfei amyangfei Oct 2, 2021

Choose a reason for hiding this comment

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

removed blank line

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 26, 2021
Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

reset LGTM

@@ -83,9 +76,9 @@ func (s *checkSuite) TestCheckClusterVersion(c *check.C) {
if err == nil {
break
}
c.Error(err)
fmt.Fprintf(os.Stderr, "[ERROR]:%v", err)
Copy link
Member

Choose a reason for hiding this comment

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

How about we use t.Log(f)?

Also the original c.Error should make the case fail straight away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(1) t.Log(f) LGTM.
(2) c.Error will fail the test but not stop the test immediately. So i can't find the corresponding function in testify like c.Error. testify has fail/failnow/failf function, but they will stop the test-case directly. Any suggestions? @hi-rustin

Copy link
Member

Choose a reason for hiding this comment

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

If it's all going to fail, then I see nothing wrong with ending it early. @overvenus What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I find the testify.assert.Fail can act just like c.Error(). But the semantic of assert in testify still confuses me, cause assert means severe mismatch in C/C++.

Copy link
Member

Choose a reason for hiding this comment

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

😆 Cool!

@@ -83,9 +76,9 @@ func (s *checkSuite) TestCheckClusterVersion(c *check.C) {
if err == nil {
break
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

so what's the point for sleep in loop to wait? cause the retry already means fail when call c.Error()

Comment on lines 28 to 30
"github.com/stretchr/testify/require"

pd "github.com/tikv/pd/client"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"github.com/stretchr/testify/require"
pd "github.com/tikv/pd/client"
"github.com/stretchr/testify/require"
pd "github.com/tikv/pd/client"

@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 Sep 27, 2021
@maxshuang
Copy link
Contributor Author

/run-unit-test

@maxshuang
Copy link
Contributor Author

/run-all-tests

@maxshuang
Copy link
Contributor Author

/run-kafka-tests

1 similar comment
@maxshuang
Copy link
Contributor Author

/run-kafka-tests

@maxshuang maxshuang assigned maxshuang and amyangfei and unassigned maxshuang Sep 30, 2021
@amyangfei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 29961b0

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

/run-kafka-tests

@ti-chi-bot
Copy link
Member

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

@amyangfei
Copy link
Contributor

/run-kafka-tests

@ti-chi-bot ti-chi-bot merged commit 5abe114 into pingcap:master Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test Unit tests and integration tests component. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 pkg/version pkg
6 participants