Add test for conmonrs cgroup with no infra container
@@ -5,12 +5,30 @@ load helpers
function setup() {
setup_test
newconfig="$TESTDIR/config.json"
+ if [[ $RUNTIME_TYPE == vm ]]; then
+ skip "not applicable to vm runtime type"
+ fi
+
}
function teardown() {
cleanup_test
}
+function configure_monitor_cgroup_for_conmonrs() {
+ local MONITOR_CGROUP="$1"
+ local NAME=conmonrs
+ cat << EOF > "$CRIO_CONFIG_DIR/01-$NAME.conf"
+[crio.runtime]
+default_runtime = "$NAME"
+[crio.runtime.runtimes.$NAME]
+runtime_path = "$RUNTIME_BINARY_PATH"
+runtime_root = "$RUNTIME_ROOT"
+runtime_type = "$RUNTIME_TYPE"
+monitor_cgroup = "$MONITOR_CGROUP"
+EOF
+}
+
@test "pids limit" {
if ! grep -qEw ^pids /proc/cgroups; then
skip "pids cgroup controller is not available"
@@ -54,6 +72,24 @@ function teardown() {
[[ "$output" == *"customcrioconmon.slice"* ]]
}
+@test "conmonrs custom cgroup with no infra container" {
+ if [[ $RUNTIME_TYPE != pod ]]; then
+ skip "not supported for conmon"
+ fi
+
+ configure_monitor_cgroup_for_conmonrs "customcrioconmon.slice"
+
+ CONTAINER_CGROUP_MANAGER="systemd" CONTAINER_DROP_INFRA_CTR=true start_crio
+
+ jq ' .linux.cgroup_parent = "Burstablecriotest123.slice"' \
+ "$TESTDATA"/sandbox_config.json > "$TESTDIR"/sandbox_config_slice.json
+
+ pod_id=$(crictl runp "$TESTDIR"/sandbox_config_slice.json)
+
+ output=$(systemctl status "crio-conmon-$pod_id.scope")
+ [[ "$output" == *"customcrioconmon.slice"* ]]
+}
+
@test "ctr with swap should be configured" {
if ! grep -v Filename < /proc/swaps; then
skip "swap not enabled"
