Skip to content

Commit fe55399

Browse files
fix: Make cpu share test backward compatible (#268)
Signed-off-by: Shubhranshu Mahapatra <shubhum@amazon.com>
1 parent 59423aa commit fe55399

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,8 @@ func Run(o *RunOption) {
605605
// Ref. https://github.com/opencontainers/runc/pull/4785
606606
cpuWeight := command.StdoutStr(o.BaseOpt, "run", "--rm", "--cpu-shares", "2000",
607607
"-w", "/sys/fs/cgroup", localImages[defaultImage], "cat", "cpu.weight")
608-
gomega.Expect(cpuWeight).To(gomega.Equal("170"))
608+
// Different runc versions <1.3.2 will produce different values: 170 (newer) or 77 (older)
609+
gomega.Expect(cpuWeight).To(gomega.Or(gomega.Equal("170"), gomega.Equal("77")))
609610
})
610611

611612
// assume the host has at least 2 CPUs

0 commit comments

Comments
 (0)