Skip to content

Commit

Permalink
Fix alma ci target
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Mar 4, 2025
1 parent 34e44e7 commit d80c2cf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 28 deletions.
50 changes: 39 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ jobs:
matrix:
mode: ["rootful", "rootless"]
runs-on: ubuntu-24.04
env:
MODE: ${{ matrix.mode }}
# FIXME: this is only necessary to access the build cache. To remove with build cleanup.
CONTAINERD_VERSION: v2.0.3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down Expand Up @@ -490,20 +494,44 @@ 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
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}" \
.
- name: "Run integration tests"
run: docker run -t --rm --privileged test-integration
# Presumably, something is broken with the way docker exposes /dev to the container, as it appears to only
# randomly work. Mounting /dev does workaround the issue.
# This might be due to the old kernel shipped with Alma (4.18), or something else between centos/docker.
run: |
set -eux
[ "$MODE" = "rootless" ] && {
echo "rootless"
docker run -t -v /dev:/dev --rm --privileged test-integration /test-integration-rootless.sh ./hack/test-integration.sh -test.only-flaky=false
} || {
echo "rootful"
docker run -t -v /dev:/dev --rm --privileged test-integration ./hack/test-integration.sh -test.only-flaky=false
}
- name: "Run integration tests (flaky)"
run: |
set -eux
[ "$MODE" = "rootless" ] && {
echo "rootless"
docker run -t -v /dev:/dev --rm --privileged test-integration /test-integration-rootless.sh ./hack/test-integration.sh -test.only-flaky=true
} || {
echo "rootful"
docker run -t -v /dev:/dev --rm --privileged test-integration ./hack/test-integration.sh -test.only-flaky=true
}
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 @@ -23,7 +23,6 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"testing"

"gotest.tools/v3/assert"
Expand All @@ -37,7 +36,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 @@ -230,14 +228,6 @@ func TestRunDevice(t *testing.T) {

testCase.Require = nerdtest.Rootful

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)

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 d80c2cf

Please sign in to comment.