Skip to content

Commit 189b030

Browse files
committed
Merge branches
2 parents 97034ee + 0e2c655 commit 189b030

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

cmd/nerdctl/container/container_list_windows_test.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ import (
2121
"strings"
2222
"testing"
2323

24+
"gotest.tools/v3/assert"
25+
26+
"github.com/containerd/nerdctl/mod/tigron/expect"
2427
"github.com/containerd/nerdctl/mod/tigron/require"
2528
"github.com/containerd/nerdctl/mod/tigron/test"
2629
"github.com/containerd/nerdctl/mod/tigron/tig"
30+
2731
"github.com/containerd/nerdctl/v2/pkg/formatter"
2832
"github.com/containerd/nerdctl/v2/pkg/strutil"
2933
"github.com/containerd/nerdctl/v2/pkg/tabutil"
3034
"github.com/containerd/nerdctl/v2/pkg/testutil"
3135
"github.com/containerd/nerdctl/v2/pkg/testutil/nerdtest"
32-
"gotest.tools/v3/assert"
3336
)
3437

3538
func setupPsTestContainer(identity string, restart bool, hyperv bool) func(data test.Data, helpers test.Helpers) {
@@ -89,7 +92,7 @@ func TestListProcessContainer(t *testing.T) {
8992

9093
testCase.Expected = func(data test.Data, helpers test.Helpers) *test.Expected {
9194
return &test.Expected{
92-
ExitCode: 0,
95+
ExitCode: expect.ExitCodeSuccess,
9396
Output: func(stdout string, t tig.T) {
9497
lines := strings.Split(strings.TrimSpace(stdout), "\n")
9598
assert.Assert(t, len(lines) >= 2, fmt.Sprintf("expected at least 2 lines, got %d", len(lines)))
@@ -101,8 +104,11 @@ func TestListProcessContainer(t *testing.T) {
101104
image, _ := tab.ReadRow(lines[1], "IMAGE")
102105
assert.Equal(t, image, testutil.NginxAlpineImage)
103106
size, _ := tab.ReadRow(lines[1], "SIZE")
104-
assert.Assert(t, strings.Contains(size, "(virtual"),
105-
fmt.Sprintf("expect container size to contain '(virtual', but got %s", size))
107+
assert.Assert(
108+
t,
109+
strings.Contains(size, "(virtual"),
110+
fmt.Sprintf("expect container size to contain '(virtual', but got %s", size),
111+
)
106112
},
107113
}
108114
}
@@ -130,7 +136,7 @@ func TestListHyperVContainer(t *testing.T) {
130136

131137
testCase.Expected = func(data test.Data, helpers test.Helpers) *test.Expected {
132138
return &test.Expected{
133-
ExitCode: 0,
139+
ExitCode: expect.ExitCodeSuccess,
134140
Output: func(stdout string, t tig.T) {
135141
lines := strings.Split(strings.TrimSpace(stdout), "\n")
136142
assert.Assert(t, len(lines) >= 2, fmt.Sprintf("expected at least 2 lines, got %d", len(lines)))
@@ -163,7 +169,7 @@ func TestListProcessContainerWideMode(t *testing.T) {
163169

164170
testCase.Expected = func(data test.Data, helpers test.Helpers) *test.Expected {
165171
return &test.Expected{
166-
ExitCode: 0,
172+
ExitCode: expect.ExitCodeSuccess,
167173
Output: func(stdout string, t tig.T) {
168174
lines := strings.Split(strings.TrimSpace(stdout), "\n")
169175
assert.Assert(t, len(lines) >= 2, fmt.Sprintf("expected at least 2 lines, got %d", len(lines)))
@@ -197,7 +203,7 @@ func TestListProcessContainerWithLabels(t *testing.T) {
197203

198204
testCase.Expected = func(data test.Data, helpers test.Helpers) *test.Expected {
199205
return &test.Expected{
200-
ExitCode: 0,
206+
ExitCode: expect.ExitCodeSuccess,
201207
Output: func(stdout string, t tig.T) {
202208
lines := strings.Split(strings.TrimSpace(stdout), "\n")
203209
assert.Assert(t, len(lines) == 1, fmt.Sprintf("expected 1 line, got %d", len(lines)))

0 commit comments

Comments
 (0)