Merge pull request #45073 from corhere/20.10_go1.19_prereqs
[20.10 backport] Prepare for Go 1.19 upgrade
This commit is contained in:
commit
dfd89ede4b
418 changed files with 1697 additions and 1866 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/server/httpstatus"
|
"github.com/docker/docker/api/server/httpstatus"
|
||||||
"github.com/docker/docker/api/server/httputils"
|
"github.com/docker/docker/api/server/httputils"
|
||||||
|
@ -57,7 +58,8 @@ func (s *Server) Accept(addr string, listeners ...net.Listener) {
|
||||||
for _, listener := range listeners {
|
for _, listener := range listeners {
|
||||||
httpServer := &HTTPServer{
|
httpServer := &HTTPServer{
|
||||||
srv: &http.Server{
|
srv: &http.Server{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
|
ReadHeaderTimeout: 5 * time.Minute, // "G112: Potential Slowloris Attack (gosec)"; not a real concern for our use, so setting a long timeout.
|
||||||
},
|
},
|
||||||
l: listener,
|
l: listener,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*Package filters provides tools for encoding a mapping of keys to a set of
|
/*
|
||||||
|
Package filters provides tools for encoding a mapping of keys to a set of
|
||||||
multiple values.
|
multiple values.
|
||||||
*/
|
*/
|
||||||
package filters // import "github.com/docker/docker/api/types/filters"
|
package filters // import "github.com/docker/docker/api/types/filters"
|
||||||
|
|
|
@ -45,31 +45,32 @@ func (ipnet *NetIPNet) UnmarshalJSON(b []byte) (err error) {
|
||||||
// IndexInfo contains information about a registry
|
// IndexInfo contains information about a registry
|
||||||
//
|
//
|
||||||
// RepositoryInfo Examples:
|
// RepositoryInfo Examples:
|
||||||
// {
|
|
||||||
// "Index" : {
|
|
||||||
// "Name" : "docker.io",
|
|
||||||
// "Mirrors" : ["https://registry-2.docker.io/v1/", "https://registry-3.docker.io/v1/"],
|
|
||||||
// "Secure" : true,
|
|
||||||
// "Official" : true,
|
|
||||||
// },
|
|
||||||
// "RemoteName" : "library/debian",
|
|
||||||
// "LocalName" : "debian",
|
|
||||||
// "CanonicalName" : "docker.io/debian"
|
|
||||||
// "Official" : true,
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// {
|
// {
|
||||||
// "Index" : {
|
// "Index" : {
|
||||||
// "Name" : "127.0.0.1:5000",
|
// "Name" : "docker.io",
|
||||||
// "Mirrors" : [],
|
// "Mirrors" : ["https://registry-2.docker.io/v1/", "https://registry-3.docker.io/v1/"],
|
||||||
// "Secure" : false,
|
// "Secure" : true,
|
||||||
// "Official" : false,
|
// "Official" : true,
|
||||||
// },
|
// },
|
||||||
// "RemoteName" : "user/repo",
|
// "RemoteName" : "library/debian",
|
||||||
// "LocalName" : "127.0.0.1:5000/user/repo",
|
// "LocalName" : "debian",
|
||||||
// "CanonicalName" : "127.0.0.1:5000/user/repo",
|
// "CanonicalName" : "docker.io/debian"
|
||||||
// "Official" : false,
|
// "Official" : true,
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
|
// {
|
||||||
|
// "Index" : {
|
||||||
|
// "Name" : "127.0.0.1:5000",
|
||||||
|
// "Mirrors" : [],
|
||||||
|
// "Secure" : false,
|
||||||
|
// "Official" : false,
|
||||||
|
// },
|
||||||
|
// "RemoteName" : "user/repo",
|
||||||
|
// "LocalName" : "127.0.0.1:5000/user/repo",
|
||||||
|
// "CanonicalName" : "127.0.0.1:5000/user/repo",
|
||||||
|
// "Official" : false,
|
||||||
|
// }
|
||||||
type IndexInfo struct {
|
type IndexInfo struct {
|
||||||
// Name is the name of the registry, such as "docker.io"
|
// Name is the name of the registry, such as "docker.io"
|
||||||
Name string
|
Name string
|
||||||
|
|
|
@ -100,8 +100,10 @@ func GetTimestamp(value string, reference time.Time) (string, error) {
|
||||||
// if the incoming nanosecond portion is longer or shorter than 9 digits it is
|
// if the incoming nanosecond portion is longer or shorter than 9 digits it is
|
||||||
// converted to nanoseconds. The expectation is that the seconds and
|
// converted to nanoseconds. The expectation is that the seconds and
|
||||||
// seconds will be used to create a time variable. For example:
|
// seconds will be used to create a time variable. For example:
|
||||||
// seconds, nanoseconds, err := ParseTimestamp("1136073600.000000001",0)
|
//
|
||||||
// if err == nil since := time.Unix(seconds, nanoseconds)
|
// seconds, nanoseconds, err := ParseTimestamp("1136073600.000000001",0)
|
||||||
|
// if err == nil since := time.Unix(seconds, nanoseconds)
|
||||||
|
//
|
||||||
// returns seconds as def(aultSeconds) if value == ""
|
// returns seconds as def(aultSeconds) if value == ""
|
||||||
func ParseTimestamps(value string, def int64) (int64, int64, error) {
|
func ParseTimestamps(value string, def int64) (int64, int64, error) {
|
||||||
if value == "" {
|
if value == "" {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -641,7 +640,7 @@ func (ld *layerDescriptor) Download(ctx context.Context, progressOutput pkgprogr
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ioutil.NopCloser(content.NewReader(ra)), ld.desc.Size, nil
|
return io.NopCloser(content.NewReader(ra)), ld.desc.Size, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ld *layerDescriptor) Close() {
|
func (ld *layerDescriptor) Close() {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
package buildkit
|
package buildkit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -35,7 +34,7 @@ func newExecutor(root, cgroupParent string, net libnetwork.NetworkController, dn
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure net state directory is cleared from previous state
|
// make sure net state directory is cleared from previous state
|
||||||
fis, err := ioutil.ReadDir(netRoot)
|
fis, err := os.ReadDir(netRoot)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for _, fi := range fis {
|
for _, fi := range fis {
|
||||||
fp := filepath.Join(netRoot, fi.Name())
|
fp := filepath.Join(netRoot, fi.Name())
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
nethttp "net/http"
|
nethttp "net/http"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -442,7 +441,7 @@ func (ld *layerDescriptor) Download(ctx context.Context, progressOutput pkgprogr
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ioutil.NopCloser(content.NewReader(ra)), ld.desc.Size, nil
|
return io.NopCloser(content.NewReader(ra)), ld.desc.Size, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ld *layerDescriptor) Close() {
|
func (ld *layerDescriptor) Close() {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -349,8 +348,8 @@ func BuildFromConfig(config *container.Config, changes []string, os string) (*co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b.Stdout = ioutil.Discard
|
b.Stdout = io.Discard
|
||||||
b.Stderr = ioutil.Discard
|
b.Stderr = io.Discard
|
||||||
b.disableCommit = true
|
b.disableCommit = true
|
||||||
|
|
||||||
var commands []instructions.Command
|
var commands []instructions.Command
|
||||||
|
|
|
@ -35,7 +35,6 @@ import (
|
||||||
//
|
//
|
||||||
// Sets the environment variable foo to bar, also makes interpolation
|
// Sets the environment variable foo to bar, also makes interpolation
|
||||||
// in the dockerfile available from the next statement on via ${foo}.
|
// in the dockerfile available from the next statement on via ${foo}.
|
||||||
//
|
|
||||||
func dispatchEnv(d dispatchRequest, c *instructions.EnvCommand) error {
|
func dispatchEnv(d dispatchRequest, c *instructions.EnvCommand) error {
|
||||||
runConfig := d.state.runConfig
|
runConfig := d.state.runConfig
|
||||||
commitMessage := bytes.NewBufferString("ENV")
|
commitMessage := bytes.NewBufferString("ENV")
|
||||||
|
@ -73,7 +72,6 @@ func dispatchMaintainer(d dispatchRequest, c *instructions.MaintainerCommand) er
|
||||||
// LABEL some json data describing the image
|
// LABEL some json data describing the image
|
||||||
//
|
//
|
||||||
// Sets the Label variable foo to bar,
|
// Sets the Label variable foo to bar,
|
||||||
//
|
|
||||||
func dispatchLabel(d dispatchRequest, c *instructions.LabelCommand) error {
|
func dispatchLabel(d dispatchRequest, c *instructions.LabelCommand) error {
|
||||||
if d.state.runConfig.Labels == nil {
|
if d.state.runConfig.Labels == nil {
|
||||||
d.state.runConfig.Labels = make(map[string]string)
|
d.state.runConfig.Labels = make(map[string]string)
|
||||||
|
@ -90,7 +88,6 @@ func dispatchLabel(d dispatchRequest, c *instructions.LabelCommand) error {
|
||||||
//
|
//
|
||||||
// Add the file 'foo' to '/path'. Tarball and Remote URL (http, https) handling
|
// Add the file 'foo' to '/path'. Tarball and Remote URL (http, https) handling
|
||||||
// exist here. If you do not wish to have this automatic handling, use COPY.
|
// exist here. If you do not wish to have this automatic handling, use COPY.
|
||||||
//
|
|
||||||
func dispatchAdd(d dispatchRequest, c *instructions.AddCommand) error {
|
func dispatchAdd(d dispatchRequest, c *instructions.AddCommand) error {
|
||||||
if c.Chmod != "" {
|
if c.Chmod != "" {
|
||||||
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
||||||
|
@ -112,7 +109,6 @@ func dispatchAdd(d dispatchRequest, c *instructions.AddCommand) error {
|
||||||
// COPY foo /path
|
// COPY foo /path
|
||||||
//
|
//
|
||||||
// Same as 'ADD' but without the tar and remote url handling.
|
// Same as 'ADD' but without the tar and remote url handling.
|
||||||
//
|
|
||||||
func dispatchCopy(d dispatchRequest, c *instructions.CopyCommand) error {
|
func dispatchCopy(d dispatchRequest, c *instructions.CopyCommand) error {
|
||||||
if c.Chmod != "" {
|
if c.Chmod != "" {
|
||||||
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
return errors.New("the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled")
|
||||||
|
@ -157,7 +153,6 @@ func (d *dispatchRequest) getImageMount(imageRefOrID string) (*imageMount, error
|
||||||
}
|
}
|
||||||
|
|
||||||
// FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name]
|
// FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name]
|
||||||
//
|
|
||||||
func initializeStage(d dispatchRequest, cmd *instructions.Stage) error {
|
func initializeStage(d dispatchRequest, cmd *instructions.Stage) error {
|
||||||
d.builder.imageProber.Reset()
|
d.builder.imageProber.Reset()
|
||||||
|
|
||||||
|
@ -304,7 +299,6 @@ func dispatchOnbuild(d dispatchRequest, c *instructions.OnbuildCommand) error {
|
||||||
// WORKDIR /tmp
|
// WORKDIR /tmp
|
||||||
//
|
//
|
||||||
// Set the working directory for future RUN/CMD/etc statements.
|
// Set the working directory for future RUN/CMD/etc statements.
|
||||||
//
|
|
||||||
func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
||||||
runConfig := d.state.runConfig
|
runConfig := d.state.runConfig
|
||||||
var err error
|
var err error
|
||||||
|
@ -347,7 +341,6 @@ func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
||||||
// RUN echo hi # sh -c echo hi (Linux and LCOW)
|
// RUN echo hi # sh -c echo hi (Linux and LCOW)
|
||||||
// RUN echo hi # cmd /S /C echo hi (Windows)
|
// RUN echo hi # cmd /S /C echo hi (Windows)
|
||||||
// RUN [ "echo", "hi" ] # echo hi
|
// RUN [ "echo", "hi" ] # echo hi
|
||||||
//
|
|
||||||
func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
|
func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
|
||||||
if !system.IsOSSupported(d.state.operatingSystem) {
|
if !system.IsOSSupported(d.state.operatingSystem) {
|
||||||
return system.ErrNotSupportedOperatingSystem
|
return system.ErrNotSupportedOperatingSystem
|
||||||
|
@ -442,7 +435,6 @@ func prependEnvOnCmd(buildArgs *BuildArgs, buildArgVars []string, cmd strslice.S
|
||||||
//
|
//
|
||||||
// Set the default command to run in the container (which may be empty).
|
// Set the default command to run in the container (which may be empty).
|
||||||
// Argument handling is the same as RUN.
|
// Argument handling is the same as RUN.
|
||||||
//
|
|
||||||
func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
||||||
runConfig := d.state.runConfig
|
runConfig := d.state.runConfig
|
||||||
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
||||||
|
@ -473,7 +465,6 @@ func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
||||||
//
|
//
|
||||||
// Set the default healthcheck command to run in the container (which may be empty).
|
// Set the default healthcheck command to run in the container (which may be empty).
|
||||||
// Argument handling is the same as RUN.
|
// Argument handling is the same as RUN.
|
||||||
//
|
|
||||||
func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand) error {
|
func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand) error {
|
||||||
runConfig := d.state.runConfig
|
runConfig := d.state.runConfig
|
||||||
if runConfig.Healthcheck != nil {
|
if runConfig.Healthcheck != nil {
|
||||||
|
@ -493,7 +484,6 @@ func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand)
|
||||||
//
|
//
|
||||||
// Handles command processing similar to CMD and RUN, only req.runConfig.Entrypoint
|
// Handles command processing similar to CMD and RUN, only req.runConfig.Entrypoint
|
||||||
// is initialized at newBuilder time instead of through argument parsing.
|
// is initialized at newBuilder time instead of through argument parsing.
|
||||||
//
|
|
||||||
func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error {
|
func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error {
|
||||||
runConfig := d.state.runConfig
|
runConfig := d.state.runConfig
|
||||||
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
cmd, argsEscaped := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem, c.Name(), c.String())
|
||||||
|
@ -523,7 +513,6 @@ func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) er
|
||||||
//
|
//
|
||||||
// Expose ports for links and port mappings. This all ends up in
|
// Expose ports for links and port mappings. This all ends up in
|
||||||
// req.runConfig.ExposedPorts for runconfig.
|
// req.runConfig.ExposedPorts for runconfig.
|
||||||
//
|
|
||||||
func dispatchExpose(d dispatchRequest, c *instructions.ExposeCommand, envs []string) error {
|
func dispatchExpose(d dispatchRequest, c *instructions.ExposeCommand, envs []string) error {
|
||||||
// custom multi word expansion
|
// custom multi word expansion
|
||||||
// expose $FOO with FOO="80 443" is expanded as EXPOSE [80,443]. This is the only command supporting word to words expansion
|
// expose $FOO with FOO="80 443" is expanded as EXPOSE [80,443]. This is the only command supporting word to words expansion
|
||||||
|
@ -557,7 +546,6 @@ func dispatchExpose(d dispatchRequest, c *instructions.ExposeCommand, envs []str
|
||||||
//
|
//
|
||||||
// Set the user to 'foo' for future commands and when running the
|
// Set the user to 'foo' for future commands and when running the
|
||||||
// ENTRYPOINT/CMD at container run time.
|
// ENTRYPOINT/CMD at container run time.
|
||||||
//
|
|
||||||
func dispatchUser(d dispatchRequest, c *instructions.UserCommand) error {
|
func dispatchUser(d dispatchRequest, c *instructions.UserCommand) error {
|
||||||
d.state.runConfig.User = c.User
|
d.state.runConfig.User = c.User
|
||||||
return d.builder.commit(d.state, fmt.Sprintf("USER %v", c.User))
|
return d.builder.commit(d.state, fmt.Sprintf("USER %v", c.User))
|
||||||
|
@ -566,7 +554,6 @@ func dispatchUser(d dispatchRequest, c *instructions.UserCommand) error {
|
||||||
// VOLUME /foo
|
// VOLUME /foo
|
||||||
//
|
//
|
||||||
// Expose the volume /foo for use. Will also accept the JSON array form.
|
// Expose the volume /foo for use. Will also accept the JSON array form.
|
||||||
//
|
|
||||||
func dispatchVolume(d dispatchRequest, c *instructions.VolumeCommand) error {
|
func dispatchVolume(d dispatchRequest, c *instructions.VolumeCommand) error {
|
||||||
if d.state.runConfig.Volumes == nil {
|
if d.state.runConfig.Volumes == nil {
|
||||||
d.state.runConfig.Volumes = map[string]struct{}{}
|
d.state.runConfig.Volumes = map[string]struct{}{}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package dockerfile // import "github.com/docker/docker/builder/dockerfile"
|
package dockerfile // import "github.com/docker/docker/builder/dockerfile"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -11,7 +10,7 @@ import (
|
||||||
// It returns the created path and a cleanup function which is meant to be used as deferred call.
|
// It returns the created path and a cleanup function which is meant to be used as deferred call.
|
||||||
// When an error occurs, it terminates the test.
|
// When an error occurs, it terminates the test.
|
||||||
func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
|
func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
|
||||||
path, err := ioutil.TempDir(dir, prefix)
|
path, err := os.MkdirTemp(dir, prefix)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error when creating directory %s with prefix %s: %s", dir, prefix, err)
|
t.Fatalf("Error when creating directory %s with prefix %s: %s", dir, prefix, err)
|
||||||
|
@ -30,7 +29,7 @@ func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
|
||||||
// When an error occurs, it terminates the test
|
// When an error occurs, it terminates the test
|
||||||
func createTestTempFile(t *testing.T, dir, filename, contents string, perm os.FileMode) string {
|
func createTestTempFile(t *testing.T, dir, filename, contents string, perm os.FileMode) string {
|
||||||
filePath := filepath.Join(dir, filename)
|
filePath := filepath.Join(dir, filename)
|
||||||
err := ioutil.WriteFile(filePath, []byte(contents), perm)
|
err := os.WriteFile(filePath, []byte(contents), perm)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error when creating %s file: %s", filename, err)
|
t.Fatalf("Error when creating %s file: %s", filename, err)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -20,7 +19,7 @@ const (
|
||||||
|
|
||||||
const shouldStayFilename = "should_stay"
|
const shouldStayFilename = "should_stay"
|
||||||
|
|
||||||
func extractFilenames(files []os.FileInfo) []string {
|
func extractFilenames(files []os.DirEntry) []string {
|
||||||
filenames := make([]string, len(files))
|
filenames := make([]string, len(files))
|
||||||
|
|
||||||
for i, file := range files {
|
for i, file := range files {
|
||||||
|
@ -31,7 +30,7 @@ func extractFilenames(files []os.FileInfo) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDirectory(t *testing.T, dir string, expectedFiles []string) {
|
func checkDirectory(t *testing.T, dir string, expectedFiles []string) {
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := os.ReadDir(dir)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Could not read directory: %s", err)
|
t.Fatalf("Could not read directory: %s", err)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package git // import "github.com/docker/docker/builder/remotecontext/git"
|
package git // import "github.com/docker/docker/builder/remotecontext/git"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -51,7 +50,7 @@ func Clone(remoteURL string, opts ...CloneOption) (string, error) {
|
||||||
func (repo gitRepo) clone() (checkoutDir string, err error) {
|
func (repo gitRepo) clone() (checkoutDir string, err error) {
|
||||||
fetch := fetchArgs(repo.remote, repo.ref)
|
fetch := fetchArgs(repo.remote, repo.ref)
|
||||||
|
|
||||||
root, err := ioutil.TempDir("", "docker-build-git")
|
root, err := os.MkdirTemp("", "docker-build-git")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -58,7 +57,7 @@ func GetWithStatusError(address string) (resp *http.Response, err error) {
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("failed to GET %s with status %s", address, resp.Status)
|
msg := fmt.Sprintf("failed to GET %s with status %s", address, resp.Status)
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errdefs.System(errors.New(msg + ": error reading body"))
|
return nil, errdefs.System(errors.New(msg + ": error reading body"))
|
||||||
|
@ -81,10 +80,10 @@ func GetWithStatusError(address string) (resp *http.Response, err error) {
|
||||||
// inspectResponse looks into the http response data at r to determine whether its
|
// inspectResponse looks into the http response data at r to determine whether its
|
||||||
// content-type is on the list of acceptable content types for remote build contexts.
|
// content-type is on the list of acceptable content types for remote build contexts.
|
||||||
// This function returns:
|
// This function returns:
|
||||||
// - a string representation of the detected content-type
|
// - a string representation of the detected content-type
|
||||||
// - an io.Reader for the response body
|
// - an io.Reader for the response body
|
||||||
// - an error value which will be non-nil either when something goes wrong while
|
// - an error value which will be non-nil either when something goes wrong while
|
||||||
// reading bytes from r or when the detected content-type is not acceptable.
|
// reading bytes from r or when the detected content-type is not acceptable.
|
||||||
func inspectResponse(ct string, r io.Reader, clen int64) (string, io.Reader, error) {
|
func inspectResponse(ct string, r io.Reader, clen int64) (string, io.Reader, error) {
|
||||||
plen := clen
|
plen := clen
|
||||||
if plen <= 0 || plen > maxPreambleLength {
|
if plen <= 0 || plen > maxPreambleLength {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext"
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -52,7 +51,7 @@ func TestSelectAcceptableMIME(t *testing.T) {
|
||||||
|
|
||||||
func TestInspectEmptyResponse(t *testing.T) {
|
func TestInspectEmptyResponse(t *testing.T) {
|
||||||
ct := "application/octet-stream"
|
ct := "application/octet-stream"
|
||||||
br := ioutil.NopCloser(bytes.NewReader([]byte("")))
|
br := io.NopCloser(bytes.NewReader([]byte("")))
|
||||||
contentType, bReader, err := inspectResponse(ct, br, 0)
|
contentType, bReader, err := inspectResponse(ct, br, 0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("Should have generated an error for an empty response")
|
t.Fatal("Should have generated an error for an empty response")
|
||||||
|
@ -60,7 +59,7 @@ func TestInspectEmptyResponse(t *testing.T) {
|
||||||
if contentType != "application/octet-stream" {
|
if contentType != "application/octet-stream" {
|
||||||
t.Fatalf("Content type should be 'application/octet-stream' but is %q", contentType)
|
t.Fatalf("Content type should be 'application/octet-stream' but is %q", contentType)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(bReader)
|
body, err := io.ReadAll(bReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +70,7 @@ func TestInspectEmptyResponse(t *testing.T) {
|
||||||
|
|
||||||
func TestInspectResponseBinary(t *testing.T) {
|
func TestInspectResponseBinary(t *testing.T) {
|
||||||
ct := "application/octet-stream"
|
ct := "application/octet-stream"
|
||||||
br := ioutil.NopCloser(bytes.NewReader(binaryContext))
|
br := io.NopCloser(bytes.NewReader(binaryContext))
|
||||||
contentType, bReader, err := inspectResponse(ct, br, int64(len(binaryContext)))
|
contentType, bReader, err := inspectResponse(ct, br, int64(len(binaryContext)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -79,7 +78,7 @@ func TestInspectResponseBinary(t *testing.T) {
|
||||||
if contentType != "application/octet-stream" {
|
if contentType != "application/octet-stream" {
|
||||||
t.Fatalf("Content type should be 'application/octet-stream' but is %q", contentType)
|
t.Fatalf("Content type should be 'application/octet-stream' but is %q", contentType)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(bReader)
|
body, err := io.ReadAll(bReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -96,7 +95,7 @@ func TestInspectResponseBinary(t *testing.T) {
|
||||||
func TestResponseUnsupportedContentType(t *testing.T) {
|
func TestResponseUnsupportedContentType(t *testing.T) {
|
||||||
content := []byte(dockerfileContents)
|
content := []byte(dockerfileContents)
|
||||||
ct := "application/json"
|
ct := "application/json"
|
||||||
br := ioutil.NopCloser(bytes.NewReader(content))
|
br := io.NopCloser(bytes.NewReader(content))
|
||||||
contentType, bReader, err := inspectResponse(ct, br, int64(len(dockerfileContents)))
|
contentType, bReader, err := inspectResponse(ct, br, int64(len(dockerfileContents)))
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -105,7 +104,7 @@ func TestResponseUnsupportedContentType(t *testing.T) {
|
||||||
if contentType != ct {
|
if contentType != ct {
|
||||||
t.Fatalf("Should not have altered content-type: orig: %s, altered: %s", ct, contentType)
|
t.Fatalf("Should not have altered content-type: orig: %s, altered: %s", ct, contentType)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(bReader)
|
body, err := io.ReadAll(bReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -117,7 +116,7 @@ func TestResponseUnsupportedContentType(t *testing.T) {
|
||||||
func TestInspectResponseTextSimple(t *testing.T) {
|
func TestInspectResponseTextSimple(t *testing.T) {
|
||||||
content := []byte(dockerfileContents)
|
content := []byte(dockerfileContents)
|
||||||
ct := "text/plain"
|
ct := "text/plain"
|
||||||
br := ioutil.NopCloser(bytes.NewReader(content))
|
br := io.NopCloser(bytes.NewReader(content))
|
||||||
contentType, bReader, err := inspectResponse(ct, br, int64(len(content)))
|
contentType, bReader, err := inspectResponse(ct, br, int64(len(content)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -125,7 +124,7 @@ func TestInspectResponseTextSimple(t *testing.T) {
|
||||||
if contentType != "text/plain" {
|
if contentType != "text/plain" {
|
||||||
t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(bReader)
|
body, err := io.ReadAll(bReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -136,7 +135,7 @@ func TestInspectResponseTextSimple(t *testing.T) {
|
||||||
|
|
||||||
func TestInspectResponseEmptyContentType(t *testing.T) {
|
func TestInspectResponseEmptyContentType(t *testing.T) {
|
||||||
content := []byte(dockerfileContents)
|
content := []byte(dockerfileContents)
|
||||||
br := ioutil.NopCloser(bytes.NewReader(content))
|
br := io.NopCloser(bytes.NewReader(content))
|
||||||
contentType, bodyReader, err := inspectResponse("", br, int64(len(content)))
|
contentType, bodyReader, err := inspectResponse("", br, int64(len(content)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -144,7 +143,7 @@ func TestInspectResponseEmptyContentType(t *testing.T) {
|
||||||
if contentType != "text/plain" {
|
if contentType != "text/plain" {
|
||||||
t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(bodyReader)
|
body, err := io.ReadAll(bodyReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +155,7 @@ func TestInspectResponseEmptyContentType(t *testing.T) {
|
||||||
func TestUnknownContentLength(t *testing.T) {
|
func TestUnknownContentLength(t *testing.T) {
|
||||||
content := []byte(dockerfileContents)
|
content := []byte(dockerfileContents)
|
||||||
ct := "text/plain"
|
ct := "text/plain"
|
||||||
br := ioutil.NopCloser(bytes.NewReader(content))
|
br := io.NopCloser(bytes.NewReader(content))
|
||||||
contentType, bReader, err := inspectResponse(ct, br, -1)
|
contentType, bReader, err := inspectResponse(ct, br, -1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -164,7 +163,7 @@ func TestUnknownContentLength(t *testing.T) {
|
||||||
if contentType != "text/plain" {
|
if contentType != "text/plain" {
|
||||||
t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(bReader)
|
body, err := io.ReadAll(bReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -191,7 +190,7 @@ func TestDownloadRemote(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
assert.Check(t, is.Equal(mimeTypes.TextPlain, contentType))
|
assert.Check(t, is.Equal(mimeTypes.TextPlain, contentType))
|
||||||
raw, err := ioutil.ReadAll(content)
|
raw, err := io.ReadAll(content)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Check(t, is.Equal(dockerfileContents, string(raw)))
|
assert.Check(t, is.Equal(dockerfileContents, string(raw)))
|
||||||
}
|
}
|
||||||
|
@ -238,5 +237,5 @@ func TestGetWithStatusError(t *testing.T) {
|
||||||
|
|
||||||
func readBody(b io.ReadCloser) ([]byte, error) {
|
func readBody(b io.ReadCloser) ([]byte, error) {
|
||||||
defer b.Close()
|
defer b.Close()
|
||||||
return ioutil.ReadAll(b)
|
return io.ReadAll(b)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package remotecontext // import "github.com/docker/docker/builder/remotecontext"
|
package remotecontext // import "github.com/docker/docker/builder/remotecontext"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -23,7 +22,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCloseRootDirectory(t *testing.T) {
|
func TestCloseRootDirectory(t *testing.T) {
|
||||||
contextDir, err := ioutil.TempDir("", "builder-tarsum-test")
|
contextDir, err := os.MkdirTemp("", "builder-tarsum-test")
|
||||||
defer os.RemoveAll(contextDir)
|
defer os.RemoveAll(contextDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error with creating temporary directory: %s", err)
|
t.Fatalf("Error with creating temporary directory: %s", err)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package remotecontext // import "github.com/docker/docker/builder/remotecontext"
|
package remotecontext // import "github.com/docker/docker/builder/remotecontext"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -11,7 +10,7 @@ import (
|
||||||
// It returns the created path and a cleanup function which is meant to be used as deferred call.
|
// It returns the created path and a cleanup function which is meant to be used as deferred call.
|
||||||
// When an error occurs, it terminates the test.
|
// When an error occurs, it terminates the test.
|
||||||
func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
|
func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
|
||||||
path, err := ioutil.TempDir(dir, prefix)
|
path, err := os.MkdirTemp(dir, prefix)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error when creating directory %s with prefix %s: %s", dir, prefix, err)
|
t.Fatalf("Error when creating directory %s with prefix %s: %s", dir, prefix, err)
|
||||||
|
@ -32,7 +31,7 @@ func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
|
||||||
// whose parent directories are properly cleaned up.
|
// whose parent directories are properly cleaned up.
|
||||||
// When an error occurs, it terminates the test.
|
// When an error occurs, it terminates the test.
|
||||||
func createTestTempSubdir(t *testing.T, dir, prefix string) string {
|
func createTestTempSubdir(t *testing.T, dir, prefix string) string {
|
||||||
path, err := ioutil.TempDir(dir, prefix)
|
path, err := os.MkdirTemp(dir, prefix)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error when creating directory %s with prefix %s: %s", dir, prefix, err)
|
t.Fatalf("Error when creating directory %s with prefix %s: %s", dir, prefix, err)
|
||||||
|
@ -45,7 +44,7 @@ func createTestTempSubdir(t *testing.T, dir, prefix string) string {
|
||||||
// When an error occurs, it terminates the test
|
// When an error occurs, it terminates the test
|
||||||
func createTestTempFile(t *testing.T, dir, filename, contents string, perm os.FileMode) string {
|
func createTestTempFile(t *testing.T, dir, filename, contents string, perm os.FileMode) string {
|
||||||
filePath := filepath.Join(dir, filename)
|
filePath := filepath.Join(dir, filename)
|
||||||
err := ioutil.WriteFile(filePath, []byte(contents), perm)
|
err := os.WriteFile(filePath, []byte(contents), perm)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error when creating %s file: %s", filename, err)
|
t.Fatalf("Error when creating %s file: %s", filename, err)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -58,7 +58,7 @@ func TestCheckpointCreate(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -40,7 +40,7 @@ func TestCheckpointDelete(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -43,7 +43,7 @@ func TestCheckpointList(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ Package client is a Go client for the Docker Engine API.
|
||||||
For more information about the Engine API, see the documentation:
|
For more information about the Engine API, see the documentation:
|
||||||
https://docs.docker.com/engine/api/
|
https://docs.docker.com/engine/api/
|
||||||
|
|
||||||
Usage
|
# Usage
|
||||||
|
|
||||||
You use the library by creating a client object and calling methods on it. The
|
You use the library by creating a client object and calling methods on it. The
|
||||||
client can be created either from environment variables with NewClientWithOpts(client.FromEnv),
|
client can be created either from environment variables with NewClientWithOpts(client.FromEnv),
|
||||||
|
@ -37,7 +37,6 @@ For example, to list running containers (the equivalent of "docker ps"):
|
||||||
fmt.Printf("%s %s\n", container.ID[:10], container.Image)
|
fmt.Printf("%s %s\n", container.ID[:10], container.Image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package client // import "github.com/docker/docker/client"
|
package client // import "github.com/docker/docker/client"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -37,7 +37,7 @@ func errorMock(statusCode int, message string) func(req *http.Request) (*http.Re
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: statusCode,
|
StatusCode: statusCode,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(body)),
|
Body: io.NopCloser(bytes.NewReader(body)),
|
||||||
Header: header,
|
Header: header,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func plainTextErrorMock(statusCode int, message string) func(req *http.Request)
|
||||||
return func(req *http.Request) (*http.Response, error) {
|
return func(req *http.Request) (*http.Response, error) {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: statusCode,
|
StatusCode: statusCode,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(message))),
|
Body: io.NopCloser(bytes.NewReader([]byte(message))),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -274,7 +274,7 @@ func TestNegotiateAPIVersionAutomatic(t *testing.T) {
|
||||||
httpClient := newMockClient(func(req *http.Request) (*http.Response, error) {
|
httpClient := newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||||
resp := &http.Response{StatusCode: http.StatusOK, Header: http.Header{}}
|
resp := &http.Response{StatusCode: http.StatusOK, Header: http.Header{}}
|
||||||
resp.Header.Set("API-Version", pingVersion)
|
resp.Header.Set("API-Version", pingVersion)
|
||||||
resp.Body = ioutil.NopCloser(strings.NewReader("OK"))
|
resp.Body = io.NopCloser(strings.NewReader("OK"))
|
||||||
return resp, nil
|
return resp, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -56,7 +56,7 @@ func TestConfigCreate(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusCreated,
|
StatusCode: http.StatusCreated,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
@ -23,7 +23,7 @@ func (cli *Client) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.C
|
||||||
return swarm.Config{}, nil, wrapResponseError(err, resp, "config", id)
|
return swarm.Config{}, nil, wrapResponseError(err, resp, "config", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Config{}, nil, err
|
return swarm.Config{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -89,7 +89,7 @@ func TestConfigInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -92,7 +92,7 @@ func TestConfigList(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -49,7 +49,7 @@ func TestConfigRemove(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -50,7 +50,7 @@ func TestConfigUpdate(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
// multiplexed.
|
// multiplexed.
|
||||||
// The format of the multiplexed stream is as follows:
|
// The format of the multiplexed stream is as follows:
|
||||||
//
|
//
|
||||||
// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
||||||
//
|
//
|
||||||
// STREAM_TYPE can be 1 for stdout and 2 for stderr
|
// STREAM_TYPE can be 1 for stdout and 2 for stderr
|
||||||
//
|
//
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -76,7 +76,7 @@ func TestContainerCommit(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -40,7 +40,7 @@ func TestContainerStatPathNoHeaderError(t *testing.T) {
|
||||||
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func TestContainerStatPath(t *testing.T) {
|
||||||
base64PathStat := base64.StdEncoding.EncodeToString(content)
|
base64PathStat := base64.StdEncoding.EncodeToString(content)
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
Header: http.Header{
|
Header: http.Header{
|
||||||
"X-Docker-Container-Path-Stat": []string{base64PathStat},
|
"X-Docker-Container-Path-Stat": []string{base64PathStat},
|
||||||
},
|
},
|
||||||
|
@ -147,7 +147,7 @@ func TestCopyToContainer(t *testing.T) {
|
||||||
return nil, fmt.Errorf("noOverwriteDirNonDir not set in URL query properly, expected true, got %s", noOverwriteDirNonDir)
|
return nil, fmt.Errorf("noOverwriteDirNonDir not set in URL query properly, expected true, got %s", noOverwriteDirNonDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := ioutil.ReadAll(req.Body)
|
content, err := io.ReadAll(req.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ func TestCopyToContainer(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ func TestCopyFromContainerNoHeaderError(t *testing.T) {
|
||||||
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ func TestCopyFromContainer(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("content"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("content"))),
|
||||||
Header: http.Header{
|
Header: http.Header{
|
||||||
"X-Docker-Container-Path-Stat": []string{base64PathStat},
|
"X-Docker-Container-Path-Stat": []string{base64PathStat},
|
||||||
},
|
},
|
||||||
|
@ -263,7 +263,7 @@ func TestCopyFromContainer(t *testing.T) {
|
||||||
if stat.Mode != 0700 {
|
if stat.Mode != 0700 {
|
||||||
t.Fatalf("expected container path stat mode to be 0700, got '%v'", stat.Mode)
|
t.Fatalf("expected container path stat mode to be 0700, got '%v'", stat.Mode)
|
||||||
}
|
}
|
||||||
content, err := ioutil.ReadAll(r)
|
content, err := io.ReadAll(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -62,7 +62,7 @@ func TestContainerCreateWithName(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func TestContainerCreateAutoRemove(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -46,7 +46,7 @@ func TestContainerDiff(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -53,7 +53,7 @@ func TestContainerExecCreate(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ func TestContainerExecStart(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ func TestContainerExecInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -32,7 +32,7 @@ func TestContainerExport(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("response"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("response"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ func TestContainerExport(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer body.Close()
|
defer body.Close()
|
||||||
content, err := ioutil.ReadAll(body)
|
content, err := io.ReadAll(body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -41,7 +41,7 @@ func (cli *Client) ContainerInspectWithRaw(ctx context.Context, containerID stri
|
||||||
return types.ContainerJSON{}, nil, wrapResponseError(err, serverResp, "container", containerID)
|
return types.ContainerJSON{}, nil, wrapResponseError(err, serverResp, "container", containerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ContainerJSON{}, nil, err
|
return types.ContainerJSON{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -68,7 +68,7 @@ func TestContainerInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ func TestContainerInspectNode(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -35,7 +35,7 @@ func TestContainerKill(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -73,7 +73,7 @@ func TestContainerList(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
// multiplexed.
|
// multiplexed.
|
||||||
// The format of the multiplexed stream is as follows:
|
// The format of the multiplexed stream is as follows:
|
||||||
//
|
//
|
||||||
// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
||||||
//
|
//
|
||||||
// STREAM_TYPE can be 1 for stdout and 2 for stderr
|
// STREAM_TYPE can be 1 for stdout and 2 for stderr
|
||||||
//
|
//
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -135,7 +134,7 @@ func TestContainerLogs(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("response"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("response"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -146,7 +145,7 @@ func TestContainerLogs(t *testing.T) {
|
||||||
}
|
}
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
defer body.Close()
|
defer body.Close()
|
||||||
content, err := ioutil.ReadAll(body)
|
content, err := io.ReadAll(body)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Check(t, is.Contains(string(content), "response"))
|
assert.Check(t, is.Contains(string(content), "response"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -31,7 +31,7 @@ func TestContainerPause(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -114,7 +114,7 @@ func TestContainersPrune(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
version: "1.25",
|
version: "1.25",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -56,7 +56,7 @@ func TestContainerRemove(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -35,7 +35,7 @@ func TestContainerRename(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -77,7 +77,7 @@ func resizeTransport(expectedURL string) func(req *http.Request) (*http.Response
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -37,7 +37,7 @@ func TestContainerRestart(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -46,7 +46,7 @@ func TestContainerStart(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -51,7 +51,7 @@ func TestContainerStats(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("response"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("response"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func TestContainerStats(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
content, err := ioutil.ReadAll(resp.Body)
|
content, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -37,7 +37,7 @@ func TestContainerStop(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -57,7 +57,7 @@ func TestContainerTop(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -31,7 +31,7 @@ func TestContainerUnpause(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -40,7 +40,7 @@ func TestContainerUpdate(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -46,7 +46,7 @@ func TestContainerWait(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -46,7 +46,7 @@ func TestDiskUsage(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -138,7 +137,7 @@ func TestEvents(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(buffer),
|
Body: io.NopCloser(buffer),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -92,7 +92,7 @@ func TestTLSCloseWriter(t *testing.T) {
|
||||||
_, err = resp.Conn.Write([]byte("hello"))
|
_, err = resp.Conn.Write([]byte("hello"))
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
b, err := ioutil.ReadAll(resp.Reader)
|
b, err := io.ReadAll(resp.Reader)
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Assert(t, string(b) == "hello")
|
assert.Assert(t, string(b) == "hello")
|
||||||
assert.Assert(t, resp.CloseWrite())
|
assert.Assert(t, resp.CloseWrite())
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -195,7 +195,7 @@ func TestImageBuild(t *testing.T) {
|
||||||
headers.Add("Server", "Docker/v1.23 (MyOS)")
|
headers.Add("Server", "Docker/v1.23 (MyOS)")
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
Header: headers,
|
Header: headers,
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
|
@ -207,7 +207,7 @@ func TestImageBuild(t *testing.T) {
|
||||||
if buildResponse.OSType != "MyOS" {
|
if buildResponse.OSType != "MyOS" {
|
||||||
t.Fatalf("expected OSType to be 'MyOS', got %s", buildResponse.OSType)
|
t.Fatalf("expected OSType to be 'MyOS', got %s", buildResponse.OSType)
|
||||||
}
|
}
|
||||||
response, err := ioutil.ReadAll(buildResponse.Body)
|
response, err := io.ReadAll(buildResponse.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -52,7 +52,7 @@ func TestImageCreate(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func TestImageCreate(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
response, err := ioutil.ReadAll(createResponse)
|
response, err := io.ReadAll(createResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -47,7 +47,7 @@ func TestImageHistory(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -56,7 +56,7 @@ func TestImageImport(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("response"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("response"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ func TestImageImport(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
response, err := ioutil.ReadAll(importResponse)
|
response, err := io.ReadAll(importResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@ func (cli *Client) ImageInspectWithRaw(ctx context.Context, imageID string) (typ
|
||||||
return types.ImageInspect{}, nil, wrapResponseError(err, serverResp, "image", imageID)
|
return types.ImageInspect{}, nil, wrapResponseError(err, serverResp, "image", imageID)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.ImageInspect{}, nil, err
|
return types.ImageInspect{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -67,7 +67,7 @@ func TestImageInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -96,7 +96,7 @@ func TestImageList(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ func TestImageListApiBefore125(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
version: "1.24",
|
version: "1.24",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -71,7 +71,7 @@ func TestImageLoad(t *testing.T) {
|
||||||
headers.Add("Content-Type", loadCase.responseContentType)
|
headers.Add("Content-Type", loadCase.responseContentType)
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(expectedOutput))),
|
Body: io.NopCloser(bytes.NewReader([]byte(expectedOutput))),
|
||||||
Header: headers,
|
Header: headers,
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
|
@ -85,7 +85,7 @@ func TestImageLoad(t *testing.T) {
|
||||||
if imageLoadResponse.JSON != loadCase.expectedResponseJSON {
|
if imageLoadResponse.JSON != loadCase.expectedResponseJSON {
|
||||||
t.Fatalf("expected a JSON response, was not.")
|
t.Fatalf("expected a JSON response, was not.")
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(imageLoadResponse.Body)
|
body, err := io.ReadAll(imageLoadResponse.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -108,7 +108,7 @@ func TestImagesPrune(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
version: "1.25",
|
version: "1.25",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -87,7 +87,7 @@ func TestImagePullWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
if auth == "NotValid" {
|
if auth == "NotValid" {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusUnauthorized,
|
StatusCode: http.StatusUnauthorized,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if auth != "IAmValid" {
|
if auth != "IAmValid" {
|
||||||
|
@ -104,7 +104,7 @@ func TestImagePullWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("hello world"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("hello world"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ func TestImagePullWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(resp)
|
body, err := io.ReadAll(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ func TestImagePullWithoutErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(expectedOutput))),
|
Body: io.NopCloser(bytes.NewReader([]byte(expectedOutput))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ func TestImagePullWithoutErrors(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(resp)
|
body, err := io.ReadAll(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -92,7 +92,7 @@ func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
if auth == "NotValid" {
|
if auth == "NotValid" {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusUnauthorized,
|
StatusCode: http.StatusUnauthorized,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if auth != "IAmValid" {
|
if auth != "IAmValid" {
|
||||||
|
@ -105,7 +105,7 @@ func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("hello world"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("hello world"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ func TestImagePushWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(resp)
|
body, err := io.ReadAll(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ func TestImagePushWithoutErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(expectedOutput))),
|
Body: io.NopCloser(bytes.NewReader([]byte(expectedOutput))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ func TestImagePushWithoutErrors(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
body, err := ioutil.ReadAll(resp)
|
body, err := io.ReadAll(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -90,7 +90,7 @@ func TestImageRemove(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -39,7 +39,7 @@ func TestImageSave(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("response"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("response"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func TestImageSave(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
response, err := ioutil.ReadAll(saveResponse)
|
response, err := io.ReadAll(saveResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -77,7 +77,7 @@ func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
if auth == "NotValid" {
|
if auth == "NotValid" {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusUnauthorized,
|
StatusCode: http.StatusUnauthorized,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("Invalid credentials"))),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if auth != "IAmValid" {
|
if auth != "IAmValid" {
|
||||||
|
@ -98,7 +98,7 @@ func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ func TestImageSearchWithoutErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -132,7 +132,7 @@ func TestImageTag(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -29,7 +29,7 @@ func TestInfoInvalidResponseJSONError(t *testing.T) {
|
||||||
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("invalid json"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("invalid json"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func TestInfo(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -54,7 +54,7 @@ func TestNetworkConnectEmptyNilEndpointSettings(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func TestNetworkConnect(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -47,7 +47,7 @@ func TestNetworkCreate(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -53,7 +53,7 @@ func TestNetworkDisconnect(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -39,7 +39,7 @@ func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string,
|
||||||
return networkResource, nil, wrapResponseError(err, resp, "network", networkID)
|
return networkResource, nil, wrapResponseError(err, resp, "network", networkID)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return networkResource, nil, err
|
return networkResource, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -69,7 +69,7 @@ func TestNetworkInspect(t *testing.T) {
|
||||||
if strings.Contains(req.URL.RawQuery, "scope=global") {
|
if strings.Contains(req.URL.RawQuery, "scope=global") {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ func TestNetworkInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -93,7 +93,7 @@ func TestNetworkList(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -101,7 +101,7 @@ func TestNetworksPrune(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
version: "1.25",
|
version: "1.25",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -36,7 +36,7 @@ func TestNetworkRemove(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@ func (cli *Client) NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm
|
||||||
return swarm.Node{}, nil, wrapResponseError(err, serverResp, "node", nodeID)
|
return swarm.Node{}, nil, wrapResponseError(err, serverResp, "node", nodeID)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(serverResp.body)
|
body, err := io.ReadAll(serverResp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Node{}, nil, err
|
return swarm.Node{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -64,7 +64,7 @@ func TestNodeInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -79,7 +79,7 @@ func TestNodeList(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -56,7 +56,7 @@ func TestNodeRemove(t *testing.T) {
|
||||||
|
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -37,7 +37,7 @@ func TestNodeUpdate(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))),
|
Body: io.NopCloser(bytes.NewReader([]byte("body"))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -26,7 +26,7 @@ func TestPingFail(t *testing.T) {
|
||||||
resp.Header.Set("API-Version", "awesome")
|
resp.Header.Set("API-Version", "awesome")
|
||||||
resp.Header.Set("Docker-Experimental", "true")
|
resp.Header.Set("Docker-Experimental", "true")
|
||||||
}
|
}
|
||||||
resp.Body = ioutil.NopCloser(strings.NewReader("some error with the server"))
|
resp.Body = io.NopCloser(strings.NewReader("some error with the server"))
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func TestPingWithError(t *testing.T) {
|
||||||
resp.Header = http.Header{}
|
resp.Header = http.Header{}
|
||||||
resp.Header.Set("API-Version", "awesome")
|
resp.Header.Set("API-Version", "awesome")
|
||||||
resp.Header.Set("Docker-Experimental", "true")
|
resp.Header.Set("Docker-Experimental", "true")
|
||||||
resp.Body = ioutil.NopCloser(strings.NewReader("some error with the server"))
|
resp.Body = io.NopCloser(strings.NewReader("some error with the server"))
|
||||||
return resp, errors.New("some error")
|
return resp, errors.New("some error")
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ func TestPingSuccess(t *testing.T) {
|
||||||
resp.Header = http.Header{}
|
resp.Header = http.Header{}
|
||||||
resp.Header.Set("API-Version", "awesome")
|
resp.Header.Set("API-Version", "awesome")
|
||||||
resp.Header.Set("Docker-Experimental", "true")
|
resp.Header.Set("Docker-Experimental", "true")
|
||||||
resp.Body = ioutil.NopCloser(strings.NewReader("OK"))
|
resp.Body = io.NopCloser(strings.NewReader("OK"))
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -37,7 +37,7 @@ func TestPluginDisable(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -37,7 +37,7 @@ func TestPluginEnable(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@ func (cli *Client) PluginInspectWithRaw(ctx context.Context, name string) (*type
|
||||||
return nil, nil, wrapResponseError(err, resp, "plugin", name)
|
return nil, nil, wrapResponseError(err, resp, "plugin", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -53,7 +53,7 @@ func TestPluginInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -92,7 +92,7 @@ func TestPluginList(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -40,7 +40,7 @@ func TestPluginPush(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -37,7 +37,7 @@ func TestPluginRemove(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -36,7 +36,7 @@ func TestPluginSet(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -129,7 +128,7 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
|
||||||
}
|
}
|
||||||
|
|
||||||
if cli.scheme == "https" && strings.Contains(err.Error(), "bad certificate") {
|
if cli.scheme == "https" && strings.Contains(err.Error(), "bad certificate") {
|
||||||
return serverResp, errors.Wrap(err, "The server probably has client authentication (--tlsverify) enabled. Please check your TLS client certification settings")
|
return serverResp, errors.Wrap(err, "the server probably has client authentication (--tlsverify) enabled; check your TLS client certification settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't decorate context sentinel errors; users may be comparing to
|
// Don't decorate context sentinel errors; users may be comparing to
|
||||||
|
@ -141,7 +140,7 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
|
||||||
if nErr, ok := err.(*url.Error); ok {
|
if nErr, ok := err.(*url.Error); ok {
|
||||||
if nErr, ok := nErr.Err.(*net.OpError); ok {
|
if nErr, ok := nErr.Err.(*net.OpError); ok {
|
||||||
if os.IsPermission(nErr.Err) {
|
if os.IsPermission(nErr.Err) {
|
||||||
return serverResp, errors.Wrapf(err, "Got permission denied while trying to connect to the Docker daemon socket at %v", cli.host)
|
return serverResp, errors.Wrapf(err, "permission denied while trying to connect to the Docker daemon socket at %v", cli.host)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,10 +167,10 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
|
||||||
if strings.Contains(err.Error(), `open //./pipe/docker_engine`) {
|
if strings.Contains(err.Error(), `open //./pipe/docker_engine`) {
|
||||||
// Checks if client is running with elevated privileges
|
// Checks if client is running with elevated privileges
|
||||||
if f, elevatedErr := os.Open("\\\\.\\PHYSICALDRIVE0"); elevatedErr == nil {
|
if f, elevatedErr := os.Open("\\\\.\\PHYSICALDRIVE0"); elevatedErr == nil {
|
||||||
err = errors.Wrap(err, "In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.")
|
err = errors.Wrap(err, "in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect")
|
||||||
} else {
|
} else {
|
||||||
f.Close()
|
f.Close()
|
||||||
err = errors.Wrap(err, "This error may indicate that the docker daemon is not running.")
|
err = errors.Wrap(err, "this error may indicate that the docker daemon is not running")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +198,7 @@ func (cli *Client) checkResponseErr(serverResp serverResponse) error {
|
||||||
R: serverResp.body,
|
R: serverResp.body,
|
||||||
N: int64(bodyMax),
|
N: int64(bodyMax),
|
||||||
}
|
}
|
||||||
body, err = ioutil.ReadAll(bodyR)
|
body, err = io.ReadAll(bodyR)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -259,7 +258,7 @@ func encodeData(data interface{}) (*bytes.Buffer, error) {
|
||||||
func ensureReaderClosed(response serverResponse) {
|
func ensureReaderClosed(response serverResponse) {
|
||||||
if response.body != nil {
|
if response.body != nil {
|
||||||
// Drain up to 512 bytes and close the body to let the Transport reuse the connection
|
// Drain up to 512 bytes and close the body to let the Transport reuse the connection
|
||||||
io.CopyN(ioutil.Discard, response.body, 512)
|
io.CopyN(io.Discard, response.body, 512)
|
||||||
response.body.Close()
|
response.body.Close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -64,7 +64,7 @@ func TestSetHostHeader(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(""))),
|
Body: io.NopCloser(bytes.NewReader([]byte(""))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ func TestInfiniteError(t *testing.T) {
|
||||||
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
client: newMockClient(func(req *http.Request) (*http.Response, error) {
|
||||||
resp := &http.Response{StatusCode: http.StatusInternalServerError}
|
resp := &http.Response{StatusCode: http.StatusInternalServerError}
|
||||||
resp.Header = http.Header{}
|
resp.Header = http.Header{}
|
||||||
resp.Body = ioutil.NopCloser(infinitR)
|
resp.Body = io.NopCloser(infinitR)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -56,7 +56,7 @@ func TestSecretCreate(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusCreated,
|
StatusCode: http.StatusCreated,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(b)),
|
Body: io.NopCloser(bytes.NewReader(b)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
)
|
)
|
||||||
|
@ -23,7 +23,7 @@ func (cli *Client) SecretInspectWithRaw(ctx context.Context, id string) (swarm.S
|
||||||
return swarm.Secret{}, nil, wrapResponseError(err, resp, "secret", id)
|
return swarm.Secret{}, nil, wrapResponseError(err, resp, "secret", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.body)
|
body, err := io.ReadAll(resp.body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return swarm.Secret{}, nil, err
|
return swarm.Secret{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -78,7 +78,7 @@ func TestSecretInspect(t *testing.T) {
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader(content)),
|
Body: io.NopCloser(bytes.NewReader(content)),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue