From 1b11fcee331288cd5e21ce9fe2dd0df51e02009c Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 3 Apr 2020 23:12:43 -0700 Subject: [PATCH] Enable integration tests in cgroupv2 env Those needs to be run on the (Vagrant Fedora 31) host (since we need real systemd running), and so we have to have all the tools needed to compile runc and run the tests. The good news is Fedora packages a decent and recent release of bats-core (1.1.0), which we can use (Debian does not), and we can also use golang (currently 1.13.9) from Fedora. The bad news are 1. Currently cgroups tests are only working with RUNC_USE_SYSTEMD=yes (addressed by #2299, #2305) 2. Some tests that are not yet working: - ps.bats with RUNC_USE_SYSTEMD=yes (investigating) - events.bats (need cgroupv2 memory.events support) [v2: add -t to ssh to enforce pty] Signed-off-by: Kir Kolyshkin --- .travis.yml | 2 ++ Vagrantfile | 2 +- tests/integration/events.bats | 12 ++++++++---- tests/integration/ps.bats | 3 +++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e12b820bfd..0eedb79d376 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,8 @@ matrix: - sudo ssh default sudo podman build -t test /vagrant # Mounting /lib/modules into the container is necessary as CRIU wants to load (via iptables) additional modules - sudo ssh default sudo podman run --privileged --cgroupns=private -v /lib/modules:/lib/modules:ro test make localunittest + # Test on the vagrant host itself since we need systemd + - sudo ssh default -t 'cd /vagrant && sudo make localintegration RUNC_USE_SYSTEMD=yes' allow_failures: - go: tip diff --git a/Vagrantfile b/Vagrantfile index 165b078018d..1649d83e384 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -13,6 +13,6 @@ Vagrant.configure("2") do |config| v.cpus = 2 end config.vm.provision "shell", inline: <<-SHELL - dnf install -y podman + dnf install -y podman git-core make golang-go libseccomp-devel bats jq SHELL end diff --git a/tests/integration/events.bats b/tests/integration/events.bats index b3e6315b555..8f2f81a23d0 100644 --- a/tests/integration/events.bats +++ b/tests/integration/events.bats @@ -13,7 +13,8 @@ function teardown() { @test "events --stats" { # XXX: currently cgroups require root containers. - requires root + # TODO: support cgroup v2 memory.events + requires root cgroups_v1 # run busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox @@ -28,7 +29,8 @@ function teardown() { @test "events --interval default " { # XXX: currently cgroups require root containers. - requires root + # TODO: support cgroup v2 memory.events + requires root cgroups_v1 # run busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox @@ -55,7 +57,8 @@ function teardown() { @test "events --interval 1s " { # XXX: currently cgroups require root containers. - requires root + # TODO: support cgroup v2 memory.events + requires root cgroups_v1 # run busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox @@ -81,7 +84,8 @@ function teardown() { @test "events --interval 100ms " { # XXX: currently cgroups require root containers. - requires root + # TODO: support cgroup v2 memory.events + requires root cgroups_v1 # run busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox diff --git a/tests/integration/ps.bats b/tests/integration/ps.bats index 646b5ab7090..824b6bfb1fe 100644 --- a/tests/integration/ps.bats +++ b/tests/integration/ps.bats @@ -14,6 +14,7 @@ function teardown() { @test "ps" { # ps is not supported, it requires cgroups requires root + [ -n "${RUNC_USE_SYSTEMD}" ] && skip "test does not yet work with systemd" # start busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox @@ -31,6 +32,7 @@ function teardown() { @test "ps -f json" { # ps is not supported, it requires cgroups requires root + [ -n "${RUNC_USE_SYSTEMD}" ] && skip "test does not yet work with systemd" # start busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox @@ -47,6 +49,7 @@ function teardown() { @test "ps -e -x" { # ps is not supported, it requires cgroups requires root + [ -n "${RUNC_USE_SYSTEMD}" ] && skip "test does not yet work with systemd" # start busybox detached runc run -d --console-socket $CONSOLE_SOCKET test_busybox