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: do not overwrite the log config in other tests #31019

Merged
merged 6 commits into from
Jan 14, 2022

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Dec 24, 2021

What problem does this PR solve?

Issue Number: related to #30871.

Problem Summary: #30871 sets the log level to a value read from the env variable log_level for every test package. However, some of the package overwrite the log config in tests. The log level in tests is out of control:

$ log_level=warn go test -v github.com/pingcap/tidb/server -test.run TestExplainFor -count 1

It is still printing the "INFO" level log:

...
[2021/12/24 19:25:26.188 +08:00] [INFO] [server.go:246] ["server is running MySQL protocol"] [addr=127.0.0.1:0]
[2021/12/24 19:25:26.188 +08:00] [INFO] [http_status.go:87] ["for status and metrics report"] ["listening on addr"=127.0.0.1:0]
[2021/12/24 19:25:26.202 +08:00] [INFO] [session.go:3012] ["CRUCIAL OPERATION"] [conn=5] [schemaVersion=29] [cur_db=] [sql="DROP DATABASE IF EXISTS `explain_for_conn`;"] [user=root@%]
...

What is changed and how it works?

This PR tries to prevent the log-config from being overwritten unexpectedly.

Check List

Tests

  • Unit test

  • Integration test

  • Manual test (add detailed scripts or steps below)

    After this PR, only WARN level log is printed:

    ...
    [2021/12/24 19:31:04.927 +08:00] [WARN] [sysvar_cache.go:53] ["sysvar cache is empty, triggering rebuild"]
    [2021/12/24 19:31:04.932 +08:00] [WARN] [misc.go:454] ["Automatic TLS Certificate creation is disabled"] []
    ...
    --- PASS: TestExplainFor (0.27s)
    PASS
    ok  	github.com/pingcap/tidb/server	0.919s
  • 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

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 24, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Defined2014
  • hawkingrei

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 24, 2021
@sre-bot
Copy link
Contributor

sre-bot commented Dec 24, 2021

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 26, 2021
@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 Dec 30, 2021
@tangenta
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 7e2f6da

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

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

@tangenta
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 31, 2021
@tangenta
Copy link
Contributor Author

/merge cancel because the CI is overload.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 31, 2021
@ti-chi-bot ti-chi-bot removed status/can-merge Indicates a PR has been approved by a committer. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 14, 2022
@tangenta
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: cc4b7fb

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

/unhold

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 14, 2022
@hawkingrei
Copy link
Member

/run-mysql-test

@ti-chi-bot ti-chi-bot merged commit 0612788 into pingcap:master Jan 14, 2022
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/XS Denotes a PR that changes 0-9 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.

5 participants