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

Improve unit test coverage in pkg/util/taints/ #108332

Merged
merged 1 commit into from Sep 16, 2022

Conversation

mengjiao-liu
Copy link
Member

@mengjiao-liu mengjiao-liu commented Feb 24, 2022

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

The changes are as follows:

  • Improve test coverage: add unit tests in pkg/util/tail
  • Improve test readability by fixing previous code variables that could easily be changed

Run test coverage command:

go test -cover ./pkg/util/taints

Befor:

ok      k8s.io/kubernetes/pkg/util/taints       0.752s  coverage: 89.0% of statements

After(When unused methods are removed, test coverage becomes 100% #112436):

ok      k8s.io/kubernetes/pkg/util/taints       0.932s  coverage: 98.7% of statements

Which issue(s) this PR fixes:

Ref #97355

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 24, 2022
@mengjiao-liu
Copy link
Member Author

/sig testing
/area test

@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. area/test and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 24, 2022
@mengjiao-liu mengjiao-liu changed the title Improve unit test coverage in pkg/util/tail/ Improve unit test coverage in pkg/util/taint/ Feb 25, 2022
@mengjiao-liu mengjiao-liu changed the title Improve unit test coverage in pkg/util/taint/ Improve unit test coverage in pkg/util/taints/ Feb 25, 2022
@mengjiao-liu
Copy link
Member Author

/assign @dchen1107

@mengjiao-liu
Copy link
Member Author

/kind cleanup
/remove-kind feature

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Mar 18, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 27, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 10, 2022
@mengjiao-liu
Copy link
Member Author

Rebased.

@mengjiao-liu
Copy link
Member Author

/retest

@mengjiao-liu
Copy link
Member Author

ping @lavalamp @dchen1107

@mengjiao-liu
Copy link
Member Author

This PR has been waiting for a review for a long time. Could you please take a look at this PR?@dchen1107 @dims @lavalamp @smarterclayton @thockin

@alculquicondor
Copy link
Member

/unassign

feel free to proceed without my review.

@mengjiao-liu
Copy link
Member Author

Please review again and determine if you can agree. Thanks! @MadhavJivrajani

@mengjiao-liu
Copy link
Member Author

The modification has been completed. Request approval @dims @MadhavJivrajani

Copy link
Member

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

Nice work

/triage accepted
/lgtm

pkg/util/taints/taints.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 13, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 13, 2022
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 14, 2022
@mengjiao-liu
Copy link
Member Author

PR #112436 has been merged, and the taints package test coverage has become 100%

$ go test -cover ./pkg/util/taints
ok      k8s.io/kubernetes/pkg/util/taints       1.141s  coverage: 100.0% of statements

@oomichi
Copy link
Member

oomichi commented Sep 16, 2022

PR #112436 has been merged, and the taints package test coverage has become 100%

$ go test -cover ./pkg/util/taints
ok      k8s.io/kubernetes/pkg/util/taints       1.141s  coverage: 100.0% of statements

Thanks for separating the pull request. This new one seems simpler than the previous one.
The unit-test coverage improvement is nice anyways :-)

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 16, 2022
@aojea
Copy link
Member

aojea commented Sep 16, 2022

just a nit, lgtm

/assign @liggitt
for approval

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 16, 2022
… easily be changed and

improve unit test coverage in `pkg/util/taints/taints_test.go`
@liggitt
Copy link
Member

liggitt commented Sep 16, 2022

/approve

@liggitt
Copy link
Member

liggitt commented Sep 16, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 16, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, mengjiao-liu

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 16, 2022
@k8s-ci-robot k8s-ci-robot merged commit da9d8a9 into kubernetes:master Sep 16, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants