kata-containers / tests

Kata Containers tests, CI, and metrics
https://katacontainers.io/
Apache License 2.0
139 stars 196 forks source link

k8s-cpu-ns.bats fails with cgroup2 #5199

Open mingweishih opened 2 years ago

mingweishih commented 2 years ago

Description of problem

The current k8s-cpu-ns.bats test is cgroup-specific. For example, the test expects /sys/fs/cgroup/cpu/cpu.shares to present, which does not exist when cgroup2 is used (more specifically, when unified_cgroup_hierarchy is true per https://github.com/confidential-containers/kata-containers-CCv0/blob/ffdd7e1ad8da4dff39949639601ad95ecf7f44c9/src/agent/src/mount.rs#L888).

Expected result

Test passes

Actual result

 ✗ Check CPU constraints
   (in test file k8s-cpu-ns.bats, line 52)
     `-- sh -c "cat $sharessyspath")' failed
   INFO: k8s configured to use runtimeclass
   pod/constraints-cpu-test created
   pod/constraints-cpu-test condition met
   cat: can't open '/sys/fs/cgroup/cpu/cpu.shares': No such file or directory
   command terminated with exit code 1
   Name:         constraints-cpu-test
liubin commented 2 years ago

/cc @yaoyinnan