Automated migration using

gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6be0f709830113966f295401327b027ec2f0bbca
Component: engine
This commit is contained in:
Daniel Nephin
2018-03-16 11:03:43 -04:00
parent 1c9c9f9e72
commit 60daf5fa97
183 changed files with 2253 additions and 2199 deletions
+7 -7
View File
@@ -14,9 +14,9 @@ import (
"github.com/docker/docker/pkg/plugins/transport"
"github.com/docker/go-connections/tlsconfig"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var (
@@ -88,7 +88,7 @@ func TestEchoInputOutput(t *testing.T) {
t.Fatal(err)
}
assert.Equal(t, m, output)
assert.Check(t, is.DeepEqual(m, output))
err = c.Call("Test.Echo", nil, nil)
if err != nil {
t.Fatal(err)
@@ -205,7 +205,7 @@ func TestClientStream(t *testing.T) {
if err := json.NewDecoder(body).Decode(&output); err != nil {
t.Fatalf("Test.Echo: error reading plugin resp: %v", err)
}
assert.Equal(t, m, output)
assert.Check(t, is.DeepEqual(m, output))
}
func TestClientSendFile(t *testing.T) {
@@ -233,7 +233,7 @@ func TestClientSendFile(t *testing.T) {
if err := c.SendFile("Test.Echo", &buf, &output); err != nil {
t.Fatal(err)
}
assert.Equal(t, m, output)
assert.Check(t, is.DeepEqual(m, output))
}
func TestClientWithRequestTimeout(t *testing.T) {
@@ -248,7 +248,7 @@ func TestClientWithRequestTimeout(t *testing.T) {
client := &Client{http: srv.Client(), requestFactory: &testRequestWrapper{srv}}
_, err := client.callWithRetry("/Plugin.Hello", nil, false, WithRequestTimeout(timeout))
require.Error(t, err, "expected error")
assert.Assert(t, is.ErrorContains(err, ""), "expected error")
err = errors.Cause(err)
@@ -256,7 +256,7 @@ func TestClientWithRequestTimeout(t *testing.T) {
case *url.Error:
err = e.Err
}
require.Equal(t, context.DeadlineExceeded, err)
assert.DeepEqual(t, context.DeadlineExceeded, err)
}
type testRequestWrapper struct {
@@ -11,7 +11,7 @@ import (
"reflect"
"testing"
"github.com/stretchr/testify/require"
"github.com/gotestyourself/gotestyourself/assert"
)
func TestLocalSocket(t *testing.T) {
@@ -91,7 +91,7 @@ func TestScan(t *testing.T) {
r := newLocalRegistry()
p, err := r.Plugin(name)
require.NoError(t, err)
assert.NilError(t, err)
pluginNamesNotEmpty, err := Scan()
if err != nil {
+4 -3
View File
@@ -14,8 +14,9 @@ import (
"github.com/docker/docker/pkg/plugins/transport"
"github.com/docker/go-connections/tlsconfig"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
const (
@@ -78,11 +79,11 @@ func TestGet(t *testing.T) {
// check negative case where plugin fruit doesn't implement banana
_, err = Get("fruit", "banana")
assert.Equal(t, errors.Cause(err), ErrNotImplements)
assert.Check(t, is.DeepEqual(errors.Cause(err), ErrNotImplements))
// check negative case where plugin vegetable doesn't exist
_, err = Get("vegetable", "potato")
assert.Equal(t, errors.Cause(err), ErrNotFound)
assert.Check(t, is.DeepEqual(errors.Cause(err), ErrNotFound))
}
@@ -5,7 +5,8 @@ import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
)
func TestHTTPTransport(t *testing.T) {
@@ -16,5 +17,5 @@ func TestHTTPTransport(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "POST", request.Method)
assert.Check(t, is.Equal("POST", request.Method))
}