Skip to content

Commit

Permalink
Tests adjustments
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
  • Loading branch information
apostasie committed Oct 9, 2024
1 parent 5151af6 commit cd2c625
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ghcr-image-build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Container Image Build
name: image publish

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: lint

on:
push:
branches:
- main
- 'release/**'
pull_request:

env:
GO_VERSION: 1.23.x

jobs:
go:
timeout-minutes: 5
name: go ${{ matrix.goos }} ${{ matrix.gonext }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- os: ubuntu-24.04
goos: linux
- os: ubuntu-24.04
goos: freebsd
# FIXME: this is currently failing in a non-sensical way, so, running on linux instead...
# - os: windows-2022
- os: ubuntu-24.04
goos: windows
- os: ubuntu-24.04
goos: linux
# This allows the canary script to select any upcoming golang alpha/beta/RC
gonext: next
- os: ubuntu-24.04
goos: freebsd
gonext: next
- os: ubuntu-24.04
goos: windows
gonext: next
env:
GOOS: "${{ matrix.goos }}"
steps:
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- name: Set GO env
run: |
# If gonext is specified, get the latest available golang pre-release instead of the major version
if [ "$gonext" != "" ]; then
. ./hack/build-integration-canary.sh
canary::golang::latest
fi
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --verbose

other:
timeout-minutes: 5
name: yaml, shell, import order
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: yaml
run: make lint-yaml
- name: shell
run: make lint-shell
- name: go imports ordering
run: |
go install -v github.com/incu6us/goimports-reviser/v3@latest
make lint-imports
31 changes: 7 additions & 24 deletions .github/workflows/test-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
lint:
runs-on: "ubuntu-24.04"
timeout-minutes: 20
steps:
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- name: Set GO env
run: |
. ./hack/build-integration-canary.sh
canary::golang::latest
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6.1.1
with:
args: --verbose

linux:
runs-on: "ubuntu-24.04"
timeout-minutes: 40
Expand Down Expand Up @@ -66,10 +45,12 @@ jobs:
run: go test -v ./pkg/...
- name: "Run integration tests"
run: docker run -t --rm --privileged test-integration ./hack/test-integration.sh
- name: "Run integration tests (flaky)"
run: docker run -t --rm --privileged test-integration ./hack/test-integration.sh -test.only-flaky

windows:
runs-on: windows-latest
timeout-minutes: 30
runs-on: windows-latest
defaults:
run:
shell: bash
Expand All @@ -95,6 +76,7 @@ jobs:
cache: true
check-latest: true
- run: go install ./cmd/nerdctl
- run: go install -v gotest.tools/gotestsum@v1
# This here is solely to get the cni install script, which has not been modified in 3+ years.
# There is little to no reason to update this to latest containerd
- uses: actions/checkout@v4.2.1
Expand All @@ -112,5 +94,6 @@ jobs:
ctrdVersion: ${{ env.CONTAINERD_VERSION }}
run: powershell hack/configure-windows-ci.ps1
- name: "Run integration tests"
# See https://github.com/containerd/nerdctl/blob/main/docs/testing/README.md#about-parallelization
run: go test -p 1 -v ./cmd/nerdctl/...
run: ./hack/test-integration.sh
- name: "Run integration tests (flaky)"
run: ./hack/test-integration.sh -test.only-flaky
5 changes: 2 additions & 3 deletions .github/workflows/test-kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ on:
paths-ignore:
- '**.md'

env:
ROOTFUL: true

jobs:
linux:
runs-on: "ubuntu-24.04"
timeout-minutes: 40
env:
ROOTFUL: true
steps:
- uses: actions/checkout@v4.2.1
with:
Expand Down
98 changes: 23 additions & 75 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,10 @@ env:
LONG_TIMEOUT: 60

jobs:
lint-go:
test-unit:
# Supposed to work: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-returning-a-json-data-type
# Apparently does not
# timeout-minutes: ${{ fromJSON(env.SHORT_TIMEOUT) }}
timeout-minutes: 5
name: lint-go ${{ matrix.goos }}
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- os: ubuntu-24.04
goos: linux
- os: ubuntu-24.04
goos: freebsd
# FIXME: this is currently failing in a non-sensical way, so, running on linux instead...
# - os: windows-2022
- os: ubuntu-24.04
goos: windows
env:
GOOS: "${{ matrix.goos }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --verbose

lint-other:
timeout-minutes: 5
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: yaml
run: make lint-yaml
- name: shell
run: make lint-shell
- name: go imports ordering
run: |
go install -v github.com/incu6us/goimports-reviser/v3@latest
make lint-imports
test-unit:
timeout-minutes: 5
name: unit ${{ matrix.goos }}
runs-on: "${{ matrix.os }}"
Expand All @@ -83,7 +31,7 @@ jobs:
- os: ubuntu-24.04
goos: linux
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- uses: actions/setup-go@v5
Expand All @@ -96,7 +44,7 @@ jobs:

test-integration:
timeout-minutes: 60
name: integration ${{ matrix.containerd }} ${{ matrix.runner }}
name: rootful ${{ matrix.containerd }} ${{ matrix.runner }}
runs-on: "${{ matrix.runner }}"
strategy:
fail-fast: false
Expand All @@ -119,7 +67,7 @@ jobs:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- name: "Prepare integration test environment"
Expand Down Expand Up @@ -157,11 +105,13 @@ jobs:
include:
- ubuntu: 24.04
containerd: v1.7.22
- ubuntu: 24.04
containerd: v2.0.0-rc.5
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- name: Enable ipv4 and ipv6 forwarding
Expand Down Expand Up @@ -200,7 +150,7 @@ jobs:

test-integration-rootless:
timeout-minutes: 60
name: rootless ${{ matrix.containerd }} ${{ matrix.rootlesskit }} ${{ matrix.ubuntu }} ${{ matrix.target }}
name: "${{ matrix.target }} ${{ matrix.containerd }} ${{ matrix.rootlesskit }} ${{ matrix.ubuntu }}"
runs-on: "ubuntu-${{ matrix.ubuntu }}"
strategy:
fail-fast: false
Expand All @@ -210,24 +160,24 @@ jobs:
- ubuntu: 20.04
containerd: v1.6.36
rootlesskit: v1.1.1 # Deprecated
target: test-integration-rootless
target: rootless
- ubuntu: 22.04
containerd: v1.7.22
rootlesskit: v2.3.1
target: test-integration-rootless
target: rootless
- ubuntu: 24.04
containerd: v2.0.0-rc.5
rootlesskit: v2.3.1
target: test-integration-rootless
target: rootless
- ubuntu: 24.04
containerd: v1.7.22
rootlesskit: v2.3.1
target: test-integration-rootless-port-slirp4netns
target: rootless-port-slirp4netns
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
ROOTLESSKIT_VERSION: "${{ matrix.rootlesskit }}"
TEST_TARGET: "${{ matrix.target }}"
TEST_TARGET: "test-integration-${{ matrix.target }}"
steps:
- name: "Set up AppArmor"
if: matrix.ubuntu == '24.04'
Expand All @@ -244,7 +194,7 @@ jobs:
}
EOT
sudo systemctl restart apparmor.service
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- name: "Register QEMU (tonistiigi/binfmt)"
Expand Down Expand Up @@ -278,7 +228,7 @@ jobs:
matrix:
go-version: ["1.22.x", "1.23.x"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- uses: actions/setup-go@v5
Expand All @@ -293,7 +243,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- uses: actions/setup-go@v5
Expand Down Expand Up @@ -324,16 +274,16 @@ jobs:
- name: "Ensure that the IPv6 integration test suite is compatible with Docker"
run: ./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: go test -p 1 -timeout 20m -v -exec sudo ./cmd/nerdctl/... -args -test.target=docker -test.allow-kill-daemon -test.only-flaky

test-integration-windows:
timeout-minutes: 60
timeout-minutes: 30
runs-on: windows-2022
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 1
- uses: actions/setup-go@v5
Expand All @@ -343,7 +293,7 @@ jobs:
check-latest: true
- run: go install ./cmd/nerdctl
- run: go install -v gotest.tools/gotestsum@v1
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
with:
repository: containerd/containerd
ref: v1.7.22
Expand All @@ -357,11 +307,9 @@ jobs:
ctrdVersion: 1.7.22
run: powershell hack/configure-windows-ci.ps1
- name: "Run integration tests"
run: |
./hack/test-integration.sh
run: ./hack/test-integration.sh
- name: "Run integration tests (flaky)"
run: |
./hack/test-integration.sh -test.only-flaky
run: ./hack/test-integration.sh -test.only-flaky

test-integration-freebsd:
timeout-minutes: 60
Expand All @@ -370,7 +318,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4.2.1
- uses: actions/cache@v4
with:
path: /root/.vagrant.d
Expand Down
1 change: 1 addition & 0 deletions cmd/nerdctl/container/container_run_restart_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func TestRunRestart(t *testing.T) {
}
assert.NilError(t, check(30))

base.EnsureDaemonActive()
base.KillDaemon()
base.EnsureDaemonActive()

Expand Down
Loading

0 comments on commit cd2c625

Please sign in to comment.