Skip to content

Commit 9200b3d

Browse files
committed
fixed test failed on macos
Signed-off-by: tianya <[email protected]>
1 parent cbcb2af commit 9200b3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

utils/utils_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ import (
2424
)
2525

2626
func TestContainerRuntimeUtils(t *testing.T) {
27+
containerCmd := func() string {
28+
if !MACOS {
29+
return "nerdctl"
30+
}
31+
return "docker"
32+
}()
2733
testcases := []struct {
2834
name string
2935
input string
@@ -33,13 +39,13 @@ func TestContainerRuntimeUtils(t *testing.T) {
3339
{
3440
name: "containerd runtime is valid, and nerdctl is returned",
3541
input: "containerd",
36-
expected: "nerdctl",
42+
expected: containerCmd,
3743
valid: !MACOS,
3844
},
3945
{
4046
name: "containerd runtime with extra spaces is valid, and nerdctl is returned",
4147
input: " containerd ",
42-
expected: "nerdctl",
48+
expected: containerCmd,
4349
valid: !MACOS,
4450
},
4551
{

0 commit comments

Comments
 (0)