tests/from.bats "from cpu-shares test": update cgroupv2 weights#6674
tests/from.bats "from cpu-shares test": update cgroupv2 weights#6674lsm5 merged 1 commit intocontainers:mainfrom
Conversation
|
Ephemeral COPR build failed. @containers/packit-build please check. |
2 similar comments
|
Ephemeral COPR build failed. @containers/packit-build please check. |
|
Ephemeral COPR build failed. @containers/packit-build please check. |
|
/packit rebuild-failed |
tests/bud.bats
Outdated
There was a problem hiding this comment.
Oof, neither. Dropped them.
8a5ee32 to
ed61bb1
Compare
lsm5
left a comment
There was a problem hiding this comment.
LGTM, apart from couple of nit questions.
tests/from.bats
Outdated
| # https://kubernetes.io/blog/2026/01/30/new-cgroup-v1-to-v2-cpu-conversion-formula/ | ||
| # there's an old way to convert the value, and a new way to convert the value, and we | ||
| # don't know which one our runtime is using, so accept the values that either would | ||
| # compute for ${shares} | ||
| local oldconverted="$((1 + ((${shares} - 2) * 9999) / 262142))" | ||
| test -n "$oldconverted" | ||
| local oldexpect="weight ${oldconverted}" | ||
| local newconverted=$(awk '{if ($1 <= 2) { print "1"} else if ($1 >= 262144) {print "10000"} else {l=log($1)/log(2); e=((((l+125)*l)/612.0) - 7.0/34.0); p = exp(e*log(10)); if ( p == int(p) ) {print p} else { print int(p+1) }}}' <<< "${shares}") | ||
| test -n "$newconverted" | ||
| local newexpect="weight ${newconverted}" | ||
| local expect="($oldexpect|$newexpect)" |
There was a problem hiding this comment.
This block seems to be a repeat of tests/bud.bats. Can it be made reusable? Ignore comment if overkill.
There was a problem hiding this comment.
Factored into a helper function.
Update the weights expected in the "from cpu-shares test" test to account for both the old way that runtimes would convert from cgroupsv1 cpu shares to cgroupsv2 cpu weights, and the new way, catching it up with the "bud with --cpu-shares, checked" test, which will now also check with a few different values. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
ed61bb1 to
17e30d5
Compare
|
LGTM |
|
I think that testing-farm:fedora-rawhide-x86_64:buildah-fedora failure's a bug. I can't quite figure how we didn't notice it at the time, but the helper the new tests in #6675 use isn't packaged in the RPM. I added a commit that should fix it to the tip of #6705 because that's where I noticed what was going on. |
Was the rawhide test triggered 2 days ago separately? That would explain why only rawhide caught it and the others passed (those ran 2 weeks ago). |
LGTM'd that one. Thanks! |
|
#6705 is merged. So, I guess we can ignore the CI failure here and merge this. |
I'm not sure I follow. We run it for every PR, right? |
What type of PR is this?
/kind other
What this PR does / why we need it:
Update the weights expected in the "from cpu-shares test" test to account for both the old way that runtimes would convert from cgroupsv1 cpu shares to cgroupsv2 cpu weights, and the new way, catching it up with the "bud with --cpu-shares, checked" test, which will now also check with a few different values.
How to verify it
Updated tests!
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?