cgroupv2: skip tests on containerd < 1.4

containerd < 1.4 does not support cgroupv2, so we adjust the Make
targets and installer scripts to skip test run on those versions.

Signed-off-by: Daniel Dao <dqminh89@gmail.com>
This commit is contained in:
Daniel Dao 2021-02-04 13:53:48 +00:00
parent 5e984d5aa2
commit 51f39a1204
No known key found for this signature in database
GPG Key ID: ECAB2B462D43B768
2 changed files with 22 additions and 1 deletions

View File

@ -113,6 +113,12 @@ RUNTIME_BIN := $(RUNTIME_DIR)/runsc
RUNTIME_LOG_DIR := $(RUNTIME_DIR)/logs
RUNTIME_LOGS := $(RUNTIME_LOG_DIR)/runsc.log.%TEST%.%TIMESTAMP%.%COMMAND%
ifeq ($(shell stat -f -c "%T" /sys/fs/cgroup 2>/dev/null),cgroup2fs)
CGROUPV2 := true
else
CGROUPV2 := false
endif
$(RUNTIME_BIN): # See below.
@mkdir -p "$(RUNTIME_DIR)"
ifeq (,$(STAGED_BINARIES))
@ -204,7 +210,7 @@ tests: unit-tests nogo-tests container-tests syscall-tests
integration-tests: ## Run all standard integration tests.
integration-tests: docker-tests overlay-tests hostnet-tests swgso-tests
integration-tests: do-tests kvm-tests containerd-test-1.3.9
integration-tests: do-tests kvm-tests containerd-tests-min
.PHONY: integration-tests
network-tests: ## Run all networking integration tests.
@ -320,10 +326,19 @@ else
endif
@$(call sudo,test/root:root_test,--runtime=$(RUNTIME) -test.v)
ifeq ($(CGROUPV2),false)
containerd-tests-min: containerd-test-1.3.9
else
containerd-tests-min: containerd-test-1.4.3
endif
# The shim builds with containerd 1.3.9 and it's not backward compatible. Test
# with 1.3.9 and newer versions.
# When run under cgroupv2 environment, skip 1.3.9 as it does not support cgroupv2
containerd-tests: ## Runs all supported containerd version tests.
ifeq ($(CGROUPV2),false)
containerd-tests: containerd-test-1.3.9
endif
containerd-tests: containerd-test-1.4.3
containerd-tests: containerd-test-1.5.4

View File

@ -26,6 +26,12 @@ if [[ "${CONTAINERD_MAJOR}" -eq 1 ]] && [[ "${CONTAINERD_MINOR}" -le 4 ]]; then
export GO111MODULE=off
fi
# containerd < 1.4 doesn't work with cgroupv2 setup, so we check for that here
if [[ "$(stat -f -c %T /sys/fs/cgroup 2>/dev/null)" -eq "cgroup2fs" && "${CONTAINERD_MAJOR}" -eq 1 && "${CONTAINERD_MINOR}" -lt 4 ]]; then
echo "containerd < 1.4 does not work with cgroup2"
exit 1
fi
# Helper for Go packages below.
install_helper() {
declare -r PACKAGE="${1}"