mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
integration-cli: adjust "gotest.tools/v3/assert/cmp" import alias
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/assert/cmp"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
// Compare defines the interface to compare values
|
||||
@@ -29,14 +29,14 @@ func True() Compare {
|
||||
// Equals checks if the value is equal to the given value
|
||||
func Equals(y interface{}) Compare {
|
||||
return func(x interface{}) assert.BoolOrComparison {
|
||||
return cmp.Equal(x, y)
|
||||
return is.Equal(x, y)
|
||||
}
|
||||
}
|
||||
|
||||
// Contains checks if the value contains the given value
|
||||
func Contains(y interface{}) Compare {
|
||||
return func(x interface{}) assert.BoolOrComparison {
|
||||
return cmp.Contains(x, y)
|
||||
return is.Contains(x, y)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func Not(c Compare) Compare {
|
||||
switch r := r.(type) {
|
||||
case bool:
|
||||
return !r
|
||||
case cmp.Comparison:
|
||||
case is.Comparison:
|
||||
return !r().Success()
|
||||
default:
|
||||
panic(fmt.Sprintf("unexpected type %T", r))
|
||||
@@ -58,21 +58,21 @@ func Not(c Compare) Compare {
|
||||
// DeepEquals checks if two values are equal
|
||||
func DeepEquals(y interface{}) Compare {
|
||||
return func(x interface{}) assert.BoolOrComparison {
|
||||
return cmp.DeepEqual(x, y)
|
||||
return is.DeepEqual(x, y)
|
||||
}
|
||||
}
|
||||
|
||||
// HasLen checks if the value has the expected number of elements
|
||||
func HasLen(y int) Compare {
|
||||
return func(x interface{}) assert.BoolOrComparison {
|
||||
return cmp.Len(x, y)
|
||||
return is.Len(x, y)
|
||||
}
|
||||
}
|
||||
|
||||
// IsNil checks if the value is nil
|
||||
func IsNil() Compare {
|
||||
return func(x interface{}) assert.BoolOrComparison {
|
||||
return cmp.Nil(x)
|
||||
return is.Nil(x)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/integration-cli/cli/build"
|
||||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/assert/cmp"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
@@ -127,7 +126,7 @@ func (s *DockerCLIHistorySuite) TestHistoryHumanOptionTrue(c *testing.T) {
|
||||
endIndex = len(lines[i])
|
||||
}
|
||||
sizeString := lines[i][startIndex:endIndex]
|
||||
assert.Assert(c, cmp.Regexp("^"+humanSizeRegexRaw+"$",
|
||||
assert.Assert(c, is.Regexp("^"+humanSizeRegexRaw+"$",
|
||||
strings.TrimSpace(sizeString)), fmt.Sprintf("The size '%s' was not in human format", sizeString))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/testutil"
|
||||
"gotest.tools/v3/assert"
|
||||
"gotest.tools/v3/assert/cmp"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
"gotest.tools/v3/icmd"
|
||||
"gotest.tools/v3/poll"
|
||||
)
|
||||
@@ -427,7 +427,7 @@ func pollCheck(t *testing.T, f checkF, compare func(x interface{}) assert.BoolOr
|
||||
if r {
|
||||
return poll.Success()
|
||||
}
|
||||
case cmp.Comparison:
|
||||
case is.Comparison:
|
||||
if r().Success() {
|
||||
return poll.Success()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user