chore: fix test failure (#3883)

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

@ -12,27 +12,30 @@ 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
cg, err := currentCgroupV2()
assert.NoError(t, err)
_, err = cg.effectiveCpus()
assert.NoError(t, err)
_, err = cg.cpuQuota()
assert.Error(t, err)
_, err = cg.cpuUsage()
assert.NoError(t, err)
if isCgroup2UnifiedMode() {
cg, err := currentCgroupV2()
assert.NoError(t, err)
_, err = cg.effectiveCpus()
assert.NoError(t, err)
_, err = cg.cpuQuota()
assert.Error(t, err)
_, err = cg.cpuUsage()
assert.NoError(t, err)
}
}
func TestParseUint(t *testing.T) {

Loading…
Cancel
Save