chore: fix test failure (#3883)

master
Kevin Wan 9 months ago committed by GitHub
parent 93d257f9f5
commit 786a80131e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -12,19 +12,21 @@ func TestRunningInUserNS(t *testing.T) {
assert.False(t, runningInUserNS())
}
func TestCgroupV1(t *testing.T) {
if isCgroup2UnifiedMode() {
func TestCgroups(t *testing.T) {
// test cgroup legacy(v1) & hybrid
if !isCgroup2UnifiedMode() {
cg, err := currentCgroupV1()
assert.NoError(t, err)
_, err = cg.effectiveCpus()
assert.Error(t, err)
assert.NoError(t, err)
_, err = cg.cpuQuota()
assert.Error(t, err)
assert.NoError(t, err)
_, err = cg.cpuUsage()
assert.Error(t, err)
assert.NoError(t, err)
}
// test cgroup v2
if isCgroup2UnifiedMode() {
cg, err := currentCgroupV2()
assert.NoError(t, err)
_, err = cg.effectiveCpus()
@ -33,6 +35,7 @@ func TestCgroupV1(t *testing.T) {
assert.Error(t, err)
_, err = cg.cpuUsage()
assert.NoError(t, err)
}
}
func TestParseUint(t *testing.T) {

Loading…
Cancel
Save