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

CI: make codecov/project failed when coverage decreased in pull request #45557

Closed
wants to merge 1 commit into from

Conversation

wuhuizuo
Copy link
Contributor

@wuhuizuo wuhuizuo commented Jul 25, 2023

What problem does this PR solve?

Issue Number: close #45560

Problem Summary:

What is changed and how it works?

  • update green range value, current the coverage of trunk branch is greater than 70%.
  • update .coverage.status.project to make codecov/project github status failed when coverage decreased in pull request.

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

ti-chi-bot bot commented Jul 25, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 25, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhaoxinyu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 25, 2023
@tiprow
Copy link

tiprow bot commented Jul 25, 2023

Hi @wuhuizuo. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@wuhuizuo
Copy link
Contributor Author

/test ?

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 25, 2023

@wuhuizuo: The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test ?

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.

@tiprow
Copy link

tiprow bot commented Jul 25, 2023

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test ?

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.

@wuhuizuo
Copy link
Contributor Author

/test unit-test

@tiprow
Copy link

tiprow bot commented Jul 25, 2023

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test unit-test

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.

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #45557 (80593b2) into master (56610b1) will increase coverage by 1.4931%.
Report is 46 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #45557        +/-   ##
================================================
+ Coverage   73.2295%   74.7227%   +1.4931%     
================================================
  Files          1265       1278        +13     
  Lines        389624     403185     +13561     
