now that we no longer use gocheck, we should be able
to just use golang's own interface.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -3,17 +3,12 @@ package build // import "github.com/docker/docker/integration-cli/cli/build" |
| 3 | 3 |
import ( |
| 4 | 4 |
"io" |
| 5 | 5 |
"strings" |
| 6 |
+ "testing" |
|
| 6 | 7 |
|
| 7 | 8 |
"github.com/docker/docker/testutil/fakecontext" |
| 8 | 9 |
"gotest.tools/icmd" |
| 9 | 10 |
) |
| 10 | 11 |
|
| 11 |
-type testingT interface {
|
|
| 12 |
- Fatal(args ...interface{})
|
|
| 13 |
- Fatalf(string, ...interface{})
|
|
| 14 |
- Name() string |
|
| 15 |
-} |
|
| 16 |
- |
|
| 17 | 12 |
// WithStdinContext sets the build context from the standard input with the specified reader |
| 18 | 13 |
func WithStdinContext(closer io.ReadCloser) func(*icmd.Cmd) func() {
|
| 19 | 14 |
return func(cmd *icmd.Cmd) func() {
|
| ... | ... |
@@ -59,7 +54,7 @@ func WithExternalBuildContext(ctx *fakecontext.Fake) func(*icmd.Cmd) func() {
|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
// WithBuildContext sets up the build context |
| 62 |
-func WithBuildContext(t testingT, contextOperators ...func(*fakecontext.Fake) error) func(*icmd.Cmd) func() {
|
|
| 62 |
+func WithBuildContext(t testing.TB, contextOperators ...func(*fakecontext.Fake) error) func(*icmd.Cmd) func() {
|
|
| 63 | 63 |
// FIXME(vdemeester) de-duplicate that |
| 64 | 64 |
ctx := fakecontext.New(t, "", contextOperators...) |
| 65 | 65 |
return func(cmd *icmd.Cmd) func() {
|
| ... | ... |
@@ -74,7 +69,7 @@ func WithFile(name, content string) func(*fakecontext.Fake) error {
|
| 74 | 74 |
return fakecontext.WithFile(name, content) |
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 |
-func closeBuildContext(t testingT, ctx *fakecontext.Fake) func() {
|
|
| 77 |
+func closeBuildContext(t testing.TB, ctx *fakecontext.Fake) func() {
|
|
| 78 | 78 |
return func() {
|
| 79 | 79 |
if err := ctx.Close(); err != nil {
|
| 80 | 80 |
t.Fatal(err) |
| ... | ... |
@@ -4,12 +4,12 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"io" |
| 6 | 6 |
"strings" |
| 7 |
+ "testing" |
|
| 7 | 8 |
"time" |
| 8 | 9 |
|
| 9 | 10 |
"github.com/docker/docker/integration-cli/daemon" |
| 10 | 11 |
"github.com/docker/docker/integration-cli/environment" |
| 11 | 12 |
"github.com/pkg/errors" |
| 12 |
- "gotest.tools/assert" |
|
| 13 | 13 |
"gotest.tools/icmd" |
| 14 | 14 |
) |
| 15 | 15 |
|
| ... | ... |
@@ -24,46 +24,39 @@ func SetTestEnvironment(env *environment.Execution) {
|
| 24 | 24 |
// CmdOperator defines functions that can modify a command |
| 25 | 25 |
type CmdOperator func(*icmd.Cmd) func() |
| 26 | 26 |
|
| 27 |
-type testingT interface {
|
|
| 28 |
- assert.TestingT |
|
| 29 |
- Fatal(args ...interface{})
|
|
| 30 |
- Fatalf(string, ...interface{})
|
|
| 31 |
- Name() string |
|
| 32 |
-} |
|
| 33 |
- |
|
| 34 | 27 |
// DockerCmd executes the specified docker command and expect a success |
| 35 |
-func DockerCmd(t testingT, args ...string) *icmd.Result {
|
|
| 28 |
+func DockerCmd(t testing.TB, args ...string) *icmd.Result {
|
|
| 36 | 29 |
return Docker(Args(args...)).Assert(t, icmd.Success) |
| 37 | 30 |
} |
| 38 | 31 |
|
| 39 | 32 |
// BuildCmd executes the specified docker build command and expect a success |
| 40 |
-func BuildCmd(t testingT, name string, cmdOperators ...CmdOperator) *icmd.Result {
|
|
| 33 |
+func BuildCmd(t testing.TB, name string, cmdOperators ...CmdOperator) *icmd.Result {
|
|
| 41 | 34 |
return Docker(Build(name), cmdOperators...).Assert(t, icmd.Success) |
| 42 | 35 |
} |
| 43 | 36 |
|
| 44 | 37 |
// InspectCmd executes the specified docker inspect command and expect a success |
| 45 |
-func InspectCmd(t testingT, name string, cmdOperators ...CmdOperator) *icmd.Result {
|
|
| 38 |
+func InspectCmd(t testing.TB, name string, cmdOperators ...CmdOperator) *icmd.Result {
|
|
| 46 | 39 |
return Docker(Inspect(name), cmdOperators...).Assert(t, icmd.Success) |
| 47 | 40 |
} |
| 48 | 41 |
|
| 49 | 42 |
// WaitRun will wait for the specified container to be running, maximum 5 seconds. |
| 50 |
-func WaitRun(t testingT, name string, cmdOperators ...CmdOperator) {
|
|
| 43 |
+func WaitRun(t testing.TB, name string, cmdOperators ...CmdOperator) {
|
|
| 51 | 44 |
WaitForInspectResult(t, name, "{{.State.Running}}", "true", 5*time.Second, cmdOperators...)
|
| 52 | 45 |
} |
| 53 | 46 |
|
| 54 | 47 |
// WaitExited will wait for the specified container to state exit, subject |
| 55 | 48 |
// to a maximum time limit in seconds supplied by the caller |
| 56 |
-func WaitExited(t testingT, name string, timeout time.Duration, cmdOperators ...CmdOperator) {
|
|
| 49 |
+func WaitExited(t testing.TB, name string, timeout time.Duration, cmdOperators ...CmdOperator) {
|
|
| 57 | 50 |
WaitForInspectResult(t, name, "{{.State.Status}}", "exited", timeout, cmdOperators...)
|
| 58 | 51 |
} |
| 59 | 52 |
|
| 60 | 53 |
// WaitRestart will wait for the specified container to restart once |
| 61 |
-func WaitRestart(t testingT, name string, timeout time.Duration, cmdOperators ...CmdOperator) {
|
|
| 54 |
+func WaitRestart(t testing.TB, name string, timeout time.Duration, cmdOperators ...CmdOperator) {
|
|
| 62 | 55 |
WaitForInspectResult(t, name, "{{.RestartCount}}", "1", timeout, cmdOperators...)
|
| 63 | 56 |
} |
| 64 | 57 |
|
| 65 | 58 |
// WaitForInspectResult waits for the specified expression to be equals to the specified expected string in the given time. |
| 66 |
-func WaitForInspectResult(t testingT, name, expr, expected string, timeout time.Duration, cmdOperators ...CmdOperator) {
|
|
| 59 |
+func WaitForInspectResult(t testing.TB, name, expr, expected string, timeout time.Duration, cmdOperators ...CmdOperator) {
|
|
| 67 | 60 |
after := time.After(timeout) |
| 68 | 61 |
|
| 69 | 62 |
args := []string{"inspect", "-f", expr, name}
|
| ... | ... |
@@ -12,17 +12,6 @@ import ( |
| 12 | 12 |
"gotest.tools/icmd" |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 |
-type testingT interface {
|
|
| 16 |
- assert.TestingT |
|
| 17 |
- logT |
|
| 18 |
- Fatalf(string, ...interface{})
|
|
| 19 |
- Name() string |
|
| 20 |
-} |
|
| 21 |
- |
|
| 22 |
-type logT interface {
|
|
| 23 |
- Logf(string, ...interface{})
|
|
| 24 |
-} |
|
| 25 |
- |
|
| 26 | 15 |
// Daemon represents a Docker daemon for the testing framework. |
| 27 | 16 |
type Daemon struct {
|
| 28 | 17 |
*daemon.Daemon |
| ... | ... |
@@ -32,7 +21,7 @@ type Daemon struct {
|
| 32 | 32 |
// New returns a Daemon instance to be used for testing. |
| 33 | 33 |
// This will create a directory such as d123456789 in the folder specified by $DOCKER_INTEGRATION_DAEMON_DEST or $DEST. |
| 34 | 34 |
// The daemon will not automatically start. |
| 35 |
-func New(t testingT, dockerBinary string, dockerdBinary string, ops ...daemon.Option) *Daemon {
|
|
| 35 |
+func New(t testing.TB, dockerBinary string, dockerdBinary string, ops ...daemon.Option) *Daemon {
|
|
| 36 | 36 |
ops = append(ops, daemon.WithDockerdBinary(dockerdBinary)) |
| 37 | 37 |
d := daemon.New(t, ops...) |
| 38 | 38 |
return &Daemon{
|
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
"path/filepath" |
| 12 | 12 |
"strconv" |
| 13 | 13 |
"strings" |
| 14 |
+ "testing" |
|
| 14 | 15 |
"time" |
| 15 | 16 |
|
| 16 | 17 |
"github.com/docker/docker/api/types" |
| ... | ... |
@@ -28,13 +29,6 @@ import ( |
| 28 | 28 |
"gotest.tools/assert" |
| 29 | 29 |
) |
| 30 | 30 |
|
| 31 |
-type testingT interface {
|
|
| 32 |
- assert.TestingT |
|
| 33 |
- logT |
|
| 34 |
- Fatalf(string, ...interface{})
|
|
| 35 |
- Name() string |
|
| 36 |
-} |
|
| 37 |
- |
|
| 38 | 31 |
type logT interface {
|
| 39 | 32 |
Logf(string, ...interface{})
|
| 40 | 33 |
} |
| ... | ... |
@@ -143,7 +137,7 @@ func NewDaemon(workingDir string, ops ...Option) (*Daemon, error) {
|
| 143 | 143 |
// This will create a directory such as d123456789 in the folder specified by |
| 144 | 144 |
// $DOCKER_INTEGRATION_DAEMON_DEST or $DEST. |
| 145 | 145 |
// The daemon will not automatically start. |
| 146 |
-func New(t testingT, ops ...Option) *Daemon {
|
|
| 146 |
+func New(t testing.TB, ops ...Option) *Daemon {
|
|
| 147 | 147 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 148 | 148 |
ht.Helper() |
| 149 | 149 |
} |
| ... | ... |
@@ -224,7 +218,7 @@ func (d *Daemon) NewClient(extraOpts ...client.Opt) (*client.Client, error) {
|
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
// Cleanup cleans the daemon files : exec root (network namespaces, ...), swarmkit files |
| 227 |
-func (d *Daemon) Cleanup(t testingT) {
|
|
| 227 |
+func (d *Daemon) Cleanup(t testing.TB) {
|
|
| 228 | 228 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 229 | 229 |
ht.Helper() |
| 230 | 230 |
} |
| ... | ... |
@@ -234,7 +228,7 @@ func (d *Daemon) Cleanup(t testingT) {
|
| 234 | 234 |
} |
| 235 | 235 |
|
| 236 | 236 |
// Start starts the daemon and return once it is ready to receive requests. |
| 237 |
-func (d *Daemon) Start(t testingT, args ...string) {
|
|
| 237 |
+func (d *Daemon) Start(t testing.TB, args ...string) {
|
|
| 238 | 238 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 239 | 239 |
ht.Helper() |
| 240 | 240 |
} |
| ... | ... |
@@ -390,7 +384,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
| 390 | 390 |
|
| 391 | 391 |
// StartWithBusybox will first start the daemon with Daemon.Start() |
| 392 | 392 |
// then save the busybox image from the main daemon and load it into this Daemon instance. |
| 393 |
-func (d *Daemon) StartWithBusybox(t testingT, arg ...string) {
|
|
| 393 |
+func (d *Daemon) StartWithBusybox(t testing.TB, arg ...string) {
|
|
| 394 | 394 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 395 | 395 |
ht.Helper() |
| 396 | 396 |
} |
| ... | ... |
@@ -449,7 +443,7 @@ func (d *Daemon) DumpStackAndQuit() {
|
| 449 | 449 |
// Stop will not delete the daemon directory. If a purged daemon is needed, |
| 450 | 450 |
// instantiate a new one with NewDaemon. |
| 451 | 451 |
// If an error occurs while starting the daemon, the test will fail. |
| 452 |
-func (d *Daemon) Stop(t testingT) {
|
|
| 452 |
+func (d *Daemon) Stop(t testing.TB) {
|
|
| 453 | 453 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 454 | 454 |
ht.Helper() |
| 455 | 455 |
} |
| ... | ... |
@@ -537,7 +531,7 @@ out2: |
| 537 | 537 |
|
| 538 | 538 |
// Restart will restart the daemon by first stopping it and the starting it. |
| 539 | 539 |
// If an error occurs while starting the daemon, the test will fail. |
| 540 |
-func (d *Daemon) Restart(t testingT, args ...string) {
|
|
| 540 |
+func (d *Daemon) Restart(t testing.TB, args ...string) {
|
|
| 541 | 541 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 542 | 542 |
ht.Helper() |
| 543 | 543 |
} |
| ... | ... |
@@ -737,7 +731,7 @@ func (d *Daemon) Info(t assert.TestingT) types.Info {
|
| 737 | 737 |
return info |
| 738 | 738 |
} |
| 739 | 739 |
|
| 740 |
-func cleanupRaftDir(t testingT, rootPath string) {
|
|
| 740 |
+func cleanupRaftDir(t testing.TB, rootPath string) {
|
|
| 741 | 741 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 742 | 742 |
ht.Helper() |
| 743 | 743 |
} |
| ... | ... |
@@ -7,13 +7,14 @@ import ( |
| 7 | 7 |
"os" |
| 8 | 8 |
"path/filepath" |
| 9 | 9 |
"strings" |
| 10 |
+ "testing" |
|
| 10 | 11 |
|
| 11 | 12 |
"github.com/docker/docker/testutil" |
| 12 | 13 |
"golang.org/x/sys/unix" |
| 13 | 14 |
"gotest.tools/assert" |
| 14 | 15 |
) |
| 15 | 16 |
|
| 16 |
-func cleanupNetworkNamespace(t testingT, execRoot string) {
|
|
| 17 |
+func cleanupNetworkNamespace(t testing.TB, execRoot string) {
|
|
| 17 | 18 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 18 | 19 |
ht.Helper() |
| 19 | 20 |
} |
| ... | ... |
@@ -33,7 +34,7 @@ func cleanupNetworkNamespace(t testingT, execRoot string) {
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
// CgroupNamespace returns the cgroup namespace the daemon is running in |
| 36 |
-func (d *Daemon) CgroupNamespace(t assert.TestingT) string {
|
|
| 36 |
+func (d *Daemon) CgroupNamespace(t testing.TB) string {
|
|
| 37 | 37 |
link, err := os.Readlink(fmt.Sprintf("/proc/%d/ns/cgroup", d.Pid()))
|
| 38 | 38 |
assert.NilError(t, err) |
| 39 | 39 |
|
| ... | ... |
@@ -3,6 +3,7 @@ package daemon |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"strconv" |
| 6 |
+ "testing" |
|
| 6 | 7 |
|
| 7 | 8 |
"golang.org/x/sys/windows" |
| 8 | 9 |
"gotest.tools/assert" |
| ... | ... |
@@ -22,11 +23,11 @@ func signalDaemonReload(pid int) error {
|
| 22 | 22 |
return fmt.Errorf("daemon reload not supported")
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 |
-func cleanupNetworkNamespace(t testingT, execRoot string) {
|
|
| 25 |
+func cleanupNetworkNamespace(t testing.TB, execRoot string) {
|
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
// CgroupNamespace returns the cgroup namespace the daemon is running in |
| 29 |
-func (d *Daemon) CgroupNamespace(t assert.TestingT) string {
|
|
| 29 |
+func (d *Daemon) CgroupNamespace(t testing.TB) string {
|
|
| 30 | 30 |
assert.Assert(t, false) |
| 31 | 31 |
return "cgroup namespaces are not supported on Windows" |
| 32 | 32 |
} |
| ... | ... |
@@ -3,6 +3,7 @@ package daemon |
| 3 | 3 |
import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"fmt" |
| 6 |
+ "testing" |
|
| 6 | 7 |
|
| 7 | 8 |
"github.com/docker/docker/api/types/swarm" |
| 8 | 9 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -21,7 +22,7 @@ var ( |
| 21 | 21 |
) |
| 22 | 22 |
|
| 23 | 23 |
// StartNode (re)starts the daemon |
| 24 |
-func (d *Daemon) StartNode(t testingT) {
|
|
| 24 |
+func (d *Daemon) StartNode(t testing.TB) {
|
|
| 25 | 25 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 26 | 26 |
ht.Helper() |
| 27 | 27 |
} |
| ... | ... |
@@ -29,7 +30,7 @@ func (d *Daemon) StartNode(t testingT) {
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
// StartNodeWithBusybox starts daemon to be used as a swarm node, and loads the busybox image |
| 32 |
-func (d *Daemon) StartNodeWithBusybox(t testingT) {
|
|
| 32 |
+func (d *Daemon) StartNodeWithBusybox(t testing.TB) {
|
|
| 33 | 33 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 34 | 34 |
ht.Helper() |
| 35 | 35 |
} |
| ... | ... |
@@ -37,7 +38,7 @@ func (d *Daemon) StartNodeWithBusybox(t testingT) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
// RestartNode restarts a daemon to be used as a swarm node |
| 40 |
-func (d *Daemon) RestartNode(t testingT) {
|
|
| 40 |
+func (d *Daemon) RestartNode(t testing.TB) {
|
|
| 41 | 41 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 42 | 42 |
ht.Helper() |
| 43 | 43 |
} |
| ... | ... |
@@ -47,13 +48,13 @@ func (d *Daemon) RestartNode(t testingT) {
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
// StartAndSwarmInit starts the daemon (with busybox) and init the swarm |
| 50 |
-func (d *Daemon) StartAndSwarmInit(t testingT) {
|
|
| 50 |
+func (d *Daemon) StartAndSwarmInit(t testing.TB) {
|
|
| 51 | 51 |
d.StartNodeWithBusybox(t) |
| 52 | 52 |
d.SwarmInit(t, swarm.InitRequest{})
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
// StartAndSwarmJoin starts the daemon (with busybox) and join the specified swarm as worker or manager |
| 56 |
-func (d *Daemon) StartAndSwarmJoin(t testingT, leader *Daemon, manager bool) {
|
|
| 56 |
+func (d *Daemon) StartAndSwarmJoin(t testing.TB, leader *Daemon, manager bool) {
|
|
| 57 | 57 |
if th, ok := t.(testutil.HelperT); ok {
|
| 58 | 58 |
th.Helper() |
| 59 | 59 |
} |
| ... | ... |
@@ -6,19 +6,14 @@ import ( |
| 6 | 6 |
"io/ioutil" |
| 7 | 7 |
"os" |
| 8 | 8 |
"path/filepath" |
| 9 |
+ "testing" |
|
| 9 | 10 |
|
| 10 | 11 |
"github.com/docker/docker/pkg/archive" |
| 11 | 12 |
"github.com/docker/docker/testutil" |
| 12 | 13 |
) |
| 13 | 14 |
|
| 14 |
-type testingT interface {
|
|
| 15 |
- Fatal(args ...interface{})
|
|
| 16 |
- Fatalf(string, ...interface{})
|
|
| 17 |
- Name() string |
|
| 18 |
-} |
|
| 19 |
- |
|
| 20 | 15 |
// New creates a fake build context |
| 21 |
-func New(t testingT, dir string, modifiers ...func(*Fake) error) *Fake {
|
|
| 16 |
+func New(t testing.TB, dir string, modifiers ...func(*Fake) error) *Fake {
|
|
| 22 | 17 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 23 | 18 |
ht.Helper() |
| 24 | 19 |
} |
| ... | ... |
@@ -120,7 +115,7 @@ func (f *Fake) Close() error {
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
// AsTarReader returns a ReadCloser with the contents of Dir as a tar archive. |
| 123 |
-func (f *Fake) AsTarReader(t testingT) io.ReadCloser {
|
|
| 123 |
+func (f *Fake) AsTarReader(t testing.TB) io.ReadCloser {
|
|
| 124 | 124 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 125 | 125 |
ht.Helper() |
| 126 | 126 |
} |
| ... | ... |
@@ -8,30 +8,13 @@ import ( |
| 8 | 8 |
"os" |
| 9 | 9 |
"os/exec" |
| 10 | 10 |
"path/filepath" |
| 11 |
+ "testing" |
|
| 11 | 12 |
|
| 12 | 13 |
"github.com/docker/docker/testutil" |
| 13 | 14 |
"github.com/docker/docker/testutil/fakecontext" |
| 14 | 15 |
"github.com/docker/docker/testutil/fakestorage" |
| 15 |
- "gotest.tools/assert" |
|
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 |
-type testingT interface {
|
|
| 19 |
- assert.TestingT |
|
| 20 |
- logT |
|
| 21 |
- skipT |
|
| 22 |
- Fatal(args ...interface{})
|
|
| 23 |
- Fatalf(string, ...interface{})
|
|
| 24 |
- Name() string |
|
| 25 |
-} |
|
| 26 |
- |
|
| 27 |
-type logT interface {
|
|
| 28 |
- Logf(string, ...interface{})
|
|
| 29 |
-} |
|
| 30 |
- |
|
| 31 |
-type skipT interface {
|
|
| 32 |
- Skip(...interface{})
|
|
| 33 |
-} |
|
| 34 |
- |
|
| 35 | 18 |
type gitServer interface {
|
| 36 | 19 |
URL() string |
| 37 | 20 |
Close() error |
| ... | ... |
@@ -64,7 +47,7 @@ func (g *FakeGit) Close() {
|
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
// New create a fake git server that can be used for git related tests |
| 67 |
-func New(c testingT, name string, files map[string]string, enforceLocalServer bool) *FakeGit {
|
|
| 67 |
+func New(c testing.TB, name string, files map[string]string, enforceLocalServer bool) *FakeGit {
|
|
| 68 | 68 |
if ht, ok := c.(testutil.HelperT); ok {
|
| 69 | 69 |
ht.Helper() |
| 70 | 70 |
} |
| ... | ... |
@@ -8,6 +8,7 @@ import ( |
| 8 | 8 |
"os/exec" |
| 9 | 9 |
"path/filepath" |
| 10 | 10 |
"sync" |
| 11 |
+ "testing" |
|
| 11 | 12 |
|
| 12 | 13 |
"github.com/docker/docker/api/types" |
| 13 | 14 |
"github.com/docker/docker/pkg/archive" |
| ... | ... |
@@ -17,7 +18,7 @@ import ( |
| 17 | 17 |
|
| 18 | 18 |
var ensureHTTPServerOnce sync.Once |
| 19 | 19 |
|
| 20 |
-func ensureHTTPServerImage(t testingT) {
|
|
| 20 |
+func ensureHTTPServerImage(t testing.TB) {
|
|
| 21 | 21 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 22 | 22 |
ht.Helper() |
| 23 | 23 |
} |
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
"net/url" |
| 11 | 11 |
"os" |
| 12 | 12 |
"strings" |
| 13 |
+ "testing" |
|
| 13 | 14 |
|
| 14 | 15 |
"github.com/docker/docker/api/types" |
| 15 | 16 |
containertypes "github.com/docker/docker/api/types/container" |
| ... | ... |
@@ -24,23 +25,6 @@ import ( |
| 24 | 24 |
|
| 25 | 25 |
var testEnv *environment.Execution |
| 26 | 26 |
|
| 27 |
-type testingT interface {
|
|
| 28 |
- assert.TestingT |
|
| 29 |
- logT |
|
| 30 |
- skipT |
|
| 31 |
- Fatal(args ...interface{})
|
|
| 32 |
- Fatalf(string, ...interface{})
|
|
| 33 |
- Name() string |
|
| 34 |
-} |
|
| 35 |
- |
|
| 36 |
-type logT interface {
|
|
| 37 |
- Logf(string, ...interface{})
|
|
| 38 |
-} |
|
| 39 |
- |
|
| 40 |
-type skipT interface {
|
|
| 41 |
- Skip(...interface{})
|
|
| 42 |
-} |
|
| 43 |
- |
|
| 44 | 27 |
// Fake is a static file server. It might be running locally or remotely |
| 45 | 28 |
// on test host. |
| 46 | 29 |
type Fake interface {
|
| ... | ... |
@@ -56,7 +40,7 @@ func SetTestEnvironment(env *environment.Execution) {
|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
// New returns a static file server that will be use as build context. |
| 59 |
-func New(t testingT, dir string, modifiers ...func(*fakecontext.Fake) error) Fake {
|
|
| 59 |
+func New(t testing.TB, dir string, modifiers ...func(*fakecontext.Fake) error) Fake {
|
|
| 60 | 60 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 61 | 61 |
ht.Helper() |
| 62 | 62 |
} |
| ... | ... |
@@ -149,7 +133,7 @@ func (f *remoteFileServer) Close() error {
|
| 149 | 149 |
}) |
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 |
-func newRemoteFileServer(t testingT, ctx *fakecontext.Fake, c client.APIClient) *remoteFileServer {
|
|
| 152 |
+func newRemoteFileServer(t testing.TB, ctx *fakecontext.Fake, c client.APIClient) *remoteFileServer {
|
|
| 153 | 153 |
var ( |
| 154 | 154 |
image = fmt.Sprintf("fileserver-img-%s", strings.ToLower(testutil.GenerateRandomAlphaOnlyString(10)))
|
| 155 | 155 |
container = fmt.Sprintf("fileserver-cnt-%s", strings.ToLower(testutil.GenerateRandomAlphaOnlyString(10)))
|
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"os" |
| 8 | 8 |
"os/exec" |
| 9 | 9 |
"path/filepath" |
| 10 |
+ "testing" |
|
| 10 | 11 |
"time" |
| 11 | 12 |
|
| 12 | 13 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -23,18 +24,6 @@ const ( |
| 23 | 23 |
DefaultURL = "127.0.0.1:5000" |
| 24 | 24 |
) |
| 25 | 25 |
|
| 26 |
-type testingT interface {
|
|
| 27 |
- assert.TestingT |
|
| 28 |
- logT |
|
| 29 |
- Fatal(...interface{})
|
|
| 30 |
- Fatalf(string, ...interface{})
|
|
| 31 |
- Name() string |
|
| 32 |
-} |
|
| 33 |
- |
|
| 34 |
-type logT interface {
|
|
| 35 |
- Logf(string, ...interface{})
|
|
| 36 |
-} |
|
| 37 |
- |
|
| 38 | 26 |
// V2 represent a registry version 2 |
| 39 | 27 |
type V2 struct {
|
| 40 | 28 |
cmd *exec.Cmd |
| ... | ... |
@@ -55,7 +44,7 @@ type Config struct {
|
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 | 57 |
// NewV2 creates a v2 registry server |
| 58 |
-func NewV2(t testingT, ops ...func(*Config)) *V2 {
|
|
| 58 |
+func NewV2(t testing.TB, ops ...func(*Config)) *V2 {
|
|
| 59 | 59 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 60 | 60 |
ht.Helper() |
| 61 | 61 |
} |
| ... | ... |
@@ -140,7 +129,7 @@ http: |
| 140 | 140 |
} |
| 141 | 141 |
|
| 142 | 142 |
// WaitReady waits for the registry to be ready to serve requests (or fail after a while) |
| 143 |
-func (r *V2) WaitReady(t testingT) {
|
|
| 143 |
+func (r *V2) WaitReady(t testing.TB) {
|
|
| 144 | 144 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 145 | 145 |
ht.Helper() |
| 146 | 146 |
} |
| ... | ... |
@@ -212,7 +201,7 @@ func (r *V2) WriteBlobContents(t assert.TestingT, blobDigest digest.Digest, data |
| 212 | 212 |
|
| 213 | 213 |
// TempMoveBlobData moves the existing data file aside, so that we can replace it with a |
| 214 | 214 |
// malicious blob of data for example. |
| 215 |
-func (r *V2) TempMoveBlobData(t testingT, blobDigest digest.Digest) (undo func()) {
|
|
| 215 |
+func (r *V2) TempMoveBlobData(t testing.TB, blobDigest digest.Digest) (undo func()) {
|
|
| 216 | 216 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 217 | 217 |
ht.Helper() |
| 218 | 218 |
} |
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"regexp" |
| 7 | 7 |
"strings" |
| 8 | 8 |
"sync" |
| 9 |
+ "testing" |
|
| 9 | 10 |
|
| 10 | 11 |
"github.com/docker/docker/testutil" |
| 11 | 12 |
) |
| ... | ... |
@@ -28,7 +29,7 @@ func (tr *Mock) RegisterHandler(path string, h handlerFunc) {
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
// NewMock creates a registry mock |
| 31 |
-func NewMock(t testingT) (*Mock, error) {
|
|
| 31 |
+func NewMock(t testing.TB) (*Mock, error) {
|
|
| 32 | 32 |
if ht, ok := t.(testutil.HelperT); ok {
|
| 33 | 33 |
ht.Helper() |
| 34 | 34 |
} |