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

Worrying trend with test coverage #18131

Open
serathius opened this issue Jun 5, 2024 · 14 comments
Open

Worrying trend with test coverage #18131

serathius opened this issue Jun 5, 2024 · 14 comments

Comments

@serathius
Copy link
Member

serathius commented Jun 5, 2024

What would you like to be added?

Code coverage value doesn't imply muchy, however we can infer some information from its trends.

Within last 12 months the etcd code coverage fell by 6%.
image

Link: https://app.codecov.io/gh/etcd-io/etcd/tree/main?search=&displayType=tree&trend=12%20months

I encourage all contributors, reviewers and approvers to ensure that we not continue this trend. As described in https://github.com/etcd-io/etcd/blob/main/Documentation/contributor-guide/features.md all features should have a proper testing. We should ensure that all PRs, both features and bugfixes, come with basic set of unit test that ensure that feature/bugfix does what it claims to be.

If you can please recall any PRs that you have reviewed and would benefit from more testing. We should ensure there are a proper followups to add those tests.

cc @jmhbnz @ahrtr @wenjiaswe

Why is this needed?

Testing is the foundation of project maintainability. Without them, we cannot add any features or fix any bugs without knowing that something else will break

@ahrtr
Copy link
Member

ahrtr commented Jun 5, 2024

I recall we have a coverage workflow running for each PR, but got removed for some reasons I don't remember anymore. Can we start with adding it back?

@serathius
Copy link
Member Author

serathius commented Jun 5, 2024

I'm unsure if the trend would be visible on a PR basis, and I don't like per-PR coverage information because it encourages writing low-quality tests just for coverage. Instead, we should identify areas where high coverage is crucial, and encourage contributors to write meaningful tests when and where they're needed.

@henrybear327 henrybear327 removed their assignment Jun 5, 2024
@serathius
Copy link
Member Author

serathius commented Jun 5, 2024

Coverage page also includes information about subdirectories and I think it's ok.

image

The low coverage of etcdctl and etcdutl makes sense as they are just command line tools that are mostly tested by e2e tests that are not included in the coverage

@ahrtr
Copy link
Member

ahrtr commented Jun 5, 2024

and I don't like per-PR coverage information because it encourages writing low-quality tests just for coverage

In my opinion, this is a viewpoint with obvious personal subjective bias. Adding a coverage workflow is a ver feasible way to keep the test coverage. With respect to "low quality tests", it's the scope of review.

@jmhbnz
Copy link
Member

jmhbnz commented Jun 5, 2024

If we are concerned pr's are not hitting requirements for testing and coverage is reducing I completely agree with @ahrtr that the way to address this would be to surface coverage information directly within pull requests.

It's incumbent on reviewers of pull requests to provide feedback on the quality of tests written and ensure tests add value before hitting merge.

@wenjiaswe
Copy link
Contributor

Thanks @serathius for opening this issue! 6% decrease is not a good trend, let's avoid that.

+1 on adding back per PR test coverage. While itself doesn't guarantee test quality, it definitely help reviewing and encouraging all contributors to pay closer attention to test coverage. @henrybear327 Thank you for taking this!

And we should definitely continue paying attention to identify areas where high coverage is crucial.

@henrybear327
Copy link
Contributor

/assign @henrybear327

@henrybear327
Copy link
Contributor

henrybear327 commented Jun 7, 2024

We actually have codecov running, but we didn't set it to comment on the PR. Testing it now #18143

Update: works! #18143 (comment)

henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 7, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 7, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 7, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 7, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 7, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 8, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 8, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 9, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 9, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 12, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Reference:
- etcd-io#18131

Signed-off-by: Chun-Hung Tseng <[email protected]>
henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 12, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Note: we have some of the tests written in a way that is
non-deterministic across runs, thus, even when there is no code changes
there might still have slight variation for test coverage [2]

Reference:
[1] etcd-io#18131
[2] https://docs.codecov.com/docs/unexpected-coverage-changes#reasons-for-indirect-changes

Signed-off-by: Chun-Hung Tseng <[email protected]>
@henrybear327
Copy link
Contributor

Small notes on test coverage variation across runs #18143 (comment)

henrybear327 added a commit to henrybear327/etcd that referenced this issue Jun 12, 2024
Add missing directory fixing go.etcd.io/etcd/etcdutl/v3/::etcdutl/

Note: we have some of the tests written in a way that is
non-deterministic across runs, thus, even when there is no code changes
there might still have slight variation for test coverage [2]

Reference:
[1] etcd-io#18131
[2] https://docs.codecov.com/docs/unexpected-coverage-changes#reasons-for-indirect-changes

Signed-off-by: Chun-Hung Tseng <[email protected]>
@henrybear327
Copy link
Contributor

I will unassign myself since the PR to improve code coverage is completed, and leave this issue for tracking further test coverage improvement!

@henrybear327 henrybear327 removed their assignment Jul 4, 2024
@ivanvc
Copy link
Member

ivanvc commented Oct 23, 2024

As found in #18767 (comment), the Codecov integration/bot has been adding the following warning to the comment it's posting in the pull requests:

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

At the bottom, it says:

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

It sounds like a GitHub admin would need to install the application. Would this be a reasonable ask (considering the background on rejection of requests they get)? Or should we just keep it as is and ignore the warning?

@jmhbnz
Copy link
Member

jmhbnz commented Oct 23, 2024

As found in #18767 (comment), the Codecov integration/bot has been adding the following warning to the comment it's posting in the pull requests:

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

At the bottom, it says:

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

It sounds like a GitHub admin would need to install the application. Would this be a reasonable ask (considering the background on rejection of requests they get)? Or should we just keep it as is and ignore the warning?

I believe we need to raise a k/org issue similar to kubernetes/org#4439. These have been completed historically so should be ok.

@ivanvc
Copy link
Member

ivanvc commented Oct 23, 2024

I believe we need to raise a k/org issue similar to kubernetes/org#4439. These have been completed historically so should be ok.

Thanks, I'll go ahead and do it.

/assign

@ivanvc
Copy link
Member

ivanvc commented Oct 24, 2024

Opened kubernetes/org#5231 to request the installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants