testutil: don't import "opts" package

It was only used for two consts, which are unlikely to change, but the
"opts" package currently also imports libnetwork/ipamutils, which has
an `init()` function that does some heavy lifting, and not needed for
this utility's purpose.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-08-18 14:28:00 +02:00
parent ba2adeebdb
commit b90dd66bdd
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,6 @@ import (
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/events" "github.com/docker/docker/api/types/events"
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/testutil/request" "github.com/docker/docker/testutil/request"
@ -43,6 +42,8 @@ const (
defaultDockerdBinary = "dockerd" defaultDockerdBinary = "dockerd"
defaultContainerdSocket = "/var/run/docker/containerd/containerd.sock" defaultContainerdSocket = "/var/run/docker/containerd/containerd.sock"
defaultDockerdRootlessBinary = "dockerd-rootless.sh" defaultDockerdRootlessBinary = "dockerd-rootless.sh"
defaultUnixSocket = "/var/run/docker.sock"
defaultTLSHost = "localhost:2376"
) )
var errDaemonNotStarted = errors.New("daemon not started") var errDaemonNotStarted = errors.New("daemon not started")
@ -739,11 +740,11 @@ func (d *Daemon) getClientConfig() (*clientConfig, error) {
transport = &http.Transport{ transport = &http.Transport{
TLSClientConfig: tlsConfig, TLSClientConfig: tlsConfig,
} }
addr = fmt.Sprintf("%s:%d", opts.DefaultHTTPHost, opts.DefaultTLSHTTPPort) addr = defaultTLSHost
scheme = "https" scheme = "https"
proto = "tcp" proto = "tcp"
} else if d.UseDefaultHost { } else if d.UseDefaultHost {
addr = opts.DefaultUnixSocket addr = defaultUnixSocket
proto = "unix" proto = "unix"
scheme = "http" scheme = "http"
transport = &http.Transport{} transport = &http.Transport{}

View File

@ -15,7 +15,6 @@ import (
"time" "time"
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/opts"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/testutil/environment" "github.com/docker/docker/testutil/environment"
"github.com/docker/go-connections/sockets" "github.com/docker/go-connections/sockets"
@ -180,7 +179,7 @@ func getTLSConfig() (*tls.Config, error) {
// DaemonHost return the daemon host string for this test execution // DaemonHost return the daemon host string for this test execution
func DaemonHost() string { func DaemonHost() string {
daemonURLStr := "unix://" + opts.DefaultUnixSocket daemonURLStr := client.DefaultDockerHost
if daemonHostVar := os.Getenv("DOCKER_HOST"); daemonHostVar != "" { if daemonHostVar := os.Getenv("DOCKER_HOST"); daemonHostVar != "" {
daemonURLStr = daemonHostVar daemonURLStr = daemonHostVar
} }