Skip to content

integration/container: migrate StatsNoStreamGetCPU test#52159

Open
deahtstroke wants to merge 1 commit intomoby:masterfrom
deahtstroke:50159-migrate-testAPINoStreamGetCPU
Open

integration/container: migrate StatsNoStreamGetCPU test#52159
deahtstroke wants to merge 1 commit intomoby:masterfrom
deahtstroke:50159-migrate-testAPINoStreamGetCPU

Conversation

@deahtstroke
Copy link
Copy Markdown

- What I did
Migrated the test TestAPIStatsNoStreamGetCPU from the integration-cli to integration test suite. Additionally removed the Cgroups v2 skip since we can calculate CPU usage without relying on missing fields from Cgroupvs2, namely CPUStats.CPUUsage.PercpuUsage
- How I did it
Rewriting the test using the Go-client and moving it to the integration/ module
- How to verify it
Running the following command:
TESTDIRS='./integration/container/' TESTFLAGS='-test.run TestStatsNoStreamGetCPU' make test-integration
- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)
image

@deahtstroke deahtstroke force-pushed the 50159-migrate-testAPINoStreamGetCPU branch 2 times, most recently from c2e741a to 088d262 Compare March 14, 2026 01:37
@deahtstroke
Copy link
Copy Markdown
Author

There seems to be a race condition issue with oracle-linux 8 using Cgroups V1. Added polling for CPU stats to overcome this. Ran into the same issue in my other PR regarding network stats.

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

thanks! overall LGTM; I left two small comments / suggestions; no hard blockers, but let me know what you think!

Comment thread integration/container/stats_test.go Outdated

var res client.ContainerStatsResult

poll.WaitOn(t, func(t poll.LogT) poll.Result {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was the poll added for the Oracle VM? If so, it could be good to add a very short comment (and/or link to your comment on GitHub?) to explain we (only?) needed it for that test-environment.

Having a bit of a breadcrumb to know "why did we need this?" can help deciding in future if it's still needed.

Comment thread integration/container/stats_test.go Outdated
}

return poll.Success()
}, poll.WithDelay(pollDelay), poll.WithTimeout(pollTimeout))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like those variables are only used here; perhaps would be fine to just inline them

@deahtstroke
Copy link
Copy Markdown
Author

CI still red, hmm... the other PR had a smaller timeout, but I see that is still erroring as well. Also im working on implementing the changes you suggested 😄

@thaJeztah
Copy link
Copy Markdown
Member

The VM tests are flaky in general, so could be unrelated, but yeah, possibly it needs tweaking. Also worth noting that they are in CI for cgroups v1 tests, so it's possible those tests were skipped elsewhere / in the old location (haven't checked 😅)

@deahtstroke
Copy link
Copy Markdown
Author

I still want to try myself at replicating the issue, I have x86 hardware lying around somewhere, if I'm not able to replicate it should I just skip Cgroups V1?

@deahtstroke
Copy link
Copy Markdown
Author

The VM tests are flaky in general, so could be unrelated, but yeah, possibly it needs tweaking. Also worth noting that they are in CI for cgroups v1 tests, so it's possible those tests were skipped elsewhere / in the old location (haven't checked 😅)

Is this failure specific to running in rootless mode with cgroups v1? After some digging, this combination seems fundamentally broken. Rootless Docker wants me to use cgroups v2, running docker info even discourages me from using cgroups v1, so container stats are unreliable or unavailable in this environment. Should this test just be skipped when running rootless with cgroups v1?

@AkihiroSuda
Copy link
Copy Markdown
Member

Is this failure specific to running in rootless mode with cgroups v1? After some digging, this combination seems fundamentally broken. Rootless Docker wants me to use cgroups v2, running docker info even discourages me from using cgroups v1, so container stats are unreliable or unavailable in this environment. Should this test just be skipped when running rootless with cgroups v1?

Yes, it should be skipped

@deahtstroke deahtstroke force-pushed the 50159-migrate-testAPINoStreamGetCPU branch from 088d262 to 205b843 Compare March 31, 2026 22:20
@deahtstroke deahtstroke requested a review from tianon as a code owner April 2, 2026 21:15
@deahtstroke deahtstroke force-pushed the 50159-migrate-testAPINoStreamGetCPU branch from 55b8cac to 81c6337 Compare April 2, 2026 21:20
@deahtstroke
Copy link
Copy Markdown
Author

Hi, its me again with a rebase issue. Labeller picked up on it and punished me. I fixed the PR itself but the labels are definitely wrong, should only have testing. Sorry.

@deahtstroke
Copy link
Copy Markdown
Author

I removed the polling in the new test since the polling was added for Cgroups V1 + Rootless, now we're just skipping that.

@deahtstroke deahtstroke force-pushed the 50159-migrate-testAPINoStreamGetCPU branch from 84a058e to 404d22c Compare April 24, 2026 02:55
@deahtstroke
Copy link
Copy Markdown
Author

A lot of failing CI workflows, the vm one however isn't failing due to my test. Genuine question: What went wrong with the failing windows-2025 CI? 🤔 I see a "pulled access denied", an "unable to connect to Docker API", some artifacts and files not found.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants