diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 57051520299..e8f23c8d535 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -55,7 +55,7 @@ jobs: uses: golangci/golangci-lint-action@v6 with: args: --verbose - + group: 'lint' other: timeout-minutes: 5 name: yaml | shell | imports order diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c6d68f83e6..863b956938c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -281,11 +281,11 @@ jobs: sudo apt-get install -y expect go install -v gotest.tools/gotestsum@v1 - name: "Ensure that the integration test suite is compatible with Docker" - run: ./hack/test-integration.sh -test.target=docker + run: WITH_SUDO=true ./hack/test-integration.sh -test.target=docker - name: "Ensure that the IPv6 integration test suite is compatible with Docker" - run: ./hack/test-integration.sh -test.target=docker -test.only-ipv6 + run: WITH_SUDO=true ./hack/test-integration.sh -test.target=docker -test.only-ipv6 - name: "Ensure that the integration test suite is compatible with Docker (flaky only)" - run: ./hack/test-integration.sh -test.target=docker -test.only-flaky + run: WITH_SUDO=true ./hack/test-integration.sh -test.target=docker -test.only-flaky test-integration-windows: timeout-minutes: 30 diff --git a/hack/test-integration.sh b/hack/test-integration.sh index 220a28f5789..6d760129c7d 100755 --- a/hack/test-integration.sh +++ b/hack/test-integration.sh @@ -21,6 +21,7 @@ readonly root readonly timeout="60m" readonly retries="2" +readonly needsudo="${WITH_SUDO:-}" # See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization args=(--format=testname --jsonfile /tmp/test-integration.log --packages="$root"/../cmd/nerdctl/...) @@ -38,7 +39,11 @@ for arg in "$@"; do fi done -gotestsum "${args[@]}" -- -timeout="$timeout" -p 1 -args -test.allow-kill-daemon "$@" +if [ "$needsudo" != "" ]; then + gotestsum "${args[@]}" -- -timeout="$timeout" -p 1 -exec sudo -args -test.allow-kill-daemon "$@" +else + gotestsum "${args[@]}" -- -timeout="$timeout" -p 1 -args -test.allow-kill-daemon "$@" +fi echo "These are the tests that took more than 10 seconds:" gotestsum tool slowest --threshold 10s --jsonfile /tmp/test-integration.log diff --git a/pkg/testutil/testutil.go b/pkg/testutil/testutil.go index 525225fb996..d34a5c9c775 100644 --- a/pkg/testutil/testutil.go +++ b/pkg/testutil/testutil.go @@ -181,6 +181,9 @@ func (b *Base) EnsureDaemonActive() { ) for i := 0; i < maxRetry; i++ { cmd := exec.Command("systemctl", append(systemctlArgs, "is-active", target)...) + b.T.Log(cmd.Env) + b.T.Log(cmd.Args) + b.T.Log(cmd.Dir) out, err := cmd.CombinedOutput() b.T.Logf("(retry=%d) %s", i, string(out)) if err == nil {