Skip to content

Commit 3845728

Browse files
committed
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent c147e9e commit 3845728

File tree

262 files changed

+517
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+517
-518
lines changed

TESTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor.
88
Moby has two test suites (and one legacy test suite):
99

1010
* Unit tests - use standard `go test` and
11-
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
11+
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
1212
the package they test. Unit tests should be fast and test only their own
1313
package.
1414
* API integration tests - use standard `go test` and
15-
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
15+
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
1616
`./integration/<component>` directories, where `component` is: container,
1717
image, volume, etc. These tests perform HTTP requests to an API endpoint and
1818
check the HTTP response and daemon state after the call.

api/server/middleware/debug_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package middleware // import "github.com/docker/docker/api/server/middleware"
33
import (
44
"testing"
55

6-
"github.com/gotestyourself/gotestyourself/assert"
7-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
6+
"gotest.tools/assert"
7+
is "gotest.tools/assert/cmp"
88
)
99

1010
func TestMaskSecretKeys(t *testing.T) {

api/server/middleware/version_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"testing"
99

1010
"github.com/docker/docker/api/server/httputils"
11-
"github.com/gotestyourself/gotestyourself/assert"
12-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
11+
"gotest.tools/assert"
12+
is "gotest.tools/assert/cmp"
1313
)
1414

1515
func TestVersionMiddlewareVersion(t *testing.T) {

api/types/filters/parse_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"errors"
55
"testing"
66

7-
"github.com/gotestyourself/gotestyourself/assert"
8-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
7+
"gotest.tools/assert"
8+
is "gotest.tools/assert/cmp"
99
)
1010

1111
func TestParseArgs(t *testing.T) {

builder/dockerfile/buildargs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"strings"
66
"testing"
77

8-
"github.com/gotestyourself/gotestyourself/assert"
9-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
8+
"gotest.tools/assert"
9+
is "gotest.tools/assert/cmp"
1010
)
1111

1212
func strPtr(source string) *string {

builder/dockerfile/copy_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"testing"
66

77
"github.com/docker/docker/pkg/containerfs"
8-
"github.com/gotestyourself/gotestyourself/assert"
9-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
10-
"github.com/gotestyourself/gotestyourself/fs"
8+
"gotest.tools/assert"
9+
is "gotest.tools/assert/cmp"
10+
"gotest.tools/fs"
1111
)
1212

1313
func TestIsExistingDirectory(t *testing.T) {

builder/dockerfile/dispatchers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
"github.com/docker/docker/image"
1515
"github.com/docker/docker/pkg/system"
1616
"github.com/docker/go-connections/nat"
17-
"github.com/gotestyourself/gotestyourself/assert"
18-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
1917
"github.com/moby/buildkit/frontend/dockerfile/instructions"
2018
"github.com/moby/buildkit/frontend/dockerfile/shell"
19+
"gotest.tools/assert"
20+
is "gotest.tools/assert/cmp"
2121
)
2222

2323
func newBuilderWithMockBackend() *Builder {

builder/dockerfile/evaluator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"github.com/docker/docker/builder/remotecontext"
88
"github.com/docker/docker/pkg/archive"
99
"github.com/docker/docker/pkg/reexec"
10-
"github.com/gotestyourself/gotestyourself/assert"
11-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
12-
"github.com/gotestyourself/gotestyourself/skip"
1310
"github.com/moby/buildkit/frontend/dockerfile/instructions"
11+
"gotest.tools/assert"
12+
is "gotest.tools/assert/cmp"
13+
"gotest.tools/skip"
1414
)
1515

1616
type dispatchTestCase struct {
@@ -97,7 +97,7 @@ func initDispatchTestCases() []dispatchTestCase {
9797
}
9898

9999
func TestDispatch(t *testing.T) {
100-
skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root")
100+
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
101101
testCases := initDispatchTestCases()
102102

103103
for _, testCase := range testCases {

builder/dockerfile/internals_linux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"testing"
77

88
"github.com/docker/docker/pkg/idtools"
9-
"github.com/gotestyourself/gotestyourself/assert"
10-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
9+
"gotest.tools/assert"
10+
is "gotest.tools/assert/cmp"
1111
)
1212

1313
func TestChownFlagParsing(t *testing.T) {

builder/dockerfile/internals_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
"github.com/docker/docker/builder/remotecontext"
1414
"github.com/docker/docker/pkg/archive"
1515
"github.com/docker/go-connections/nat"
16-
"github.com/gotestyourself/gotestyourself/assert"
17-
is "github.com/gotestyourself/gotestyourself/assert/cmp"
18-
"github.com/gotestyourself/gotestyourself/skip"
16+
"gotest.tools/assert"
17+
is "gotest.tools/assert/cmp"
18+
"gotest.tools/skip"
1919
)
2020

2121
func TestEmptyDockerfile(t *testing.T) {
@@ -61,7 +61,7 @@ func TestNonExistingDockerfile(t *testing.T) {
6161
}
6262

6363
func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath, expectedError string) {
64-
skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root")
64+
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
6565
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
6666
assert.NilError(t, err)
6767

0 commit comments

Comments
 (0)