-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Make the test TestCRIListPodStats pass for Darwin and Windows #62192
Make the test TestCRIListPodStats pass for Darwin and Windows #62192
Conversation
GetPodCgroupNameSuffix is only implemented for Linux, which mean that CPU and Memory stats are only available on Linux. My fix to make the test pass on other OS:es than Linux is to just check CPU and Memory stats on Linux. (This is similar to #57637 which fixed the same problem for the test TestCadvisorListPodStats.)
/ok-to-test |
/retest |
/test pull-kubernetes-cross |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/assign @tallclair |
@@ -206,7 +207,9 @@ func TestCRIListPodStats(t *testing.T) { | |||
checkCRIRootfsStats(assert, c1, containerStats1, nil) | |||
checkCRILogsStats(assert, c1, &rootFsInfo, containerLogStats1) | |||
checkCRINetworkStats(assert, p0.Network, infos[sandbox0.PodSandboxStatus.Id].Stats[0].Network) | |||
checkCRIPodCPUAndMemoryStats(assert, p0, infos[sandbox0Cgroup].Stats[0]) | |||
if runtime.GOOS == "linux" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, usually we prefer to do this at compile time, but since this is just a test I guess it's fine.
@@ -220,7 +223,9 @@ func TestCRIListPodStats(t *testing.T) { | |||
checkCRIRootfsStats(assert, c2, containerStats2, &imageFsInfo) | |||
checkCRILogsStats(assert, c2, &rootFsInfo, containerLogStats2) | |||
checkCRINetworkStats(assert, p1.Network, infos[sandbox1.PodSandboxStatus.Id].Stats[0].Network) | |||
checkCRIPodCPUAndMemoryStats(assert, p1, infos[sandbox1Cgroup].Stats[0]) | |||
if runtime.GOOS == "linux" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: move the check into the checkCRIPodCPUAndMemoryStats
function, (i.e. return if GOOS != linux)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -38,6 +38,7 @@ import ( | |||
kubepodtest "k8s.io/kubernetes/pkg/kubelet/pod/testing" | |||
serverstats "k8s.io/kubernetes/pkg/kubelet/server/stats" | |||
"k8s.io/kubernetes/pkg/volume" | |||
"runtime" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: move into the top import block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feiskyer, patrikerdes, 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 |
/retest |
Automatic merge from submit-queue (batch tested with PRs 62192, 61866, 62206, 62360). If you want to cherry-pick this change to another branch, please follow the instructions here. |
GetPodCgroupNameSuffix is only implemented for Linux, which mean
that CPU and Memory stats are only available on Linux.
My fix to make the test pass on other OS:es than Linux
is to just check CPU and Memory stats on Linux.
(This is similar to #57637 which fixed the same problem for the
test TestCadvisorListPodStats.)
What this PR does / why we need it:
To make all unit tests pass on macOS/Darwin
Which issue(s) this PR fixes:
Fixes #62177
Special notes for your reviewer:
Release note: