client: reduce string-matching in tests

These checks were redundant, as we were not expecting
a specific string, just that a server-error or authentication
error was returned.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2019-10-13 00:31:53 +02:00
parent d1e837d2a8
commit de10c7d013
91 changed files with 139 additions and 371 deletions

View File

@@ -11,6 +11,7 @@ import (
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/errdefs"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)
@@ -21,7 +22,9 @@ func TestSwarmGetUnlockKeyError(t *testing.T) {
}
_, err := client.SwarmGetUnlockKey(context.Background())
assert.Check(t, is.ErrorContains(err, "Error response from daemon: Server error"))
if !errdefs.IsSystem(err) {
t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err)
}
}
func TestSwarmGetUnlockKey(t *testing.T) {