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

*: replace defer clean with t.Cleanup #36722

Merged
merged 11 commits into from
Aug 1, 2022
Merged

Conversation

xhebox
Copy link
Contributor

@xhebox xhebox commented Jul 29, 2022

if there is no close, then you will never forget to close.

Signed-off-by: xhe [email protected]

What problem does this PR solve?

Issue Number: close #36721

Problem Summary: As title. Also includes a patch for bazel patches.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 29, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • hawkingrei
  • tangenta

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 Jul 29, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 29, 2022
@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 Jul 29, 2022
@tangenta
Copy link
Contributor

@xhebox Please fix the linter.

[2022-07-29T10:23:22.718Z] br/pkg/backup/client_test.go:79:6: cannot initialize 1 variables with 2 values (typecheck)

[2022-07-29T10:23:22.718Z] 	s :=createBackupSuite(t)

[2022-07-29T10:23:22.718Z] 	    ^

[2022-07-29T10:23:22.718Z] br/pkg/backup/client_test.go:256:6: cannot initialize 1 variables with 2 values (typecheck)

[2022-07-29T10:23:22.718Z] 	s :=createBackupSuite(t)

[2022-07-29T10:23:22.718Z] 	    ^

[2022-07-29T10:23:22.718Z] br/pkg/backup/client_test.go:308:6: cannot initialize 1 variables with 2 values (typecheck)

[2022-07-29T10:23:22.718Z] 	s :=createBackupSuite(t)

[2022-07-29T10:23:22.718Z] 	    ^

[2022-07-29T10:23:22.718Z] dumpling/export/writer_test.go:333:62: missing ',' in parameter list (typecheck)

[2022-07-29T10:23:22.718Z] func createTestWriter(conf *Config, t *testing.T) (w *Writer func()) {

[2022-07-29T10:23:22.718Z]                                                              ^

[2022-07-29T10:23:22.718Z] store/gcworker/gc_worker_test.go:1978: File is not `goimports`-ed (goimports)

[2022-07-29T10:23:22.718Z] func bootstrap(t testing.TB, store kv.Storage, lease time.Duration) (*domain.Domain) {

[2022-07-29T10:23:22.718Z] executor/chunk_size_control_test.go:132: File is not `goimports`-ed (goimports)

[2022-07-29T10:23:22.718Z] 	kit :=createChunkSizeControlKit(t, "create table t (a int, index idx_a(a))")

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 29, 2022
@hawkingrei
Copy link
Member

@xhebox

I find some code look like this:

func TestSnapshotAnalyzeAndMaxTSAnalyze(t *testing.T) {
for _, analyzeSnapshot := range []bool{true, false} {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)

if we are without the hand way to clean. we will meet some problems.

@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

@xhebox

I find some code look like this:

func TestSnapshotAnalyzeAndMaxTSAnalyze(t *testing.T) {
for _, analyzeSnapshot := range []bool{true, false} {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)

if we are without the hand way to clean. we will meet some problems.

Could use subtests to handle it, tell me if there are other similar cases. Also, it will cause problem anyway, defer in loop does not make sense.

@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

@xhebox
I find some code look like this:

func TestSnapshotAnalyzeAndMaxTSAnalyze(t *testing.T) {
for _, analyzeSnapshot := range []bool{true, false} {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)

if we are without the hand way to clean. we will meet some problems.

Could use subtests to handle it, tell me if there are other similar cases. Also, it will cause problem anyway, defer in loop does not make sense.

Fixed all cases in tests by revive linter, going to merge it.

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 5f80b734bd974d008d0c724dc97abd861f057b50

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

/run-unit-test

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: d9ee5f6cb4545519fbc6a503fbf2e821596886fd

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

/merge

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

/run-unit-test

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

/merge

@hawkingrei
Copy link
Member

/run-all-tests

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
if there is no close, then you will never forget to close.

Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
@hawkingrei
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 3ab19b7

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

/run-build

@ti-chi-bot
Copy link
Member

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

Signed-off-by: xhe <[email protected]>
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

Every merge may damage this PR...

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: e05802f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 1, 2022
@xhebox
Copy link
Contributor Author

xhebox commented Aug 1, 2022

/merge

@ti-chi-bot ti-chi-bot merged commit 9a16a8d into pingcap:master Aug 1, 2022
@xhebox xhebox deleted the cleanup branch August 1, 2022 09:36
morgo pushed a commit to morgo/tidb that referenced this pull request Aug 1, 2022
morgo added a commit to morgo/tidb that referenced this pull request Aug 1, 2022
* upstream/master:
  ddl/schematracker: fix SetDDL will cause data race (pingcap#36768)
  planner: check virtual column for tiflash (pingcap#36771)
  *: replace defer clean with t.Cleanup (pingcap#36722)
  ddl: fix inaccurate row_count for `admin show ddl jobs` (pingcap#36716)
  config, sysvar: add config `instance.enable_ddl` and sysvar `tidb_enable_ddl` (pingcap#35425)
  *: enable part revive for all code (pingcap#36703)
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.

Replace defer clean() pattern with t.Cleanup()
5 participants