From 55450e773038fdcdd2eb6e7cfce49d39cf9cc143 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 24 Mar 2021 22:10:04 -0700 Subject: [PATCH 1/2] Run unit tests on CI for MacOS Though we don't officially support Apple platform, we should at least run unit tests to make sure things are not broken. Signed-off-by: Maksym Pavlenko --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ae06a0d5..46ab0b285 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -375,6 +375,33 @@ jobs: df losetup -l + tests-mac-os: + name: MacOS unit tests + runs-on: macos-10.15 + timeout-minutes: 10 + needs: [project, linters, protos, man] + + steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.16.2' + + - uses: actions/checkout@v2 + with: + path: src/github.com/containerd/containerd + + - name: Set env + run: | + echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + + - name: Tests + env: + GOPROXY: direct + run: | + make test + working-directory: src/github.com/containerd/containerd + cgroup2: name: CGroupsV2 and SELinux Integration # nested virtualization is only available on macOS hosts From 4674ad7beb2cc704a2ec0eb88aa4091382efbc8b Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Wed, 24 Mar 2021 22:40:22 -0700 Subject: [PATCH 2/2] Ignore some tests on darwin Signed-off-by: Maksym Pavlenko --- archive/tar_test.go | 2 +- pkg/cri/server/container_create_test.go | 9 +++++++++ pkg/cri/server/sandbox_run_test.go | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/archive/tar_test.go b/archive/tar_test.go index 568f5a95f..adcc2eb97 100644 --- a/archive/tar_test.go +++ b/archive/tar_test.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows,!darwin /* Copyright The containerd Authors. diff --git a/pkg/cri/server/container_create_test.go b/pkg/cri/server/container_create_test.go index a5954c510..8f3a39c88 100644 --- a/pkg/cri/server/container_create_test.go +++ b/pkg/cri/server/container_create_test.go @@ -19,6 +19,7 @@ package server import ( "context" "path/filepath" + goruntime "runtime" "testing" "github.com/containerd/containerd/oci" @@ -68,6 +69,10 @@ func TestGeneralContainerSpec(t *testing.T) { } func TestPodAnnotationPassthroughContainerSpec(t *testing.T) { + if goruntime.GOOS == "darwin" { + t.Skip("not implemented on Darwin") + } + testID := "test-id" testSandboxID := "sandbox-id" testContainerName := "container-name" @@ -272,6 +277,10 @@ func TestVolumeMounts(t *testing.T) { } func TestContainerAnnotationPassthroughContainerSpec(t *testing.T) { + if goruntime.GOOS == "darwin" { + t.Skip("not implemented on Darwin") + } + testID := "test-id" testSandboxID := "sandbox-id" testContainerName := "container-name" diff --git a/pkg/cri/server/sandbox_run_test.go b/pkg/cri/server/sandbox_run_test.go index d47af13f3..75960b36a 100644 --- a/pkg/cri/server/sandbox_run_test.go +++ b/pkg/cri/server/sandbox_run_test.go @@ -18,6 +18,7 @@ package server import ( "net" + goruntime "runtime" "testing" cni "github.com/containerd/go-cni" @@ -33,6 +34,10 @@ import ( ) func TestSandboxContainerSpec(t *testing.T) { + if goruntime.GOOS == "darwin" { + t.Skip("not implemented on Darwin") + } + testID := "test-id" nsPath := "test-cni" for desc, test := range map[string]struct {