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: make unit test fail fast #2575

Closed

Conversation

Rustin170506
Copy link
Member

What problem does this PR solve?

None

What is changed and how it works?

make unit test fail fast

Check List

Tests

  • No code

Code changes

None

Side effects

None

Related changes

  • Need to cherry-pick to the release branch

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 19, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 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 the release-note-none Denotes a PR that doesn't merit a release note. label Aug 19, 2021
@ti-chi-bot ti-chi-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 19, 2021
@Rustin170506 Rustin170506 added require-LGT1 Indicates that the PR requires an LGTM. component/test Unit tests and integration tests component. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. labels Aug 19, 2021
@Rustin170506
Copy link
Member Author

/run-all-tests

@codecov-commenter
Copy link

Codecov Report

Merging #2575 (7aa6324) into master (b6451b6) will increase coverage by 2.0154%.
The diff coverage is 66.3610%.

@@               Coverage Diff                @@
##             master      #2575        +/-   ##
================================================
+ Coverage   52.7179%   54.7333%   +2.0154%     
================================================
  Files           164        171         +7     
  Lines         17679      20852      +3173     
================================================
+ Hits           9320      11413      +2093     
- Misses         7348       8332       +984     
- Partials       1011       1107        +96     

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

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 7aa6324

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

How does this parameter work, when I add a fake failure in test such as c.Assert(false, check.IsTrue), the test seems not terminate

➜  make unit_test
# use -mod=mod to avoid error: missing go.sum entry for module providing package
# ref: https://github.com/golang/go/issues/44129
which bin/failpoint-ctl >/dev/null 2>&1 || CGO_ENABLED=0 GO111MODULE=on go build  -trimpath -mod=mod -o bin/failpoint-ctl github.com/pingcap/failpoint/failpoint-ctl && go mod tidy
./scripts/fix_lib_zstd.sh
rm: cannot remove ‘zstd_cgo.go’: No such file or directory
mkdir -p "/tmp/tidb_cdc_test"
$(echo $(for p in $(go list ./...| grep -vE 'vendor|proto|ticdc\/tests|integration|testing_utils'); do echo ${p#"github.com/pingcap/ticdc/"}|grep -v "github.com/pingcap/ticdc"; done) | xargs bin/failpoint-ctl enable >/dev/null)
ok      github.com/pingcap/ticdc/cdc    53.066s coverage: 27.6% of statements
?       github.com/pingcap/ticdc/cdc/capture    [no test files]

----------------------------------------------------------------------
FAIL: codec_test.go:33: codecSuite.TestDecodeRecordKey

codec_test.go:44:
    c.Assert(false, check.IsTrue)
... obtained bool = false

OOPS: 12 passed, 1 FAILED
--- FAIL: Test (68.56s)
FAIL
coverage: 56.5% of statements
FAIL    github.com/pingcap/ticdc/cdc/entry      69.356s
ok      github.com/pingcap/ticdc/cdc/kv 172.969s        coverage: 69.5% of statements
ok      github.com/pingcap/ticdc/cdc/model      0.542s  coverage: 80.3% of statements
ok      github.com/pingcap/ticdc/cdc/owner      31.181s coverage: 85.0% of statements
ok      github.com/pingcap/ticdc/cdc/processor  0.648s  coverage: 58.0% of statements
ok      github.com/pingcap/ticdc/cdc/processor/pipeline 47.174s coverage: 53.6% of statements

@hi-rustin

@Rustin170506
Copy link
Member Author

/run-kafka-tests

@Rustin170506
Copy link
Member 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 Aug 19, 2021
@Rustin170506
Copy link
Member Author

How does this parameter work, when I add a fake failure in test such as c.Assert(false, check.IsTrue), the test seems not terminate

➜  make unit_test
# use -mod=mod to avoid error: missing go.sum entry for module providing package
# ref: https://github.com/golang/go/issues/44129
which bin/failpoint-ctl >/dev/null 2>&1 || CGO_ENABLED=0 GO111MODULE=on go build  -trimpath -mod=mod -o bin/failpoint-ctl github.com/pingcap/failpoint/failpoint-ctl && go mod tidy
./scripts/fix_lib_zstd.sh
rm: cannot remove ‘zstd_cgo.go’: No such file or directory
mkdir -p "/tmp/tidb_cdc_test"
$(echo $(for p in $(go list ./...| grep -vE 'vendor|proto|ticdc\/tests|integration|testing_utils'); do echo ${p#"github.com/pingcap/ticdc/"}|grep -v "github.com/pingcap/ticdc"; done) | xargs bin/failpoint-ctl enable >/dev/null)
ok      github.com/pingcap/ticdc/cdc    53.066s coverage: 27.6% of statements
?       github.com/pingcap/ticdc/cdc/capture    [no test files]

----------------------------------------------------------------------
FAIL: codec_test.go:33: codecSuite.TestDecodeRecordKey

codec_test.go:44:
    c.Assert(false, check.IsTrue)
... obtained bool = false

OOPS: 12 passed, 1 FAILED
--- FAIL: Test (68.56s)
FAIL
coverage: 56.5% of statements
FAIL    github.com/pingcap/ticdc/cdc/entry      69.356s
ok      github.com/pingcap/ticdc/cdc/kv 172.969s        coverage: 69.5% of statements
ok      github.com/pingcap/ticdc/cdc/model      0.542s  coverage: 80.3% of statements
ok      github.com/pingcap/ticdc/cdc/owner      31.181s coverage: 85.0% of statements
ok      github.com/pingcap/ticdc/cdc/processor  0.648s  coverage: 58.0% of statements
ok      github.com/pingcap/ticdc/cdc/processor/pipeline 47.174s coverage: 53.6% of statements

@hi-rustin

The new go test -failfast flag disables running additional tests after any test fails. Note that tests running in parallel with the failing test are allowed to complete.

Maybe because they are tests that run in parallel?

@Rustin170506
Copy link
Member 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 Aug 19, 2021
@ti-chi-bot
Copy link
Member

@hi-rustin: 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.

@Rustin170506
Copy link
Member 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 Aug 19, 2021
@Rustin170506
Copy link
Member Author

/close

@amyangfei

golang/go#33038

It really doesn't work. 😢 I am stupid!

@ti-chi-bot
Copy link
Member

@hi-rustin: Closed this PR.

In response to this:

/close

@amyangfei

golang/go#33038

It really doesn't work. 😢 I am stupid!

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.

@ti-chi-bot ti-chi-bot closed this Aug 19, 2021
@Rustin170506 Rustin170506 deleted the rustin-patch-test-fail-fast branch August 19, 2021 11:25
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. release-note-none Denotes a PR that doesn't merit a release note. require-LGT1 Indicates that the PR requires an LGTM. 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/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants