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

statistics: migrate test-infra to testify for statistics_test.go #28558

Merged
merged 23 commits into from
Oct 20, 2021

Conversation

feitian124
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #28123

notice: serial tests and their helper methods moved to statistics_serial_test.go

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 7, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • tisonkun
  • 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 7, 2021
@feitian124
Copy link
Contributor Author

ci failed due to

[2021-10-07T15:38:04.703Z] ./tools/check/check-tidy.sh
[2021-10-07T15:38:04.703Z] testSuite
[2021-10-07T15:38:04.703Z] ./tools/check/check_testSuite.sh
[2021-10-07T15:38:04.703Z] testStatisticsSuite in ./statistics is not enabled
[2021-10-07T15:38:04.703Z] make: *** [testSuite] Error 1

@feitian124
Copy link
Contributor Author

ci fails due to #27889

[2021-10-08T11:58:21.339Z] FAIL: db_partition_test.go:2181: testIntegrationSuite5.TestTruncatePartitionAndDropTable
[2021-10-08T11:58:21.339Z] 
[2021-10-08T11:58:21.339Z] db_partition_test.go:2282:
[2021-10-08T11:58:21.339Z]     c.Assert(hasOldPartitionData, IsFalse)
[2021-10-08T11:58:21.339Z] ... obtained bool = true

https://ci.pingcap.net/blue/organizations/jenkins/tidb_ghpr_check_2/detail/tidb_ghpr_check_2/37185/pipeline

@feitian124
Copy link
Contributor Author

/run-check_dev_2

@feitian124
Copy link
Contributor Author

/cc @tisonkun

@feitian124
Copy link
Contributor Author

notice the last commit add an useless line to workaround for tools/check/check_testSuite.sh
not sure what is a better way, rename the struct name? disable the check?

@tisonkun
Copy link
Contributor

notice the last commit add an useless line to workaround for tools/check/check_testSuite.sh not sure what is a better way, rename the struct name? disable the check?

Rename the suite could work, let me try to push a follow up for you to resolve conflict as well as workaround this check

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2021
@tisonkun
Copy link
Contributor

@feitian124 but you should keep var _ = Suite(&testStatisticsSuite{}) for now as there is other tests in cmsketch_test.go & histogram_test.go rely on it.

@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 12, 2021
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.

Could you elaborate how you determinate serial tests? That is, how you decide a test should be run in serial or in parallel.

@feitian124
Copy link
Contributor Author

Could you elaborate how you determinate serial tests? That is, how you decide a test should be run in serial or in parallel.

check the first commit, you can find there are 2 suites, one is testSerialIntegrationSuite

@tisonkun
Copy link
Contributor

@feitian124 I don't find one. Do you mix it up with #28693 ? I find all tests under testStatisticsSuite.

var _ = check.Suite(&testStatisticsSuite{})

func TestT(t *testing.T) {
config.UpdateGlobal(func(conf *config.Config) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

config.UpdateGlobal part i had added in TestStatistics, please check.

add here is package level, add in TestStatistics is more adhere to origin suite scope.

but in my memory some other tests also has config.UpdateGlobal, not sure if package level is better.

and could you explain why it need config.UpdateGlobal, not quit understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is not package level, but TestT level. But since we only had one TestT, it becomes global/package level.

This function itself it to avoid race, but it does not always work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, get it, TestingT is a special function in pingcap/check package, which runs all test suites registered with the Suite function.

as almost all original tests were suite based, i think make it active for all tests in this package is reasonable.
i will mv it to TestMain.

@tisonkun
Copy link
Contributor

Thanks for your updating @feitian124 ! I'm reviewing now.

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.

ping @winoros please take a look.

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

/cc @rebelice

Could you please take a look at this PR?

@feitian124
Copy link
Contributor Author

feitian124 commented Oct 18, 2021

/cc @winoros @xhebox @tiancaiamao

sorry for disturb as seems they are busy, could you help review?

Copy link
Contributor

@xhebox xhebox left a comment

Choose a reason for hiding this comment

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

Rest LGTM

var _ = check.Suite(&testStatisticsSuite{})

func TestT(t *testing.T) {
config.UpdateGlobal(func(conf *config.Config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not package level, but TestT level. But since we only had one TestT, it becomes global/package level.

This function itself it to avoid race, but it does not always work.

@@ -30,8 +29,6 @@ import (
"go.uber.org/goleak"
)

var _ = check.Suite(&testStatisticsSuite{})
Copy link
Contributor Author

@feitian124 feitian124 Oct 19, 2021

Choose a reason for hiding this comment

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

this line is here since that time other tests like cmsketch_test.go did not migrate so need it.

now #28552 is merged so ok to delete.

but after delete, will lead to suite not used error, so i renamed the old struct name from testStatisticsSuite to testStatisticsSamples to avoid it.

@feitian124
Copy link
Contributor Author

updated as your suggestion, please review agian, thanks.

@xhebox

@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 20, 2021
@xhebox
Copy link
Contributor

xhebox commented Oct 20, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 7402844

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 20, 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.

@ti-chi-bot ti-chi-bot merged commit f520dea into pingcap:master Oct 20, 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/XXL Denotes a PR that changes 1000+ 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 statistics/statistics_test.go
4 participants