Skip to content

kubelet: don't import testing dependency in non-test code #131800

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

BenTheElder
Copy link
Member

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Refactors NewFakeHostStatsProvider to take an injected kubecontainer.OSInterface just like NewFakeHostStatsProviderWithData which already took an injected kubecontainer.OSInterface.

This prevents importing a testing package into non-test files, so we can enforce not linking test packages into prod binaries.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Span out from #131750 where we're working on catching testing-imports-in-prod-binaries more generally.

Does this PR introduce a user-facing change?

NONE

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


/sig node testing

refactor NewFakeHostStatsProvider to take an injected kubecontainer.OSInterface just like NewFakeHostStatsProviderWithData

this prevents importing a testing package into non-test files, so we can enforce not linking test packages into prod binaries
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels May 15, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 15, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added 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. area/kubelet labels May 15, 2025
@k8s-ci-robot k8s-ci-robot requested review from dchen1107 and tzneal May 15, 2025 19:48
@BenTheElder
Copy link
Member Author

/cc @tallclair

@k8s-ci-robot k8s-ci-robot requested a review from tallclair May 15, 2025 19:49
@k8s-ci-robot
Copy link
Contributor

@BenTheElder: 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
pull-kubernetes-unit-windows-master 139fab0 link false /test pull-kubernetes-unit-windows-master

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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

@BenTheElder
Copy link
Member Author

BenTheElder commented May 15, 2025

https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/131800/pull-kubernetes-unit-windows-master/1923103061438369792

does not appear related:

k8s.io/kubernetes/cmd/kubeadm/test: cmd
{Failed  === RUN   TestCmdConfigImagesList/valid:_latest_stable_Kubernetes_version_should_not_throw_the_warning_that_a_supported_etcd_version_cannot_be_found
    config_test.go:46: failed CmdConfigImagesList running 'kubeadm config images list --v=1 --kubernetes-version=stable-1' with stderr output:
        
        	  expected: false
        	  actual: true
        
        FYI: This usually indicates that the 'SupportedEtcdVersion' map defined in 'cmd/kubeadm/app/constants/constants.go' needs to be updated.
--- FAIL: TestCmdConfigImagesList/valid:_latest_stable_Kubernetes_version_should_not_throw_the_warning_that_a_supported_etcd_version_cannot_be_found (1.19s)

=== RUN   TestCmdConfigImagesList
--- FAIL: TestCmdConfigImagesList (1.19s)
}

@aojea
Copy link
Member

aojea commented May 16, 2025

that job seems to be failing for a long time https://prow.k8s.io/job-history/gs/kubernetes-ci-logs/pr-logs/directory/pull-kubernetes-unit-windows-master, it should not be showing on the PR if is so flake cc: @kubernetes/sig-windows-bugs

/lgtm
/approve

/assign @SergeyKanzhelev @tallclair

@k8s-ci-robot k8s-ci-robot added sig/windows Categorizes an issue or PR as relevant to SIG Windows. kind/bug Categorizes issue or PR as related to a bug. labels May 16, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 16, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e6f0f81d4435d76f7ee5cf15c8915da695fc0822

@tallclair
Copy link
Member

/lgtm
/approve

Thanks

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, BenTheElder, tallclair

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 May 16, 2025
@k8s-ci-robot k8s-ci-robot merged commit b6bff1b into kubernetes:master May 16, 2025
14 of 15 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.34 milestone May 16, 2025
@BenTheElder BenTheElder deleted the kubelet-testing branch May 17, 2025 00:45
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/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. 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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. sig/windows Categorizes an issue or PR as relevant to SIG Windows. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Development

Successfully merging this pull request may close these issues.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy