Skip to content

Commit

Permalink
Update tests to use gotest.tools 馃懠
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
  • Loading branch information
vdemeester committed Jun 13, 2018
1 parent c147e9e commit 3845728
Show file tree
Hide file tree
Showing 262 changed files with 517 additions and 518 deletions.
4 changes: 2 additions & 2 deletions TESTING.md
Expand Up @@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor.
Moby has two test suites (and one legacy test suite):

* Unit tests - use standard `go test` and
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
the package they test. Unit tests should be fast and test only their own
package.
* API integration tests - use standard `go test` and
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
`./integration/<component>` directories, where `component` is: container,
image, volume, etc. These tests perform HTTP requests to an API endpoint and
check the HTTP response and daemon state after the call.
Expand Down
4 changes: 2 additions & 2 deletions api/server/middleware/debug_test.go
Expand Up @@ -3,8 +3,8 @@ package middleware // import "github.com/docker/docker/api/server/middleware"
import (
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestMaskSecretKeys(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions api/server/middleware/version_test.go
Expand Up @@ -8,8 +8,8 @@ import (
"testing"

"github.com/docker/docker/api/server/httputils"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestVersionMiddlewareVersion(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions api/types/filters/parse_test.go
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestParseArgs(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions builder/dockerfile/buildargs_test.go
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func strPtr(source string) *string {
Expand Down
6 changes: 3 additions & 3 deletions builder/dockerfile/copy_test.go
Expand Up @@ -5,9 +5,9 @@ import (
"testing"

"github.com/docker/docker/pkg/containerfs"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/fs"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/fs"
)

func TestIsExistingDirectory(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions builder/dockerfile/dispatchers_test.go
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/system"
"github.com/docker/go-connections/nat"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/moby/buildkit/frontend/dockerfile/instructions"
"github.com/moby/buildkit/frontend/dockerfile/shell"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func newBuilderWithMockBackend() *Builder {
Expand Down
8 changes: 4 additions & 4 deletions builder/dockerfile/evaluator_test.go
Expand Up @@ -7,10 +7,10 @@ import (
"github.com/docker/docker/builder/remotecontext"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/reexec"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/skip"
"github.com/moby/buildkit/frontend/dockerfile/instructions"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/skip"
)

type dispatchTestCase struct {
Expand Down Expand Up @@ -97,7 +97,7 @@ func initDispatchTestCases() []dispatchTestCase {
}

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

for _, testCase := range testCases {
Expand Down
4 changes: 2 additions & 2 deletions builder/dockerfile/internals_linux_test.go
Expand Up @@ -6,8 +6,8 @@ import (
"testing"

"github.com/docker/docker/pkg/idtools"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestChownFlagParsing(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions builder/dockerfile/internals_test.go
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/docker/docker/builder/remotecontext"
"github.com/docker/docker/pkg/archive"
"github.com/docker/go-connections/nat"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/skip"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/skip"
)

func TestEmptyDockerfile(t *testing.T) {
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestNonExistingDockerfile(t *testing.T) {
}

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

Expand Down
4 changes: 2 additions & 2 deletions builder/dockerfile/internals_windows_test.go
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestNormalizeDest(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions builder/fscache/fscache_test.go
Expand Up @@ -8,9 +8,9 @@ import (
"testing"
"time"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/moby/buildkit/session/filesync"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestFSCache(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions builder/remotecontext/git/gitutils_test.go
Expand Up @@ -14,8 +14,8 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestParseRemoteURL(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions builder/remotecontext/mimetype_test.go
Expand Up @@ -3,8 +3,8 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext"
import (
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestDetectContentType(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions builder/remotecontext/remote_test.go
Expand Up @@ -10,9 +10,9 @@ import (
"testing"

"github.com/docker/docker/builder"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/fs"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/fs"
)

var binaryContext = []byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00} //xz magic
Expand Down
4 changes: 2 additions & 2 deletions builder/remotecontext/tarsum_test.go
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/docker/docker/builder"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/reexec"
"github.com/gotestyourself/gotestyourself/skip"
"github.com/pkg/errors"
"gotest.tools/skip"
)

const (
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestRemoveDirectory(t *testing.T) {
}

func makeTestArchiveContext(t *testing.T, dir string) builder.Source {
skip.IfCondition(t, os.Getuid() != 0, "skipping test that requires root")
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
tarStream, err := archive.Tar(dir, archive.Uncompressed)
if err != nil {
t.Fatalf("error: %s", err)
Expand Down
8 changes: 4 additions & 4 deletions client/client_test.go
Expand Up @@ -10,10 +10,10 @@ import (

"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/gotestyourself/gotestyourself/env"
"github.com/gotestyourself/gotestyourself/skip"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/env"
"gotest.tools/skip"
)

func TestNewEnvClient(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/config_create_test.go
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestConfigCreateUnsupported(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/config_inspect_test.go
Expand Up @@ -11,9 +11,9 @@ import (
"testing"

"github.com/docker/docker/api/types/swarm"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestConfigInspectNotFound(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/config_list_test.go
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestConfigListUnsupported(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/config_remove_test.go
Expand Up @@ -9,8 +9,8 @@ import (
"strings"
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestConfigRemoveUnsupported(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/config_update_test.go
Expand Up @@ -10,8 +10,8 @@ import (
"testing"

"github.com/docker/docker/api/types/swarm"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestConfigUpdateUnsupported(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/container_logs_test.go
Expand Up @@ -14,8 +14,8 @@ import (
"time"

"github.com/docker/docker/api/types"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestContainerLogsNotFoundError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/container_prune_test.go
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestContainersPruneError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/container_remove_test.go
Expand Up @@ -10,8 +10,8 @@ import (
"testing"

"github.com/docker/docker/api/types"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestContainerRemoveError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/distribution_inspect_test.go
Expand Up @@ -5,9 +5,9 @@ import (
"net/http"
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestDistributionInspectUnsupported(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/hijack_test.go
Expand Up @@ -11,9 +11,9 @@ import (

"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"github.com/gotestyourself/gotestyourself/assert"
"github.com/pkg/errors"
"golang.org/x/net/context"
"gotest.tools/assert"
)

func TestTLSCloseWriter(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/image_prune_test.go
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestImagesPruneError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/image_remove_test.go
Expand Up @@ -11,8 +11,8 @@ import (
"testing"

"github.com/docker/docker/api/types"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestImageRemoveError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/network_inspect_test.go
Expand Up @@ -12,9 +12,9 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestNetworkInspectError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/network_prune_test.go
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestNetworksPruneError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions client/ping_test.go
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

// TestPingFail tests that when a server sends a non-successful response that we
Expand Down

0 comments on commit 3845728

Please sign in to comment.