From c999d23d46b54fd10f58a57122c2c71c7d93e698 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Tue, 9 Nov 2021 08:16:56 -0800 Subject: [PATCH] [testing] Add test --- .cirrus.yml | 41 ++++++++++++++++++++++++++++------------ pkg/testutil/testutil.go | 7 +++++++ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index be9b574c2f2..9b0e6fb1542 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,14 +1,31 @@ -freebsd_instance: - image_family: freebsd-13-0 +#freebsd_instance: +# image_family: freebsd-13-0 +# +#task: +# name: test-freebsd-amd64 +# env: +# NERDCTL_RUN_ARGS: --net none knast/freebsd:13-STABLE echo "Nerdctl is up and running." +# install_script: +# - pkg install -y go containerd runj +# - daemon -o containerd.out containerd +# test_script: +# - go test -v ./pkg/... +# - cd cmd/nerdctl +# - sudo go run . run $NERDCTL_RUN_ARGS | grep running -task: - name: test-freebsd-amd64 +docker_builder: + name: windows + platform: windows + os_version: 2019 env: - NERDCTL_RUN_ARGS: --net none knast/freebsd:13-STABLE echo "Nerdctl is up and running." - install_script: - - pkg install -y go containerd runj - - daemon -o containerd.out containerd - test_script: - - go test -v ./pkg/... - - cd cmd/nerdctl - - sudo go run . run $NERDCTL_RUN_ARGS | grep running + CGO_ENABLED: 0 + build_script: + - choco install golang + - $Version=1.5.7 + - curl.exe -L https://github.com/containerd/containerd/releases/download/v$Version/containerd-$Version-windows-amd64.tar.gz -o containerd-windows-amd64.tar.gz + - Copy-Item -Path ".\bin\" -Destination "$Env:ProgramFiles\containerd" -Recurse -Force + - cd $Env:ProgramFiles\containerd\ + - .\containerd.exe config default | Out-File config.toml -Encoding ascii + - .\containerd.exe --register-service + - Start-Service containerd + - go test -v -run ^\QTestRunEnvFile\E$ ./cmd/... diff --git a/pkg/testutil/testutil.go b/pkg/testutil/testutil.go index 05c985805ad..22aad2466ce 100644 --- a/pkg/testutil/testutil.go +++ b/pkg/testutil/testutil.go @@ -23,6 +23,7 @@ import ( "io" "os" "os/exec" + "runtime" "strings" "testing" "time" @@ -399,6 +400,12 @@ func NewBase(t *testing.T) *Base { } func mirrorOf(s string) string { + if runtime.GOOS == "windows" { + // use gcr.io/k8s-staging-e2e-test-images/busybox:1.29-2-windows-amd64-ltsc2022 locally on windows 11 + // https://github.com/microsoft/Windows-Containers/issues/179 + return "gcr.io/k8s-staging-e2e-test-images/busybox:1.29-2" + } + // plain mirror, NOT stargz-converted images return fmt.Sprintf("ghcr.io/stargz-containers/%s-org", s) }