1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove use of deprecated client.NewClient()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-01-21 12:32:56 +01:00
parent 5801c04345
commit 3a4bb96ab7
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 3 additions and 7 deletions

View file

@ -78,7 +78,7 @@ func TestTLSCloseWriter(t *testing.T) {
serverURL, err := url.Parse(ts.URL) serverURL, err := url.Parse(ts.URL)
assert.NilError(t, err) assert.NilError(t, err)
client, err := NewClient("tcp://"+serverURL.Host, "", ts.Client(), nil) client, err := NewClientWithOpts(WithHost("tcp://"+serverURL.Host), WithHTTPClient(ts.Client()))
assert.NilError(t, err) assert.NilError(t, err)
resp, err := client.postHijacked(context.Background(), "/asdf", url.Values{}, nil, map[string][]string{"Content-Type": {"text/plain"}}) resp, err := client.postHijacked(context.Background(), "/asdf", url.Values{}, nil, map[string][]string{"Content-Type": {"text/plain"}})

View file

@ -1443,8 +1443,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(
// Attempt to extract to a symlink in the volume which points to a // Attempt to extract to a symlink in the volume which points to a
// directory outside the volume. This should cause an error because the // directory outside the volume. This should cause an error because the
// rootfs is read-only. // rootfs is read-only.
var httpClient *http.Client cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.20"))
cli, err := client.NewClient(request.DaemonHost(), "v1.20", httpClient, map[string]string{})
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
err = cli.CopyToContainer(context.Background(), cID, "/vol2/symlinkToAbsDir", nil, types.CopyToContainerOptions{}) err = cli.CopyToContainer(context.Background(), cID, "/vol2/symlinkToAbsDir", nil, types.CopyToContainerOptions{})

View file

@ -24,9 +24,7 @@ import (
"time" "time"
"github.com/cloudflare/cfssl/helpers" "github.com/cloudflare/cfssl/helpers"
"github.com/docker/docker/api"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/client"
moby_daemon "github.com/docker/docker/daemon" moby_daemon "github.com/docker/docker/daemon"
"github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/integration-cli/checker"
"github.com/docker/docker/integration-cli/cli" "github.com/docker/docker/integration-cli/cli"
@ -3007,8 +3005,7 @@ func (s *DockerDaemonSuite) TestFailedPluginRemove(c *check.C) {
testRequires(c, DaemonIsLinux, IsAmd64, testEnv.IsLocalDaemon) testRequires(c, DaemonIsLinux, IsAmd64, testEnv.IsLocalDaemon)
d := daemon.New(c, dockerBinary, dockerdBinary) d := daemon.New(c, dockerBinary, dockerdBinary)
d.Start(c) d.Start(c)
cli, err := client.NewClient(d.Sock(), api.DefaultVersion, nil, nil) cli := d.NewClientT(c)
c.Assert(err, checker.IsNil)
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second)
defer cancel() defer cancel()