|
@@ -1,4 +1,4 @@
|
|
|
-package daemon // import "github.com/docker/docker/internal/test/daemon"
|
|
|
+package daemon // import "github.com/docker/docker/testutil/daemon"
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
@@ -17,11 +17,11 @@ import (
|
|
|
"github.com/docker/docker/api/types/events"
|
|
|
"github.com/docker/docker/client"
|
|
|
"github.com/docker/docker/daemon/images"
|
|
|
- "github.com/docker/docker/internal/test"
|
|
|
- "github.com/docker/docker/internal/test/request"
|
|
|
"github.com/docker/docker/opts"
|
|
|
"github.com/docker/docker/pkg/ioutils"
|
|
|
"github.com/docker/docker/pkg/stringid"
|
|
|
+ "github.com/docker/docker/testutil"
|
|
|
+ "github.com/docker/docker/testutil/request"
|
|
|
"github.com/docker/go-connections/sockets"
|
|
|
"github.com/docker/go-connections/tlsconfig"
|
|
|
"github.com/pkg/errors"
|
|
@@ -95,7 +95,7 @@ type Daemon struct {
|
|
|
// This will create a directory such as d123456789 in the folder specified by $DOCKER_INTEGRATION_DAEMON_DEST or $DEST.
|
|
|
// The daemon will not automatically start.
|
|
|
func New(t testingT, ops ...func(*Daemon)) *Daemon {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
dest := os.Getenv("DOCKER_INTEGRATION_DAEMON_DEST")
|
|
@@ -191,7 +191,7 @@ func (d *Daemon) ReadLogFile() ([]byte, error) {
|
|
|
|
|
|
// NewClientT creates new client based on daemon's socket path
|
|
|
func (d *Daemon) NewClientT(t assert.TestingT, extraOpts ...client.Opt) *client.Client {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
|
|
@@ -208,7 +208,7 @@ func (d *Daemon) NewClientT(t assert.TestingT, extraOpts ...client.Opt) *client.
|
|
|
|
|
|
// Cleanup cleans the daemon files : exec root (network namespaces, ...), swarmkit files
|
|
|
func (d *Daemon) Cleanup(t testingT) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
// Cleanup swarmkit wal files if present
|
|
@@ -218,7 +218,7 @@ func (d *Daemon) Cleanup(t testingT) {
|
|
|
|
|
|
// Start starts the daemon and return once it is ready to receive requests.
|
|
|
func (d *Daemon) Start(t testingT, args ...string) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
if err := d.StartWithError(args...); err != nil {
|
|
@@ -374,7 +374,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
|
|
// StartWithBusybox will first start the daemon with Daemon.Start()
|
|
|
// then save the busybox image from the main daemon and load it into this Daemon instance.
|
|
|
func (d *Daemon) StartWithBusybox(t testingT, arg ...string) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
d.Start(t, arg...)
|
|
@@ -433,7 +433,7 @@ func (d *Daemon) DumpStackAndQuit() {
|
|
|
// instantiate a new one with NewDaemon.
|
|
|
// If an error occurs while starting the daemon, the test will fail.
|
|
|
func (d *Daemon) Stop(t testingT) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
err := d.StopWithError()
|
|
@@ -521,7 +521,7 @@ out2:
|
|
|
// Restart will restart the daemon by first stopping it and the starting it.
|
|
|
// If an error occurs while starting the daemon, the test will fail.
|
|
|
func (d *Daemon) Restart(t testingT, args ...string) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
d.Stop(t)
|
|
@@ -597,7 +597,7 @@ func (d *Daemon) ReloadConfig() error {
|
|
|
|
|
|
// LoadBusybox image into the daemon
|
|
|
func (d *Daemon) LoadBusybox(t assert.TestingT) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
clientHost, err := client.NewClientWithOpts(client.FromEnv)
|
|
@@ -711,7 +711,7 @@ func (d *Daemon) queryRootDir() (string, error) {
|
|
|
|
|
|
// Info returns the info struct for this daemon
|
|
|
func (d *Daemon) Info(t assert.TestingT) types.Info {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
c := d.NewClientT(t)
|
|
@@ -721,7 +721,7 @@ func (d *Daemon) Info(t assert.TestingT) types.Info {
|
|
|
}
|
|
|
|
|
|
func cleanupRaftDir(t testingT, rootPath string) {
|
|
|
- if ht, ok := t.(test.HelperT); ok {
|
|
|
+ if ht, ok := t.(testutil.HelperT); ok {
|
|
|
ht.Helper()
|
|
|
}
|
|
|
for _, p := range []string{"wal", "wal-v3-encrypted", "snap-v3-encrypted"} {
|