================================================
+ Hits         285320     301271     +15951     
+ Misses        86005      83945      -2060     
+ Partials      18299      17969       -330     
Flag Coverage Δ
integration 78.1388% <ø> (?)
unit 74.7170% <ø> (+1.4874%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 87.6802% <ø> (+2.6247%) ⬆️
br 52.9554% <ø> (+0.8187%) ⬆️

@wuhuizuo wuhuizuo changed the title *: Update .codecov.yml *: Update .codecov.yml to make codecov/project failed when coverage decreased in pull request. Jul 25, 2023
@wuhuizuo wuhuizuo changed the title *: Update .codecov.yml to make codecov/project failed when coverage decreased in pull request. CI: make codecov/project failed when coverage decreased in pull request Jul 25, 2023
@hawkingrei
Copy link
Member

image

Why does coverage decrease but you do not change anything?

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Jul 25, 2023

image Why does coverage decrease but you do not change anything?

It's missed:
image

Will bazel caching will cause it?

@wuhuizuo
Copy link
Contributor Author

image Why does coverage decrease but you do not change anything?

It's missed: image

Will bazel caching will cause it?

I think the tests are not permanent.

default:
threshold: 0.2 #Allow the coverage to drop by threshold%, and posting a success status.
target: auto
threshold: 0% # decline in denial coverage.
Copy link
Member

Choose a reason for hiding this comment

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

So, are you sure about setting this threshold to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, only allow the total coverage to drop by 0%.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to set this threshold to 0%, it's better to provide another command to let one reviewer do the final check and then force merge, since we always have code lines that are hard to cover.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not quite sure whether the zero threshold here is reasonable. The coverage statistics are not always accurate, and the same modification may lead to different results in different environments.

Copy link
Member

Choose a reason for hiding this comment

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

And as chrysan said above, code lines are not always easy to be covered, for example, some insurance codes written for extreme cases may never be generated in the test environment, which means the coverage drop would never reach 0.

Copy link
Contributor

Choose a reason for hiding this comment

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

By removing some useless code and its test, the coverage will drop, but it's acceptable.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Jul 25, 2023

/cc @bb7133

PTAL

@ti-chi-bot ti-chi-bot bot requested a review from bb7133 July 25, 2023 12:02
@wuhuizuo
Copy link
Contributor Author

/test check?

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 25, 2023

@wuhuizuo: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test check?

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.

@wuhuizuo
Copy link
Contributor Author

/test check-dev2

@tiprow
Copy link

tiprow bot commented Jul 25, 2023

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check?

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.

@tiprow
Copy link

tiprow bot commented Jul 25, 2023

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev2

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 bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 31, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 31, 2023

@wuhuizuo: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev 80593b2 link true /test check-dev

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 8, 2023

Wow, TiDB developers must be happy with this change because it's so useful 🙏🙏🙏

@Rustin170506
Copy link
Member

Some offline discussions:

hi-rustin: #45557 I'm curious about this PR, it's coverage increased by 1.49%. But its patch coverage was not affected. How should we understand this calculation rule?

hi-rustin: My guess is because it uses a different base ref commit to calculate code coverage. So please give us a clear guide on how to understand these values before enabling the mechanism. And tell us how to make sure the results are not false positives or false negatives. Otherwise it will become very annoying.

hawkingrei: No need to guess, this has already happened.

hi-rustin: Also, not everyone is a CI/CD or codecov expert, so if it's going to affect every R&D, then make sure that this is a manageable cost of learning to understand. Otherwise, we are reducing our development efficiency.

wuhuizuo: CI flow: checkout head + base -> merge head to base -> run tests.

hi-rustin: Also, is there a better way for us to improve test coverage? For example, let's not enforce it, just monitor it. Then set goals within the team to improve it. Instead of making it a CI requirement to force R&D. I have seen very few projects in real life projects that do this kind of requirement.

hi-rustin: ant-design/ant-design#44061 Even for this project, it has 100% code coverage and they don't really enforce it as a required CI status.

hi-rustin: Another example: #45900 I added two tests for one function, but got some really crazy CI status:
1f38fca7-5ef2-44b8-b369-53451352b1a4

wuhuizuo: Rustin Liu just focus on "codecov/project", other statuses fail on target coverage.

wuhuizuo: The 50% patch override for unit is spot on. the base code is also not overridden, but your renaming of the variable on the uncovered line is a hit.
base coverage: https://app.codecov.io/gh/pingcap/tidb/blob/master/statistics%2Fcmsketch.go#L830

hi-rustin: I added threeee tests for this function, but I got some really crazy results again:
4ef95240-55a1-4f46-a677-a1c2e6a79469

hi-rustin: #45900 Yesterday I still can pass some of CI statuses. I didn't change any of my code. Just added some benchmark tests.

wuhuizuo: some CI jobs are not finished, it will update when new data is uploaded.

hi-rustin: This pull request has already been merged, but the CI statuses are still failed. #45900
48108118-1bda-457f-8093-d3dd27328720

hawkingrei: #45947
img_v2_def5fd5c-ab33-40dc-8619-b0f3fb3805fg
This PR is to clean code. but I do not understand why the coverage of br is decreasing.

wuhuizuo: Stephen Wang, coverage was decreased by Indirect changes.
img_v2_c47d1114-f6fa-418d-83e5-047f1d52c69g
Stephen Wang, coverage was decreased by Indirect changes.
Ref: https://docs.codecov.com/docs/unexpected-coverage-changes

hawkingrei: This PR can not change coverage. It can not decrease or increase coverage.
img_v2_aa443aae-cb49-4896-a3a4-e4622349d14g

wuhuizuo: it's diff with the old base commit, such as:​
https://app.codecov.io/gh/pingcap/tidb/pull/45947/blob/plugin/plugin.go
it's coverage data based: b59ce11 (17 hours before)
not 7828409
img_v2_58f32ccb-ba5c-49f2-a1d9-4ba86d713bag
I think it's the cause.

hi-rustin:
TKAFV8ziSb
#45988 I only updated the makefile.
xpncYzmyAa

wuhuizuo: Jason Mo,It does seem like it could have something to do with the coverage reporting inside the check job you added.
It does seem like it could have something to do with the coverage reporting inside the check job you added.

hi-rustin: Can we turn off the coverage reporting until it's fixed? #46003 This is another pull request to add tests.
301dcb61-e88b-4cc6-bb1f-f47ecfa7b564
At the moment it doesn't do much good except interfere with our ability to see the pr status. Or just put it on the master merged commit.

@Rustin170506
Copy link
Member

Based on our discussion, I'm suggesting that we turn off status feedback on PR until we get the codecov statuses fixed.

@wuhuizuo
Copy link
Contributor Author

wuhuizuo commented Sep 6, 2023

Pause currently
/cc @bb7133

@wuhuizuo wuhuizuo closed this Sep 6, 2023
@wuhuizuo wuhuizuo deleted the ci/wuhuizuo-patch-1 branch September 6, 2023 08:07
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to block the pull requests which will decrease the total test coverage.
7 participants