Skip to content

Commit 2d81a4e

Browse files
Add Windows exclusion
1 parent f852f72 commit 2d81a4e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

cmd/nerdctl/container/container_export_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"io"
2222
"os"
2323
"path/filepath"
24+
"runtime"
2425
"testing"
2526

2627
"gotest.tools/v3/assert"
@@ -66,6 +67,10 @@ func validateExportedTar(outFile string) test.Comparator {
6667
}
6768

6869
func TestExportStoppedContainer(t *testing.T) {
70+
if runtime.GOOS == "windows" {
71+
t.Skip("export is not supported on Windows")
72+
}
73+
6974
testCase := nerdtest.Setup()
7075
testCase.Setup = func(data test.Data, helpers test.Helpers) {
7176
identifier := data.Identifier("container")
@@ -108,6 +113,10 @@ func TestExportStoppedContainer(t *testing.T) {
108113
}
109114

110115
func TestExportRunningContainer(t *testing.T) {
116+
if runtime.GOOS == "windows" {
117+
t.Skip("export is not supported on Windows")
118+
}
119+
111120
testCase := nerdtest.Setup()
112121
testCase.Setup = func(data test.Data, helpers test.Helpers) {
113122
identifier := data.Identifier("container")
@@ -149,6 +158,10 @@ func TestExportRunningContainer(t *testing.T) {
149158
}
150159

151160
func TestExportNonexistentContainer(t *testing.T) {
161+
if runtime.GOOS == "windows" {
162+
t.Skip("export is not supported on Windows")
163+
}
164+
152165
testCase := nerdtest.Setup()
153166
testCase.Command = test.Command("export", "nonexistent-container")
154167
testCase.Expected = test.Expects(1, nil, nil)

pkg/cmd/container/export.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"fmt"
2222
"os"
23+
"runtime"
2324

2425
containerd "github.com/containerd/containerd/v2/client"
2526
"github.com/containerd/containerd/v2/core/mount"
@@ -32,6 +33,10 @@ import (
3233

3334
// Export exports a container's filesystem as a tar archive
3435
func Export(ctx context.Context, client *containerd.Client, containerReq string, options types.ContainerExportOptions) error {
36+
if runtime.GOOS == "windows" {
37+
return fmt.Errorf("Nerdctl export command is not supported on Windows")
38+
}
39+
3540
walker := &containerwalker.ContainerWalker{
3641
Client: client,
3742
OnFound: func(ctx context.Context, found containerwalker.Found) error {

0 commit comments

Comments
 (0)