Skip to content

Commit

Permalink
support ci arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Kay Yan <[email protected]>
  • Loading branch information
yankay committed Jul 15, 2024
1 parent d273fd2 commit d01a271
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,26 @@ jobs:
run: sudo vagrant up --provision-with=test-unit
- name: test-integration
run: sudo vagrant up --provision-with=test-integration

test-integration-arm64:
name: test-integration-arm64
runs-on: github-arm64-2c-8gb
timeout-minutes: 40
steps:
- uses: actions/[email protected]
with:
fetch-depth: 1
- name: "Prepare integration test environment"
run: DOCKER_BUILDKIT=1 docker build -t test-integration-arm64 --target test-integration-arm64 .
- name: "Remove snap loopback devices (conflicts with our loopback devices in TestRunDevice)"
run: |
sudo systemctl disable --now snapd.service snapd.socket
sudo apt-get purge -y snapd
sudo losetup -Dv
sudo losetup -lv
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Run integration tests"
run: docker run -t --rm --privileged test-integration-arm64
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,8 @@ FROM test-integration AS test-integration-ipv6
CMD ["gotestsum", "--format=testname", "--rerun-fails=2", "--packages=github.com/containerd/nerdctl/v2/cmd/nerdctl/...", \
"--", "-timeout=30m", "-args", "-test.kill-daemon", "-test.ipv6"]

FROM test-integration AS test-integration-arm64
CMD ["gotestsum", "--format=testname", "--rerun-fails=2", "--packages=github.com/containerd/nerdctl/v2/cmd/nerdctl/...", \
"--", "-timeout=30m", "-args", "-test.kill-daemon"]

FROM base AS demo
12 changes: 10 additions & 2 deletions cmd/nerdctl/container_run_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func TestRunWithFluentdLogDriver(t *testing.T) {

containerName := testutil.Identifier(t)
base.Cmd("run", "-d", "--name", containerName, "-p", "24224:24224",
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory), testutil.FluentdImage).AssertOK()
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory), fluentdImage()).AssertOK()
defer base.Cmd("rm", "-f", containerName).AssertOK()
time.Sleep(3 * time.Second)

Expand All @@ -430,6 +430,14 @@ func TestRunWithFluentdLogDriver(t *testing.T) {
assert.Equal(t, true, strings.Contains(logData, inspectedContainer.ID))
}

func fluentdImage() string {
if runtime.GOARCH == "arm64" {
return "fluent/fluentd:v1.14-arm64-debian"
} else {

Check failure on line 436 in cmd/nerdctl/container_run_linux_test.go

View workflow job for this annotation

GitHub Actions / lint

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
return testutil.FluentdImage
}
}

func TestRunWithFluentdLogDriverWithLogOpt(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("fluentd log driver is not yet implemented on Windows")
Expand All @@ -441,7 +449,7 @@ func TestRunWithFluentdLogDriverWithLogOpt(t *testing.T) {

containerName := testutil.Identifier(t)
base.Cmd("run", "-d", "--name", containerName, "-p", "24225:24224",
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory), testutil.FluentdImage).AssertOK()
"-v", fmt.Sprintf("%s:/fluentd/log", tempDirectory), fluentdImage()).AssertOK()
defer base.Cmd("rm", "-f", containerName).AssertOK()
time.Sleep(3 * time.Second)

Expand Down

0 comments on commit d01a271

Please sign in to comment.