Skip to content

Commit

Permalink
Fix alma ci target
Browse files Browse the repository at this point in the history
Ensure alma test are ran against the right version of containerd, ubuntu and rootlesskit inside the container.

Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Mar 3, 2025
1 parent 088fe02 commit 52d5679
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
49 changes: 34 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,9 @@ jobs:
docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7
- name: "Prepare integration test environment"
run: |
sudo apt-get install -y expect
go install -v gotest.tools/gotestsum@v1
# FIXME: remove when we are done removing unbuffer from tests
sudo apt-get install -qq expect
make install-dev-tools
- name: "Ensure that the integration test suite is compatible with Docker"
run: WITH_SUDO=true ./hack/test-integration.sh -test.target=docker
- name: "Ensure that the IPv6 integration test suite is compatible with Docker"
Expand Down Expand Up @@ -400,13 +401,13 @@ jobs:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
sudo apt-get update
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant ovmf
sudo apt-get update -qq
sudo apt-get install -qq --no-install-recommends libvirt-daemon libvirt-daemon-system vagrant ovmf
# https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1725#issuecomment-1454058646
sudo cp /usr/share/OVMF/OVMF_VARS_4M.fd /var/lib/libvirt/qemu/nvram/
sudo systemctl enable --now libvirtd
sudo apt-get build-dep -y ruby-libvirt
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
sudo apt-get install -qq --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
sudo vagrant plugin install vagrant-libvirt
- name: Boot VM
run: |
Expand All @@ -427,15 +428,19 @@ jobs:
matrix:
mode: ["rootful", "rootless"]
runs-on: ubuntu-24.04
env:
UBUNTU_VERSION: 20.04
CONTAINERD_VERSION: v1.6.36
ROOTLESSKIT_VERSION: v1.1.1
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 1
- name: "Install QEMU"
run: |
set -eux
sudo apt-get update
sudo apt-get -qq install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
sudo apt-get update -qq
sudo apt-get install -qq --no-install-recommends ovmf qemu-system-x86 qemu-utils
sudo modprobe kvm
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
sudo chown $(whoami) /dev/kvm
Expand Down Expand Up @@ -488,20 +493,34 @@ jobs:
echo "DOCKER_HOST=${DOCKER_HOST}" >>$GITHUB_ENV
docker info
docker version
- name: "Expose GitHub Runtime variables for gha"
uses: crazy-max/ghaction-github-runtime@b3a9207c0e1ef41f4cf215303c976869d0c2c1c4 # v3.0.0
- name: "Prepare integration tests"
env:
MODE: ${{ matrix.mode }}
run: |
set -eux
TARGET=test-integration
[ "$MODE" = "rootless" ] && TARGET=test-integration-rootless
docker build -t test-integration --target "${TARGET}" .
# losetup not working as expected on EL8?
# > === FAIL: cmd/nerdctl/container TestRunDevice (0.44s)
# > container_run_cgroup_linux_test.go:236: assertion failed: error is not nil: loopback setup failed ([losetup --find --show /tmp/containerd-test-loopback3931357228]):
# > stdout="", stderr="losetup: /tmp/containerd-test-loopback3931357228: failed to set up loop device: No such file or directory\n": exit status 1
# https://github.com/containerd/nerdctl/pull/3904#issuecomment-2670917820
sudo losetup -Dv
sudo losetup -lv
# Presumably, docker already did screw the pooch wrt /dev, so bounce it
sudo setenforce 0
sudo systemctl stop docker
docker info
sudo systemctl start docker
docker info
TARGET=test-integration
[ "$MODE" = "rootless" ] && TARGET=test-integration-rootless
docker buildx create --name with-gha --use
docker buildx build \
--output=type=docker \
--cache-from type=gha,scope=amd64-${CONTAINERD_VERSION} \
-t test-integration --target "${TARGET}" \
--build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \
--build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} \
--build-arg ROOTLESSKIT_VERSION=${ROOTLESSKIT_VERSION} \
.
- name: "Run integration tests"
run: docker run -t --rm --privileged test-integration
10 changes: 0 additions & 10 deletions cmd/nerdctl/container/container_run_cgroup_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"testing"

"github.com/moby/sys/userns"
Expand All @@ -35,7 +34,6 @@ import (

"github.com/containerd/nerdctl/v2/pkg/cmd/container"
"github.com/containerd/nerdctl/v2/pkg/idutil/containerwalker"
"github.com/containerd/nerdctl/v2/pkg/infoutil"
"github.com/containerd/nerdctl/v2/pkg/testutil"
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
)
Expand Down Expand Up @@ -228,14 +226,6 @@ func TestRunDevice(t *testing.T) {
t.Skip("test requires the root in the initial user namespace")
}

if unameR := infoutil.UnameR(); strings.Contains(unameR, ".el8") {
t.Logf("Assuming to be running on EL8 (kernel release %q)", unameR)
t.Skip("FIXME: loopback.New fails on EL8 (when the test is executed inside a container) https://github.com/containerd/nerdctl/pull/3904#issuecomment-2670917820")
// > === FAIL: cmd/nerdctl/container TestRunDevice (0.44s)
// > container_run_cgroup_linux_test.go:236: assertion failed: error is not nil: loopback setup failed ([losetup --find --show /tmp/containerd-test-loopback3931357228]):
// > stdout="", stderr="losetup: /tmp/containerd-test-loopback3931357228: failed to set up loop device: No such file or directory\n": exit status 1
}

const n = 3
lo := make([]*loopback.Loopback, n)
loContent := make([]string, n)
Expand Down
7 changes: 0 additions & 7 deletions cmd/nerdctl/container/container_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ package container

import (
"runtime"
"strings"
"testing"

"github.com/containerd/nerdctl/mod/tigron/expect"
"github.com/containerd/nerdctl/mod/tigron/require"
"github.com/containerd/nerdctl/mod/tigron/test"

"github.com/containerd/nerdctl/v2/pkg/infoutil"
"github.com/containerd/nerdctl/v2/pkg/testutil"
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
)
Expand All @@ -45,11 +43,6 @@ func TestStats(t *testing.T) {
)
}

if unameR := infoutil.UnameR(); strings.Contains(unameR, ".el8") {
t.Logf("Assuming to be running on EL8 (kernel release %q)", unameR)
t.Skip("FIXME: the test seems to hang on EL8: https://github.com/containerd/nerdctl/pull/3904#issuecomment-2693931822")
}

testCase.Cleanup = func(data test.Data, helpers test.Helpers) {
helpers.Anyhow("rm", "-f", data.Identifier("container"))
helpers.Anyhow("rm", "-f", data.Identifier("memlimited"))
Expand Down

0 comments on commit 52d5679

Please sign in to comment.