Merge pull request #44211 from thaJeztah/more_linters_step1

fix (whitespace) formatting in preparation of enabling more linters
This commit is contained in:
Sebastiaan van Stijn 2022-09-28 15:39:15 +02:00 committed by GitHub
commit 8d193d81af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
140 changed files with 16 additions and 262 deletions

View File

@ -61,5 +61,4 @@ func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http.
ctx = context.WithValue(ctx, httputils.APIVersionKey{}, apiVersion)
return handler(ctx, w, r, vars)
}
}

View File

@ -237,7 +237,6 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
defer func() { _ = output.Close() }()
errf := func(err error) error {
if httputils.BoolValue(r, "q") && notVerboseBuffer.Len() > 0 {
_, _ = output.Write(notVerboseBuffer.Bytes())
}

View File

@ -115,5 +115,4 @@ func TestAdjustForAPIVersion(t *testing.T) {
if len(spec.TaskTemplate.ContainerSpec.Ulimits) != 0 {
t.Error("Ulimits were not stripped from spec")
}
}

View File

@ -33,17 +33,16 @@ func TestStrSliceUnmarshalJSON(t *testing.T) {
"[]": {},
`["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"},
}
for json, expectedParts := range parts {
for input, expected := range parts {
strs := StrSlice{"default", "values"}
if err := strs.UnmarshalJSON([]byte(json)); err != nil {
if err := strs.UnmarshalJSON([]byte(input)); err != nil {
t.Fatal(err)
}
actualParts := []string(strs)
if !reflect.DeepEqual(actualParts, expectedParts) {
t.Fatalf("%#v: expected %v, got %v", json, expectedParts, actualParts)
if !reflect.DeepEqual(actualParts, expected) {
t.Fatalf("%#v: expected %v, got %v", input, expected, actualParts)
}
}
}

View File

@ -177,7 +177,7 @@ func (is *Source) Resolve(ctx context.Context, id source.Identifier, sm *session
p := &puller{
src: imageIdentifier,
is: is,
//resolver: is.getResolver(is.RegistryHosts, imageIdentifier.Reference.String(), sm, g),
// resolver: is.getResolver(is.RegistryHosts, imageIdentifier.Reference.String(), sm, g),
platform: platform,
sm: sm,
}
@ -439,7 +439,6 @@ func (p *puller) Snapshot(ctx context.Context, g session.Group) (cache.Immutable
// TODO: Optimize to do dispatch and integrate pulling with download manager,
// leverage existing blob mapping and layer storage
} else {
// TODO: need a wrapper snapshot interface that combines content
// and snapshots as 1) buildkit shouldn't have a dependency on contentstore
// or 2) cachemanager should manage the contentstore

View File

@ -24,7 +24,6 @@ import (
// ResolveCacheImporterFunc returns a resolver function for local inline cache
func ResolveCacheImporterFunc(sm *session.Manager, resolverFunc docker.RegistryHosts, cs content.Store, rs reference.Store, is imagestore.Store) remotecache.ResolveCacheImporterFunc {
upstream := registryremotecache.ResolveCacheImporterFunc(sm, cs, resolverFunc)
return func(ctx context.Context, group session.Group, attrs map[string]string) (remotecache.Importer, specs.Descriptor, error) {

View File

@ -295,7 +295,6 @@ func (b *Builder) dispatchDockerfileWithCancellation(parseResult []instructions.
}
dispatchRequest.state.updateRunConfig()
fmt.Fprintf(b.Stdout, " ---> %s\n", stringid.TruncateID(dispatchRequest.state.imageID))
}
if err := emitImageID(b.Aux, dispatchRequest.state); err != nil {
return nil, err

View File

@ -104,7 +104,6 @@ func copierFromDispatchRequest(req dispatchRequest, download sourceDownloader, i
imageSource: imageSource,
platform: platform,
}
}
func (o *copier) createCopyInstruction(sourcesAndDest instructions.SourcesAndDest, cmdName string) (copyInstruction, error) {

View File

@ -64,7 +64,6 @@ func dispatchEnv(d dispatchRequest, c *instructions.EnvCommand) error {
//
// Sets the maintainer metadata.
func dispatchMaintainer(d dispatchRequest, c *instructions.MaintainerCommand) error {
d.state.maintainer = c.Maintainer
return d.builder.commit(d.state, "MAINTAINER "+c.Maintainer)
}
@ -557,7 +556,6 @@ func dispatchVolume(d dispatchRequest, c *instructions.VolumeCommand) error {
//
// Set the signal that will be used to kill the container.
func dispatchStopSignal(d dispatchRequest, c *instructions.StopSignalCommand) error {
_, err := signal.ParseSignal(c.Signal)
if err != nil {
return errdefs.InvalidParameter(err)

View File

@ -284,7 +284,6 @@ func TestHealthcheckNone(t *testing.T) {
}
func TestHealthcheckCmd(t *testing.T) {
b := newBuilderWithMockBackend()
sb := newDispatchRequest(b, '`', nil, NewBuildArgs(make(map[string]*string)), newStagesBuildResults())
expectedTest := []string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}

View File

@ -139,7 +139,6 @@ func TestCopyRunConfig(t *testing.T) {
// Assert the original was not modified
assert.Check(t, runConfig != runConfigCopy, testcase.doc)
}
}
func fullMutableRunConfig() *container.Config {

View File

@ -72,7 +72,6 @@ func TestProcessShouldRemoveDockerfileDockerignore(t *testing.T) {
executeProcess(t, contextDir)
checkDirectory(t, contextDir, []string{shouldStayFilename})
}
func TestProcessNoDockerignore(t *testing.T) {
@ -85,7 +84,6 @@ func TestProcessNoDockerignore(t *testing.T) {
executeProcess(t, contextDir)
checkDirectory(t, contextDir, []string{shouldStayFilename, builder.DefaultDockerfileName})
}
func TestProcessShouldLeaveAllFiles(t *testing.T) {
@ -99,7 +97,6 @@ func TestProcessShouldLeaveAllFiles(t *testing.T) {
executeProcess(t, contextDir)
checkDirectory(t, contextDir, []string{shouldStayFilename, builder.DefaultDockerfileName, dockerignoreFilename})
}
// TODO: remove after moving to a separate pkg

View File

@ -17,7 +17,6 @@ import (
// be sent over the error channel. If an error is sent all processing will be stopped. It's up
// to the caller to reopen the stream in the event of an error by reinvoking this method.
func (cli *Client) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error) {
messages := make(chan events.Message)
errs := make(chan error, 1)

View File

@ -58,7 +58,6 @@ func TestEventsErrorFromServer(t *testing.T) {
}
func TestEvents(t *testing.T) {
expectedURL := "/events"
filters := filters.NewArgs()

View File

@ -325,7 +325,6 @@ func newRouterOptions(config *config.Config, d *daemon.Daemon) (routerOptions, e
func (cli *DaemonCli) reloadConfig() {
reload := func(c *config.Config) {
// Revalidate and reload the authorization plugins
if err := validateAuthzPlugins(c.AuthorizationPlugins, cli.d.PluginStore); err != nil {
logrus.Fatalf("Error validating authorization plugin: %v", err)

View File

@ -62,5 +62,4 @@ func TestTrap(t *testing.T) {
}
})
}
}

View File

@ -222,7 +222,6 @@ func configReferencesToGRPC(sr []*types.ConfigReference) ([]*swarmapi.ConfigRefe
func configReferencesFromGRPC(sr []*swarmapi.ConfigReference) []*types.ConfigReference {
refs := make([]*types.ConfigReference, 0, len(sr))
for _, s := range sr {
r := &types.ConfigReference{
ConfigID: s.ConfigID,
ConfigName: s.ConfigName,

View File

@ -120,7 +120,6 @@ func endpointFromGRPC(e *swarmapi.Endpoint) types.Endpoint {
NetworkID: v.NetworkID,
Addr: v.Addr})
}
}
return endpoint

View File

@ -96,7 +96,6 @@ func serviceSpecFromGRPC(spec *swarmapi.ServiceSpec) (*types.ServiceSpec, error)
for _, n := range spec.Networks {
netConfig := types.NetworkAttachmentConfig{Target: n.Target, Aliases: n.Aliases, DriverOpts: n.DriverAttachmentOpts}
serviceNetworks = append(serviceNetworks, netConfig)
}
taskTemplate, err := taskSpecFromGRPC(spec.Task)
@ -169,7 +168,6 @@ func ServiceSpecToGRPC(s types.ServiceSpec) (swarmapi.ServiceSpec, error) {
for _, n := range s.TaskTemplate.Networks {
netConfig := &swarmapi.NetworkAttachmentConfig{Target: n.Target, Aliases: n.Aliases, DriverAttachmentOpts: n.DriverOpts}
taskNetworks = append(taskNetworks, netConfig)
}
spec := swarmapi.ServiceSpec{
@ -473,7 +471,6 @@ func resourcesToGRPC(res *types.ResourceRequirements) *swarmapi.ResourceRequirem
MemoryBytes: res.Reservations.MemoryBytes,
Generic: GenericResourcesToGRPC(res.Reservations.GenericResources),
}
}
}
return reqs
@ -536,7 +533,6 @@ func restartPolicyToGRPC(p *types.RestartPolicy) (*swarmapi.RestartPolicy, error
}
if p.MaxAttempts != nil {
rp.MaxAttempts = *p.MaxAttempts
}
}
return rp, nil

View File

@ -460,7 +460,6 @@ func (c *containerAdapter) createVolumes(ctx context.Context) error {
// It returns an error if the driver name is different - that is a valid error
return err
}
}
return nil

View File

@ -16,7 +16,6 @@ import (
)
func TestHealthStates(t *testing.T) {
// set up environment: events, task, container ....
e := events.New()
_, l, _ := e.Subscribe()

View File

@ -248,14 +248,11 @@ func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRe
logrus.Warnf("unable to pin image %s to digest: %s", ctnr.Image, err.Error())
// warning in the client response should be concise
resp.Warnings = append(resp.Warnings, digestWarning(ctnr.Image))
} else if ctnr.Image != digestImage {
logrus.Debugf("pinning image %s by digest: %s", ctnr.Image, digestImage)
ctnr.Image = digestImage
} else {
logrus.Debugf("creating service using supplied digest reference %s", ctnr.Image)
}
// Replace the context with a fresh one.
@ -287,7 +284,6 @@ func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swa
var resp *types.ServiceUpdateResponse
err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
err := c.populateNetworkID(ctx, state.controlClient, &spec)
if err != nil {
return err

View File

@ -562,7 +562,6 @@ func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr er
if err := daemon.connectToNetwork(container, defaultNetName, nConf.EndpointSettings, updateSettings); err != nil {
return err
}
}
// the intermediate map is necessary because "connectToNetwork" modifies "container.NetworkSettings.Networks"
@ -601,7 +600,6 @@ func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr er
}
}()
}
}
if _, err := container.WriteHostConfig(); err != nil {

View File

@ -342,5 +342,4 @@ func TestRootMountCleanup(t *testing.T) {
checkMounted(t, cfg.Root, false)
assert.Assert(t, d.cleanupMounts())
})
}

View File

@ -557,7 +557,6 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn
if len(resources.BlkioDeviceWriteBps) > 0 && !sysInfo.BlkioWriteBpsDevice {
warnings = append(warnings, "Your kernel does not support BPS Block I/O write limit or the cgroup is not mounted. Block I/O BPS write limit discarded.")
resources.BlkioDeviceWriteBps = []*pblkiodev.ThrottleDevice{}
}
if len(resources.BlkioDeviceReadIOps) > 0 && !sysInfo.BlkioReadIOpsDevice {
warnings = append(warnings, "Your kernel does not support IOPS Block read limit or the cgroup is not mounted. Block I/O IOPS read limit discarded.")
@ -1089,7 +1088,6 @@ func setupInitLayer(idMapping idtools.IdentityMapping) func(string) error {
//
// If names are used, they are verified to exist in passwd/group
func parseRemappedRoot(usergrp string) (string, string, error) {
var (
userID, groupID int
username, groupname string

View File

@ -237,7 +237,6 @@ func (a *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts
// Create three folders for each id
// mnt, layers, and diff
func (a *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
if opts != nil && len(opts.StorageOpt) != 0 {
return fmt.Errorf("--storage-opt is not supported for aufs")
}

View File

@ -51,7 +51,6 @@ type btrfsOptions struct {
// Init returns a new BTRFS driver.
// An error is returned if BTRFS is not supported.
func Init(home string, options []string, idMap idtools.IdentityMapping) (graphdriver.Driver, error) {
// Perform feature detection on /var/lib/docker/btrfs if it's an existing directory.
// This covers situations where /var/lib/docker/btrfs is a mount, and on a different
// filesystem than /var/lib/docker.

View File

@ -647,7 +647,6 @@ func (devices *DeviceSet) migrateOldMetaData() error {
if err := os.Rename(devices.oldMetadataFile(), devices.oldMetadataFile()+".migrated"); err != nil {
return err
}
}
return nil
@ -1148,7 +1147,6 @@ func (devices *DeviceSet) setupVerifyBaseImageUUIDFS(baseInfo *devInfo) error {
}
func (devices *DeviceSet) checkGrowBaseDeviceFS(info *devInfo) error {
if !userBaseSize {
return nil
}
@ -1622,7 +1620,6 @@ func (devices *DeviceSet) loadThinPoolLoopBackInfo() error {
devices.dataDevice = dataLoopDevice
devices.dataLoopFile = datafilename
}
}
// metadata device has not been passed in. So there should be a
@ -1643,7 +1640,6 @@ func (devices *DeviceSet) loadThinPoolLoopBackInfo() error {
}
func (devices *DeviceSet) enableDeferredRemovalDeletion() error {
// If user asked for deferred removal then check both libdm library
// and kernel driver support deferred removal otherwise error out.
if enableDeferredRemoval {
@ -1946,7 +1942,6 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string, storageOpt map[string
}
func (devices *DeviceSet) parseStorageOpt(storageOpt map[string]string) (uint64, error) {
// Read size to change the block device size per container.
for key, val := range storageOpt {
key := strings.ToLower(key)

View File

@ -176,10 +176,10 @@ func DriverBenchDiffApplyN(b *testing.B, fileCount int, drivername string, drive
// suppressing "SA9003: empty branch (staticcheck)" instead of commenting-out/removing
// these lines because removing/commenting these lines causes a ripple effect
// of changes, and there's still a to-do below
//nolint:staticcheck
//nolint:staticcheck,revive
if applyDiffSize != diffSize {
// TODO: enforce this
//b.Fatalf("Apply diff size different, got %d, expected %s", applyDiffSize, diffSize)
// b.Fatalf("Apply diff size different, got %d, expected %s", applyDiffSize, diffSize)
}
if err := checkManyFiles(driver, diff, fileCount, 6); err != nil {
b.Fatal(err)
@ -248,7 +248,6 @@ func DriverBenchDeepLayerRead(b *testing.B, layerCount int, drivername string, d
b.ResetTimer()
for i := 0; i < b.N; i++ {
// Read content
c, err := os.ReadFile(filepath.Join(root, "testfile.txt"))
if err != nil {

View File

@ -279,7 +279,6 @@ func addManyLayers(drv graphdriver.Driver, baseLayer string, count int) (string,
}
lastLayer = nextLayer
}
return lastLayer, nil
}

View File

@ -246,7 +246,6 @@ func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts
// Create is used to create the upper, lower, and merge directories required for overlay fs for a given id.
// The parent filesystem is used to configure these directories for the overlay.
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) (retErr error) {
if opts != nil && len(opts.StorageOpt) != 0 {
return fmt.Errorf("--storage-opt is not supported for overlay")
}

View File

@ -378,7 +378,6 @@ func (d *Driver) Get(id, mountLabel string) (_ string, retErr error) {
if rmErr := unix.Rmdir(mountpoint); rmErr != nil && !os.IsNotExist(rmErr) {
logrus.WithField("storage-driver", "zfs").Debugf("Failed to remove %s: %v", id, rmErr)
}
}
}
}()

View File

@ -134,7 +134,6 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
records = append(records, untaggedRecord)
} else {
remainingRefs = append(remainingRefs, repoRef)
}
}
repoRefs = remainingRefs

View File

@ -152,7 +152,6 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
}
if summary.RepoDigests == nil && summary.RepoTags == nil {
if opts.All || len(i.imageStore.Children(id)) == 0 {
if opts.Filters.Contains("dangling") && !danglingOnly {
// dangling=false case, so dangling image is not needed
continue

View File

@ -23,7 +23,6 @@ var acceptedSearchFilterTags = map[string]bool{
func (i *ImageService) SearchRegistryForImages(ctx context.Context, searchFilters filters.Args, term string, limit int,
authConfig *registry.AuthConfig,
headers map[string][]string) (*registry.SearchResults, error) {
if err := searchFilters.Validate(acceptedSearchFilterTags); err != nil {
return nil, err
}

View File

@ -15,7 +15,6 @@ import (
// The existing image(s) is not destroyed.
// If no parent is specified, a new image with the diff of all the specified image's layers merged into a new layer that has no parents.
func (i *ImageService) SquashImage(id, parent string) (string, error) {
var (
img *image.Image
err error

View File

@ -129,7 +129,6 @@ func (c *contentStoreForPull) Writer(ctx context.Context, opts ...content.Writer
if err := o(&cfg); err != nil {
return nil, err
}
}
c.addDigested(cfg.Desc.Digest)
}

View File

@ -47,7 +47,6 @@ func (l *mockLoggingPlugin) StartLogging(file string, info Info) error {
l.c.Broadcast()
return
}
l.c.L.Lock()
@ -55,7 +54,6 @@ func (l *mockLoggingPlugin) StartLogging(file string, info Info) error {
l.c.L.Unlock()
l.c.Broadcast()
}
}()
return nil
}
@ -172,7 +170,6 @@ func TestAdapterReadLogs(t *testing.T) {
assert.Check(t, !ok, "expected message channel to be closed")
case <-time.After(10 * time.Second):
t.Fatal("timeout waiting for message channel to close")
}
lw.ConsumerGone()

View File

@ -661,7 +661,6 @@ func TestCollectBatchTicker(t *testing.T) {
assert.Equal(t, logline+" 3", aws.StringValue(argument.LogEvents[0].Message))
stream.Close()
}
func TestCollectBatchMultilinePattern(t *testing.T) {

View File

@ -65,7 +65,6 @@ func makeTestMessages() []*logger.Message {
{Source: "stderr", Timestamp: time.Now().Add(-1 * 10 * time.Minute), Line: []byte("just one more message")},
{Source: "stdout", Timestamp: time.Now().Add(-1 * 90 * time.Minute), Line: []byte("someone adjusted the clock")},
}
}
func (tr Reader) testTail(t *testing.T, live bool) {

View File

@ -138,7 +138,6 @@ func (c *sharedTempFileConverter) openExisting(st stfcState, id stfID, v sharedT
res := <-wait
return res.fr, res.err
}
func (c *sharedTempFileConverter) convert(f *os.File) (converted *os.File, size int64, err error) {

View File

@ -207,7 +207,6 @@ func TestSharedTempFileConverter(t *testing.T) {
assert.Check(t, src.Close())
assert.NilError(t, os.Remove(name))
checkDirEmpty(t, dir)
})
}

View File

@ -142,7 +142,6 @@ func TestRingDrain(t *testing.T) {
if len(ls) != 0 {
t.Fatalf("expected 0 messages on 2nd drain: %v", ls)
}
}
type nopLogger struct{}

View File

@ -265,5 +265,4 @@ func parseLogFormat(logFormat, proto string) (syslog.Formatter, syslog.Framer, e
default:
return nil, nil, errors.New("Invalid syslog format")
}
}

View File

@ -815,7 +815,6 @@ func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep
return nil, errors.Errorf("Invalid link-local IP address: %s", ipam.LinkLocalIPs)
}
ipList = append(ipList, linkip)
}
if ip = net.ParseIP(ipam.IPv4Address); ip == nil && ipam.IPv4Address != "" {
@ -828,7 +827,6 @@ func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep
createOptions = append(createOptions,
libnetwork.CreateOptionIpam(ip, ip6, ipList, nil))
}
for _, alias := range epConfig.Aliases {
@ -882,7 +880,6 @@ func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep
createOptions = append(createOptions, libnetwork.EndpointOptionGeneric(genericOption))
}
}
// Port-mapping rules belong to the container & applicable only to non-internal networks

View File

@ -173,7 +173,6 @@ func TestFilterNetworks(t *testing.T) {
if testCase.err != "" {
if err == nil {
t.Fatalf("expect error '%s', got no error", testCase.err)
} else if !strings.Contains(err.Error(), testCase.err) {
t.Fatalf("expect error '%s', got '%s'", testCase.err, err)
}

View File

@ -706,7 +706,6 @@ func WithMounts(daemon *Daemon, c *container.Container) coci.SpecOpts {
}
return nil
}
}

View File

@ -404,5 +404,4 @@ func TestDaemonReloadNetworkDiagnosticPort(t *testing.T) {
if !daemon.netController.IsDiagnosticEnabled() {
t.Fatalf("diagnostic should be enable")
}
}

View File

@ -24,7 +24,6 @@ func (daemon *Daemon) ContainerRestart(ctx context.Context, name string, options
return fmt.Errorf("Cannot restart container %s: %v", name, err)
}
return nil
}
// containerRestart attempts to gracefully stop and then start the

View File

@ -15,7 +15,6 @@ import (
)
func TestWithSeccomp(t *testing.T) {
type expected struct {
daemon *Daemon
c *container.Container

View File

@ -171,7 +171,6 @@ func TestManifestStore(t *testing.T) {
err = w.Commit(ctx, desc.Size, desc.Digest, opts...)
assert.NilError(t, err)
}
// All tests should end up with no active ingest
@ -348,7 +347,6 @@ func TestDetectManifestBlobMediaType(t *testing.T) {
assert.Equal(t, mt, tc.expected)
})
}
}
func TestDetectManifestBlobMediaTypeInvalid(t *testing.T) {
@ -418,5 +416,4 @@ func TestDetectManifestBlobMediaTypeInvalid(t *testing.T) {
assert.Equal(t, mt, "")
})
}
}

View File

@ -313,7 +313,6 @@ func (ldm *LayerDownloadManager) makeDownloadFunc(descriptor DownloadDescriptor,
d.err = errors.New("download cancelled during retry delay")
return
}
}
}

View File

@ -78,7 +78,6 @@ func TestFSInvalidRoot(t *testing.T) {
os.RemoveAll(root)
}
}
func TestFSMetadataGetSet(t *testing.T) {

View File

@ -138,7 +138,6 @@ func (l *tarexporter) parseNames(names []string) (desc map[image.ID]*imageDescri
if err := addAssoc(image.IDFromDigest(id), namedRef); err != nil {
return nil, err
}
}
return imgDescr, nil
}

View File

@ -224,7 +224,6 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
// , contenttype, …), if receive a successful "101 Switching Protocols" response return
// a `io.WriteCloser` and `bufio.Reader`
func requestHijack(method, endpoint string, data io.Reader, ct, daemon string, modifiers ...func(*http.Request)) (io.WriteCloser, *bufio.Reader, error) {
hostURL, err := client.ParseHostURL(daemon)
if err != nil {
return nil, nil, errors.Wrap(err, "parse daemon host error")

View File

@ -427,7 +427,6 @@ func (s *DockerAPISuite) TestBuildChownOnCopy(c *testing.T) {
}
func (s *DockerAPISuite) TestBuildCopyCacheOnFileChange(c *testing.T) {
dockerfile := `FROM busybox
COPY file /file`
@ -468,7 +467,6 @@ COPY file /file`
}
func (s *DockerAPISuite) TestBuildAddCacheOnFileChange(c *testing.T) {
dockerfile := `FROM busybox
ADD file /file`

View File

@ -545,7 +545,6 @@ func (s *DockerAPISuite) TestContainerAPICreate(c *testing.T) {
}
func (s *DockerAPISuite) TestContainerAPICreateEmptyConfig(c *testing.T) {
cli, err := client.NewClientWithOpts(client.FromEnv)
assert.NilError(c, err)
defer cli.Close()
@ -1070,7 +1069,6 @@ func (s *DockerAPISuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.
b, err := request.ReadBody(body)
assert.NilError(c, err)
assert.Assert(c, is.Regexp("^Path cannot be empty\n$", string(b)))
}
func (s *DockerAPISuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) {
@ -1092,7 +1090,6 @@ func (s *DockerAPISuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testi
b, err := request.ReadBody(body)
assert.NilError(c, err)
assert.Assert(c, is.Regexp("^Could not find the file /notexist in container "+name+"\n$", string(b)))
}
func (s *DockerAPISuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T) {
@ -1230,7 +1227,6 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
// Regression test for https://github.com/docker/docker/issues/6231
func (s *DockerAPISuite) TestContainerAPIChunkedEncoding(c *testing.T) {
config := map[string]interface{}{
"Image": "busybox",
"Cmd": append([]string{"/bin/sh", "-c"}, sleepCommandForDaemonPlatform()...),
@ -1920,7 +1916,6 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsValidation(c *testing.T) {
msg: "Source must not be specified",
},
}...)
}
apiClient, err := client.NewClientWithOpts(client.FromEnv)
assert.NilError(c, err)
@ -2148,7 +2143,6 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
assert.NilError(c, err)
switch {
// Named volumes still exist after the container is removed
case x.spec.Type == "volume" && len(x.spec.Source) > 0:
_, err := apiclient.VolumeInspect(ctx, mountPoint.Name)

View File

@ -147,7 +147,6 @@ func (s *DockerAPISuite) TestAPIImagesImportBadSrc(c *testing.T) {
assert.Equal(c, res.StatusCode, te.statusExp)
assert.Equal(c, res.Header.Get("Content-Type"), "application/json")
}
}
// #14846

View File

@ -31,7 +31,6 @@ func (s *DockerAPISuite) TestInspectAPIContainerResponse(c *testing.T) {
cases = []acase{
{"v1.25", append(keysBase, "Mounts")},
}
} else {
cases = []acase{
{"v1.20", append(keysBase, "Mounts")},
@ -51,7 +50,7 @@ func (s *DockerAPISuite) TestInspectAPIContainerResponse(c *testing.T) {
assert.Check(c, ok, "%s does not exist in response for version %s", key, cs.version)
}
//Issue #6830: type not properly converted to JSON/back
// Issue #6830: type not properly converted to JSON/back
_, ok := inspectJSON["Path"].(bool)
assert.Assert(c, !ok, "Path of `true` should not be converted to boolean `true` via JSON marshalling")
}

View File

@ -125,5 +125,4 @@ func (s *DockerSwarmSuite) TestAPISwarmNodeDrainPause(c *testing.T) {
d1.UpdateService(c, d1.GetService(c, id), setInstances(instances))
poll.WaitOn(c, pollCheck(c, d1.CheckActiveContainerCount, checker.Equals(instances-d2ContainerCount)), poll.WithTimeout(defaultReconciliationTimeout))
poll.WaitOn(c, pollCheck(c, d2.CheckActiveContainerCount, checker.Equals(d2ContainerCount)), poll.WithTimeout(defaultReconciliationTimeout))
}

View File

@ -120,7 +120,6 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesMultipleAgents(c *testing.T) {
instances = 5
d1.UpdateService(c, d1.GetService(c, id), setInstances(instances))
poll.WaitOn(c, pollCheck(c, reducedCheck(sumAsIntegers, d1.CheckActiveContainerCount, d3.CheckActiveContainerCount), checker.Equals(instances)), poll.WithTimeout(defaultReconciliationTimeout))
}
func (s *DockerSwarmSuite) TestAPISwarmServicesCreateGlobal(c *testing.T) {
@ -193,7 +192,6 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *testing.T) {
// 2nd batch
poll.WaitOn(c, pollCheck(c, daemons[0].CheckRunningTaskImages, checker.DeepEquals(map[string]int{image1: instances})), poll.WithTimeout(defaultReconciliationTimeout))
}
func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) {
@ -294,7 +292,6 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) {
// 2nd batch
poll.WaitOn(c, pollCheck(c, d.CheckRunningTaskImages, checker.DeepEquals(map[string]int{image1: instances})), poll.WithTimeout(defaultReconciliationTimeout))
}
func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *testing.T) {
@ -333,7 +330,6 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *testing.T) {
assert.NilError(c, err, out)
poll.WaitOn(c, pollCheck(c, daemons[0].CheckRunningTaskImages, checker.DeepEquals(map[string]int{image1: instances})), poll.WithTimeout(defaultReconciliationTimeout))
}
func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *testing.T) {

View File

@ -56,7 +56,6 @@ func (s *DockerCLIAttachSuite) TestAttachClosedOnContainerStop(c *testing.T) {
case <-time.After(attachWait):
c.Fatal("timed out without attach returning")
}
}
func (s *DockerCLIAttachSuite) TestAttachAfterDetach(c *testing.T) {

View File

@ -108,7 +108,6 @@ func (s *DockerCLIBuildSuite) TestBuildEnvironmentReplacementVolume(c *testing.T
if _, ok := volumes[volumePath]; !ok {
c.Fatal("Volume " + volumePath + " from environment not in Config.Volumes on image")
}
}
func (s *DockerCLIBuildSuite) TestBuildEnvironmentReplacementExpose(c *testing.T) {
@ -133,7 +132,6 @@ func (s *DockerCLIBuildSuite) TestBuildEnvironmentReplacementExpose(c *testing.T
c.Fatalf("Exposed port %d from environment not in Config.ExposedPorts on image", p)
}
}
}
func (s *DockerCLIBuildSuite) TestBuildEnvironmentReplacementWorkdir(c *testing.T) {
@ -240,7 +238,6 @@ func (s *DockerCLIBuildSuite) TestBuildEnvironmentReplacementEnv(c *testing.T) {
if envCount != 4 {
c.Fatalf("Didn't find all env vars - only saw %d\n%s", envCount, envResult)
}
}
func (s *DockerCLIBuildSuite) TestBuildHandleEscapesInVolume(c *testing.T) {
@ -308,7 +305,6 @@ func (s *DockerCLIBuildSuite) TestBuildOnBuildLowercase(c *testing.T) {
if strings.Contains(result.Combined(), "ONBUILD ONBUILD") {
c.Fatalf("Got an ONBUILD ONBUILD error with no error: got %s", result.Combined())
}
}
func (s *DockerCLIBuildSuite) TestBuildEnvEscapes(c *testing.T) {
@ -325,7 +321,6 @@ func (s *DockerCLIBuildSuite) TestBuildEnvEscapes(c *testing.T) {
if strings.TrimSpace(out) != "$" {
c.Fatalf("Env TEST was not overwritten with bar when foo was supplied to dockerfile: was %q", strings.TrimSpace(out))
}
}
func (s *DockerCLIBuildSuite) TestBuildEnvOverwrite(c *testing.T) {
@ -342,7 +337,6 @@ func (s *DockerCLIBuildSuite) TestBuildEnvOverwrite(c *testing.T) {
if strings.TrimSpace(out) != "bar" {
c.Fatalf("Env TEST was not overwritten with bar when foo was supplied to dockerfile: was %q", strings.TrimSpace(out))
}
}
// FIXME(vdemeester) why we disabled cache here ?
@ -377,7 +371,6 @@ ONBUILD ENTRYPOINT ["echo"]`))
if !regexp.MustCompile(`(?m)^hello world`).MatchString(out) {
c.Fatal("got malformed output from onbuild", out)
}
}
func (s *DockerCLIBuildSuite) TestBuildCacheAdd(c *testing.T) {
@ -447,7 +440,6 @@ ADD %s/file /`
if out == out2 {
c.Fatalf("MTime didn't change:\nOrigin:%s\nNew:%s", out, out2)
}
}
// Regression for https://github.com/docker/docker/pull/27805
@ -682,7 +674,6 @@ func (s *DockerCLIBuildSuite) TestBuildCopyWildcard(c *testing.T) {
if id1 != id2 {
c.Fatal("didn't use the cache")
}
}
func (s *DockerCLIBuildSuite) TestBuildCopyWildcardInName(c *testing.T) {
@ -728,7 +719,6 @@ func (s *DockerCLIBuildSuite) TestBuildCopyWildcardCache(c *testing.T) {
if id1 != id2 {
c.Fatal("didn't use the cache")
}
}
func (s *DockerCLIBuildSuite) TestBuildAddSingleFileToNonExistingDir(c *testing.T) {
@ -1012,7 +1002,6 @@ func (s *DockerCLIBuildSuite) TestBuildAddBadLinks(c *testing.T) {
if _, err := os.Stat(nonExistingFile); err == nil || !os.IsNotExist(err) {
c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
}
}
func (s *DockerCLIBuildSuite) TestBuildAddBadLinksVolume(c *testing.T) {
@ -1053,7 +1042,6 @@ func (s *DockerCLIBuildSuite) TestBuildAddBadLinksVolume(c *testing.T) {
if _, err := os.Stat(nonExistingFile); err == nil || !os.IsNotExist(err) {
c.Fatalf("%s shouldn't have been written and it shouldn't exist", nonExistingFile)
}
}
// Issue #5270 - ensure we throw a better error than "unexpected EOF"
@ -1131,7 +1119,6 @@ func (s *DockerCLIBuildSuite) TestBuildWithInaccessibleFilesInContext(c *testing
if !strings.Contains(result.Combined(), "error checking context") {
c.Fatalf("output should've contained the string: error checking context\ngot:%s", result.Combined())
}
}
{
name := "testlinksok"
@ -1195,7 +1182,6 @@ func (s *DockerCLIBuildSuite) TestBuildForceRm(c *testing.T) {
if containerCountBefore != containerCountAfter {
c.Fatalf("--force-rm shouldn't have left containers behind")
}
}
func (s *DockerCLIBuildSuite) TestBuildRm(c *testing.T) {
@ -1273,7 +1259,6 @@ func (s *DockerCLIBuildSuite) TestBuildWithVolumes(c *testing.T) {
if !equal {
c.Fatalf("Volumes %s, expected %s", result, expected)
}
}
func (s *DockerCLIBuildSuite) TestBuildMaintainer(c *testing.T) {
@ -1540,7 +1525,6 @@ func (s *DockerCLIBuildSuite) TestBuildContextCleanup(c *testing.T) {
if err = compareDirectoryEntries(entries, entriesFinal); err != nil {
c.Fatalf("context should have been deleted, but wasn't")
}
}
func (s *DockerCLIBuildSuite) TestBuildContextCleanupFailedBuild(c *testing.T) {
@ -1564,7 +1548,6 @@ func (s *DockerCLIBuildSuite) TestBuildContextCleanupFailedBuild(c *testing.T) {
if err = compareDirectoryEntries(entries, entriesFinal); err != nil {
c.Fatalf("context should have been deleted, but wasn't")
}
}
// compareDirectoryEntries compares two sets of DirEntry (usually taken from a directory)
@ -1724,7 +1707,6 @@ func (s *DockerCLIBuildSuite) TestBuildEmptyEntrypoint(c *testing.T) {
if res != expected {
c.Fatalf("Entrypoint %s, expected %s", res, expected)
}
}
func (s *DockerCLIBuildSuite) TestBuildEntrypoint(c *testing.T) {
@ -1738,7 +1720,6 @@ func (s *DockerCLIBuildSuite) TestBuildEntrypoint(c *testing.T) {
if res != expected {
c.Fatalf("Entrypoint %s, expected %s", res, expected)
}
}
// #6445 ensure ONBUILD triggers aren't committed to grandchildren
@ -2174,7 +2155,6 @@ func (s *DockerCLIBuildSuite) TestBuildWithVolumeOwnership(c *testing.T) {
if expected := "daemon daemon"; !strings.Contains(out, expected) {
c.Fatalf("expected %s received %s", expected, out)
}
}
// testing #1405 - config.Cmd does not get cleaned up if
@ -2282,7 +2262,6 @@ docker.com>"
if res != "\"Docker IO <io@docker.com>\"" {
c.Fatalf("Parsed string did not match the escaped string. Got: %q", res)
}
}
func (s *DockerCLIBuildSuite) TestBuildVerifyIntString(c *testing.T) {
@ -2297,7 +2276,6 @@ func (s *DockerCLIBuildSuite) TestBuildVerifyIntString(c *testing.T) {
if !strings.Contains(out, "\"123\"") {
c.Fatalf("Output does not contain the int as a string:\n%s", out)
}
}
func (s *DockerCLIBuildSuite) TestBuildDockerignore(c *testing.T) {
@ -3215,7 +3193,6 @@ func (s *DockerCLIBuildSuite) TestBuildCmdShDashC(c *testing.T) {
if res != expected {
c.Fatalf("Expected value %s not in Config.Cmd: %s", expected, res)
}
}
func (s *DockerCLIBuildSuite) TestBuildCmdSpaces(c *testing.T) {
@ -3426,7 +3403,6 @@ func (s *DockerCLIBuildSuite) TestBuildLabelsCache(c *testing.T) {
if id1 == id2 {
c.Fatalf("Build 6 should have worked & NOT used the cache(%s,%s)", id1, id2)
}
}
// FIXME(vdemeester) port to docker/cli e2e tests (api tests should test suppressOutput option though)
@ -3477,7 +3453,6 @@ func (s *DockerCLIBuildSuite) TestBuildNotVerboseSuccess(c *testing.T) {
c.Fatalf("Test %s expected stderr to be empty, but it is [%#v]", te.Name, result.Stderr())
}
}
}
// FIXME(vdemeester) migrate to docker/cli tests
@ -3702,7 +3677,6 @@ CMD cat /foo/file`),
if out != expected {
c.Fatalf("expected file contents for /foo/file to be %q but received %q", expected, out)
}
}
func (s *DockerCLIBuildSuite) TestBuildFromMixedcaseDockerfile(c *testing.T) {
@ -3752,7 +3726,6 @@ RUN find /tmp/`}))
!strings.Contains(result.Combined(), "/tmp/Dockerfile") {
c.Fatalf("Missing proper output: %s", result.Combined())
}
}
// FIXME(vdemeester) should migrate to docker/cli tests
@ -3778,7 +3751,6 @@ RUN sh -c "find /tmp/" # sh -c is needed on Windows to use the correct find`)
!strings.Contains(result.Combined(), "/tmp/Dockerfile") {
c.Fatalf("Missing proper output: %s", result.Combined())
}
}
func (s *DockerCLIBuildSuite) TestBuildFromOfficialNames(c *testing.T) {
@ -3859,7 +3831,6 @@ func (s *DockerCLIBuildSuite) TestBuildSpaces(c *testing.T) {
if strings.ReplaceAll(e1, " ", "") != strings.ReplaceAll(e2, " ", "") {
c.Fatalf("Build 4's error wasn't the same as build 1's\n1:%s\n4:%s", result1.Error, result2.Error)
}
}
func (s *DockerCLIBuildSuite) TestBuildSpacesWithQuotes(c *testing.T) {
@ -3937,7 +3908,6 @@ func (s *DockerCLIBuildSuite) TestBuildMissingArgs(c *testing.T) {
Err: cmd + " requires",
})
}
}
func (s *DockerCLIBuildSuite) TestBuildEmptyScratch(c *testing.T) {
@ -4109,7 +4079,6 @@ func (s *DockerCLIBuildSuite) TestBuildBuildTimeArg(c *testing.T) {
ARG %s
RUN echo $%s
CMD echo $%s`, envKey, envKey, envKey)
}
buildImage(imgName,
cli.WithFlags("--build-arg", fmt.Sprintf("%s=%s", envKey, envVal)),
@ -4846,7 +4815,6 @@ func (s *DockerCLIBuildSuite) TestBuildFollowSymlinkToDir(c *testing.T) {
assert.Assert(c, !strings.Contains(result.Combined(), "Using cache"))
out = cli.DockerCmd(c, "run", "--rm", name, "cat", "abc", "def").Combined()
assert.Assert(c, cmp.Regexp("^barbax$", out))
}
// TestBuildSymlinkBasename tests that target file gets basename from symlink,
@ -4869,7 +4837,6 @@ func (s *DockerCLIBuildSuite) TestBuildSymlinkBasename(c *testing.T) {
out := cli.DockerCmd(c, "run", "--rm", name, "cat", "asymlink").Combined()
assert.Assert(c, cmp.Regexp("^bar$", out))
}
// #17827
@ -5374,7 +5341,6 @@ func (s *DockerCLIBuildSuite) TestBuildCmdShellArgsEscaped(c *testing.T) {
if res != `["ipconfig"]` {
c.Fatalf("CMD incorrect in Config.Cmd: got %v", res)
}
}
// Test case for #24912.
@ -5614,7 +5580,6 @@ func (s *DockerCLIBuildSuite) TestBuildWithExtraHostInvalidFormat(c *testing.T)
ExitCode: 125,
})
}
}
func (s *DockerCLIBuildSuite) TestBuildMultiStageCopyFromSyntax(c *testing.T) {

View File

@ -237,7 +237,6 @@ func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *testing.T) {
}
func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
// setup image1
digest1, err := setupImageWithTag(c, "tag1")
assert.NilError(c, err, "error setting up image")
@ -330,7 +329,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out)
// setup image2
digest2, err := setupImageWithTag(c, "dangle2")
//error setting up image
// error setting up image
assert.NilError(c, err)
imageReference2 := fmt.Sprintf("%s@%s", repoName, digest2)
c.Logf("imageReference2 = %s", imageReference2)

View File

@ -61,7 +61,6 @@ func (s *DockerCLICreateSuite) TestCreateArgs(c *testing.T) {
if len(cont.Args) != len(expected) || b {
c.Fatalf("Unexpected args. Expected %v, received: %v", expected, cont.Args)
}
}
// Make sure we can grow the container's rootfs at creation time.
@ -135,9 +134,7 @@ func (s *DockerCLICreateSuite) TestCreateWithPortRange(c *testing.T) {
for k, v := range cont.HostConfig.PortBindings {
assert.Equal(c, len(v), 1, fmt.Sprintf("Expected 1 ports binding, for the port %s but found %s", k, v))
assert.Equal(c, k.Port(), v[0].HostPort, fmt.Sprintf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
}
}
func (s *DockerCLICreateSuite) TestCreateWithLargePortRange(c *testing.T) {
@ -165,7 +162,6 @@ func (s *DockerCLICreateSuite) TestCreateWithLargePortRange(c *testing.T) {
assert.Equal(c, len(v), 1)
assert.Equal(c, k.Port(), v[0].HostPort, fmt.Sprintf("Expected host port %s to match published port %s", k.Port(), v[0].HostPort))
}
}
// "test123" should be printed by docker create + start
@ -194,7 +190,6 @@ func (s *DockerCLICreateSuite) TestCreateVolumesCreated(c *testing.T) {
if err != nil {
c.Fatalf("Error statting volume host path: %q", err)
}
}
func (s *DockerCLICreateSuite) TestCreateLabels(c *testing.T) {

View File

@ -172,7 +172,6 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *testing.T) {
// both running
testRun(map[string]bool{"top1": true, "top2": true, "exit": true}, "After second daemon restart: ")
}
func (s *DockerDaemonSuite) TestDaemonRestartOnFailure(c *testing.T) {
@ -979,7 +978,6 @@ func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *tes
}
func (s *DockerDaemonSuite) TestDaemonUlimitDefaults(c *testing.T) {
s.d.StartWithBusybox(c, "--default-ulimit", "nofile=42:42", "--default-ulimit", "nproc=1024:1024")
out, err := s.d.Cmd("run", "--ulimit", "nproc=2048", "--name=test", "busybox", "/bin/sh", "-c", "echo $(ulimit -n); echo $(ulimit -u)")
@ -1992,7 +1990,6 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithKilledRunningContainer(t *testi
if out != "143" {
t.Fatalf("Expected exit code '%s' got '%s' for container '%s'\n", "143", out, cid)
}
}
// os.Kill should kill daemon ungracefully, leaving behind live containers.

View File

@ -117,7 +117,6 @@ func (s *DockerCLIEventSuite) TestEventsContainerEventsAttrSort(c *testing.T) {
if matches["eventType"] == "container" && matches["action"] == "create" {
matchedEvents++
assert.Check(c, strings.Contains(out, "(image=busybox, name=container-events-test)"), "Event attributes not sorted")
} else if matches["eventType"] == "container" && matches["action"] == "start" {
matchedEvents++
assert.Check(c, strings.Contains(out, "(image=busybox, name=container-events-test)"), "Event attributes not sorted")

View File

@ -391,7 +391,6 @@ func (s *DockerCLIEventSuite) TestEventsFilterNetworkID(c *testing.T) {
}
func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
// daemon config file
configFilePath := "test.json"
defer os.Remove(configFilePath)
@ -439,7 +438,6 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *testing.T) {
}
func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *testing.T) {
// daemon config file
configFilePath := "test.json"
defer os.Remove(configFilePath)

View File

@ -76,7 +76,6 @@ func (s *DockerCLIExecSuite) TestExecInteractive(c *testing.T) {
case <-time.After(1 * time.Second):
c.Fatal("docker exec failed to exit on stdin close")
}
}
func (s *DockerCLIExecSuite) TestExecAfterContainerRestart(c *testing.T) {

View File

@ -152,7 +152,6 @@ func (s *DockerCLIHealthSuite) TestHealth(c *testing.T) {
out, _ = dockerCmd(c, "inspect",
"--format={{.Config.Healthcheck.Test}}", imageName)
assert.Equal(c, out, "[CMD cat /my status]\n")
}
// GitHub #33021
@ -175,5 +174,4 @@ ENTRYPOINT /bin/sh -c "sleep 600"`))
// Start
dockerCmd(c, "start", name)
waitForHealthStatus(c, name, "starting", "healthy")
}

View File

@ -65,7 +65,6 @@ LABEL label.Z="Z"`))
actualValue := actualValues[i]
assert.Assert(c, strings.Contains(actualValue, echoValue))
}
}
func (s *DockerCLIHistorySuite) TestHistoryExistentImage(c *testing.T) {

View File

@ -91,7 +91,6 @@ func (s *DockerCLIInspectSuite) TestInspectStatus(c *testing.T) {
dockerCmd(c, "stop", out)
inspectOut = inspectField(c, out, "State.Status")
assert.Equal(c, inspectOut, "exited")
}
func (s *DockerCLIInspectSuite) TestInspectTypeFlagContainer(c *testing.T) {
@ -148,7 +147,7 @@ func (s *DockerCLIInspectSuite) TestInspectImageFilterInt(c *testing.T) {
size, err := strconv.Atoi(out)
assert.Assert(c, err == nil, "failed to inspect size of the image: %s, %v", out, err)
//now see if the size turns out to be the same
// now see if the size turns out to be the same
formatStr := fmt.Sprintf("--format={{eq .Size %d}}", size)
out, _ = dockerCmd(c, "inspect", formatStr, imageTest)
result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n"))
@ -170,7 +169,7 @@ func (s *DockerCLIInspectSuite) TestInspectContainerFilterInt(c *testing.T) {
exitCode, err := strconv.Atoi(out)
assert.Assert(c, err == nil, "failed to inspect exitcode of the container: %s, %v", out, err)
//now get the exit code to verify
// now get the exit code to verify
formatStr := fmt.Sprintf("--format={{eq .State.ExitCode %d}}", exitCode)
out, _ = dockerCmd(c, "inspect", formatStr, id)
inspectResult, err := strconv.ParseBool(strings.TrimSuffix(out, "\n"))

View File

@ -100,7 +100,6 @@ func (s *DockerCLILinksSuite) TestLinksPingLinkedContainersAfterRename(c *testin
dockerCmd(c, "run", "--rm", "--link", "container_new:alias1", "--link", "container2:alias2", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
dockerCmd(c, "kill", idA)
dockerCmd(c, "kill", idB)
}
func (s *DockerCLILinksSuite) TestLinksInspectLinksStarted(c *testing.T) {
@ -147,7 +146,6 @@ func (s *DockerCLILinksSuite) TestLinksNotStartedParentNotFail(c *testing.T) {
dockerCmd(c, "create", "--name=first", "busybox", "top")
dockerCmd(c, "create", "--name=second", "--link=first:first", "busybox", "top")
dockerCmd(c, "start", "first")
}
func (s *DockerCLILinksSuite) TestLinksHostsFilesInject(c *testing.T) {

View File

@ -56,7 +56,6 @@ func (s *DockerNetworkSuite) SetUpSuite(c *testing.T) {
}
func setupRemoteNetworkDrivers(c *testing.T, mux *http.ServeMux, url, netDrv, ipamDrv string) {
mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
fmt.Fprintf(w, `{"Implements": ["%s", "%s"]}`, driverapi.NetworkPluginEndpointType, ipamapi.PluginEndpointType)
@ -759,7 +758,6 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *testing.T) {
assert.Equal(c, opts["opt2"], "drv2")
dockerCmd(c, "network", "rm", "testopt")
assertNwNotAvailable(c, "testopt")
}
func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *testing.T) {
@ -782,7 +780,6 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *testing.T) {
assertNwIsAvailable(c, "v2net")
dockerCmd(c, "network", "rm", "v2net")
assertNwNotAvailable(c, "v2net")
}
func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *testing.T) {

View File

@ -38,7 +38,6 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string
assert.NilError(c, err)
return out, ""
}, checker.Contains(s)), poll.WithTimeout(defaultReconciliationTimeout))
}
for _, s := range pruned {

View File

@ -130,7 +130,6 @@ func (s *DockerCLIPsSuite) TestPsListContainersBase(c *testing.T) {
out, _ = dockerCmd(c, "ps", "-f", "since="+firstID, "-f", "before="+fourthID, "-n=1")
assert.Equal(c, assertContainerList(RemoveOutputForExistingElements(out, existingContainers), expected), true, fmt.Sprintf("SINCE filter, BEFORE filter, LIMIT: Container list is not in the correct order: \n%s", out))
}
func assertContainerList(out string, expected []string) bool {
@ -602,7 +601,6 @@ func (s *DockerCLIPsSuite) TestPsImageIDAfterUpdate(c *testing.T) {
f := strings.Fields(line)
assert.Equal(c, f[1], originalImageID)
}
}
func (s *DockerCLIPsSuite) TestPsNotShowPortsOfStoppedContainer(c *testing.T) {

View File

@ -120,7 +120,6 @@ func (s *DockerHubPullSuite) TestPullNonExistingImage(c *testing.T) {
assert.Assert(c, !strings.Contains(record.out, "unauthorized"), `message should not contain "unauthorized"`)
}
}
}
// TestPullFromCentralRegistryImplicitRefParts pulls an image from the central registry and verifies

View File

@ -63,13 +63,11 @@ func (s *DockerCLIRmiSuite) TestRmiTag(c *testing.T) {
{
imagesAfter, _ := dockerCmd(c, "images", "-a")
assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n")+1, fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
}
dockerCmd(c, "rmi", "utest:tag1")
{
imagesAfter, _ := dockerCmd(c, "images", "-a")
assert.Equal(c, strings.Count(imagesAfter, "\n"), strings.Count(imagesBefore, "\n"), fmt.Sprintf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter))
}
}

View File

@ -89,7 +89,6 @@ func (s *DockerCLIRunSuite) TestRunLookupGoogleDNS(c *testing.T) {
} else {
dockerCmd(c, "run", "busybox", "nslookup", "google.com")
}
}
// the exit code should be 0
@ -355,7 +354,6 @@ func (s *DockerCLIRunSuite) TestRunWithDaemonFlags(c *testing.T) {
// Regression test for #4979
func (s *DockerCLIRunSuite) TestRunWithVolumesFromExited(c *testing.T) {
var (
out string
exitCode int

View File

@ -137,5 +137,4 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
task = d.GetTask(c, task.ID)
return task.Status.State, ""
}, checker.Equals(swarm.TaskStateRunning)), poll.WithTimeout(defaultReconciliationTimeout))
}

View File

@ -615,7 +615,6 @@ const globalNetworkPlugin = "global-network-plugin"
const globalIPAMPlugin = "global-ipam-plugin"
func setupRemoteGlobalNetworkPlugin(c *testing.T, mux *http.ServeMux, url, netDrv, ipamDrv string) {
mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
fmt.Fprintf(w, `{"Implements": ["%s", "%s"]}`, driverapi.NetworkPluginEndpointType, ipamapi.PluginEndpointType)
@ -923,7 +922,6 @@ func (s *DockerSwarmSuite) TestSwarmServiceNetworkUpdate(c *testing.T) {
result.Assert(c, icmd.Success)
poll.WaitOn(c, pollCheck(c, d.CheckRunningTaskNetworks, checker.DeepEquals(map[string]int{barNetwork: 1, bazNetwork: 1})), poll.WithTimeout(defaultReconciliationTimeout))
}
func (s *DockerSwarmSuite) TestDNSConfig(c *testing.T) {

View File

@ -104,5 +104,4 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *testing.T) {
assert.NilError(c, err)
poll.WaitOn(c, pollCheck(c, d1.CheckRunningTaskImages, checker.DeepEquals(map[string]int{image: 1})), poll.WithTimeout(defaultReconciliationTimeout))
}

View File

@ -109,7 +109,6 @@ func TestConfigList(t *testing.T) {
})
assert.NilError(t, err)
assert.Check(t, is.DeepEqual(configNamesFromList(entries), tc.expected))
}
}

View File

@ -169,7 +169,6 @@ func TestDaemonHostGatewayIP(t *testing.T) {
assert.Check(t, is.Contains(res.Stdout(), "6.7.8.9"))
c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
d.Stop(t)
}
// TestRestartDaemonWithRestartingContainer simulates a case where a container is in "restarting" state when

View File

@ -170,7 +170,6 @@ func testLogs(t *testing.T, logDriver string) {
}
return
}
}
assert.DeepEqual(t, stdoutStr, tC.expectedOut)

View File

@ -122,7 +122,6 @@ func TestDaemonRestartKillContainers(t *testing.T) {
break
}
time.Sleep(2 * time.Second)
}
assert.Equal(t, expected, running, "got unexpected running state, expected %v, got: %v", expected, running)
@ -209,5 +208,4 @@ func TestContainerWithAutoRemoveCanBeRestarted(t *testing.T) {
poll.WaitOn(t, testContainer.IsRemoved(ctx, cli, cID))
})
}
}

View File

@ -241,5 +241,4 @@ func TestWaitRestartedContainer(t *testing.T) {
}
})
}
}

View File

@ -37,5 +37,4 @@ func Overlay2Supported(kernelVersion string) bool {
}
requiredV := kernel.VersionInfo{Kernel: 4}
return kernel.CompareKernelVersion(*daemonV, requiredV) > -1
}

View File

@ -96,7 +96,6 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
assert.NilError(t, err)
assert.Equal(t, out.IPAM.Config[0].Subnet, "175.33.1.0/24")
delInterface(t, defaultNetworkBridge)
}
func TestDaemonRestartWithExistingNetwork(t *testing.T) {
@ -454,5 +453,4 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
assert.NilError(t, err)
err = d.SwarmLeave(t, true)
assert.NilError(t, err)
}

View File

@ -88,5 +88,4 @@ func TestReadPluginNoRead(t *testing.T) {
assert.Assert(t, strings.TrimSpace(buf.String()) == "hello world", buf.Bytes())
})
}
}

View File

@ -109,7 +109,6 @@ func TestSecretList(t *testing.T) {
})
assert.NilError(t, err)
assert.Check(t, is.DeepEqual(secretNamesFromList(entries), tc.expected))
}
}

View File

@ -398,7 +398,6 @@ func TestCreateServiceSysctls(t *testing.T) {
// net.ipv4.ip_nonlocal_bind is, we can verify that setting the sysctl
// options works
for _, expected := range []string{"0", "1"} {
// store the map we're going to be using everywhere.
expectedSysctls := map[string]string{"net.ipv4.ip_nonlocal_bind": expected}

View File

@ -104,5 +104,4 @@ func TestServiceListWithStatuses(t *testing.T) {
assert.Check(t, is.Equal(service.ServiceStatus.DesiredTasks, replicas))
assert.Check(t, is.Equal(service.ServiceStatus.RunningTasks, replicas))
}
}

View File

@ -71,7 +71,6 @@ func TestEventsExecDie(t *testing.T) {
case <-time.After(time.Second * 3):
t.Fatal("timeout hit")
}
}
// Test case for #18888: Events messages have been switched from generic

View File

@ -63,5 +63,4 @@ func TestLayerSize(t *testing.T) {
if expected := len(content1) + len(content2); int(layer2Size) != expected {
t.Fatalf("Unexpected size %d, expected %d", layer2Size, expected)
}
}

View File

@ -55,10 +55,8 @@ func DevicesFromPath(pathOnHost, pathInContainer, cgroupPermissions string) (dev
// if the device is not a device node
// try to see if it's a directory holding many devices
if err == devices.ErrNotADevice {
// check if it is a directory
if src, e := os.Stat(resolvedPathOnHost); e == nil && src.IsDir() {
// mount the internal devices recursively
// TODO check if additional errors should be handled or logged
_ = filepath.Walk(resolvedPathOnHost, func(dpath string, f os.FileInfo, _ error) error {

View File

@ -16,5 +16,4 @@ func TestAddressPoolOpt(t *testing.T) {
if err := poolopt.Set(invalidAddresspoolString); err == nil {
t.Fatal(err)
}
}

View File

@ -29,7 +29,6 @@ func TestValidateIPAddress(t *testing.T) {
if ret, err := ValidateIPAddress(`random invalid string`); err == nil || ret != "" {
t.Fatalf("ValidateIPAddress(`random invalid string`) got %s %s", ret, err)
}
}
func TestMapOpts(t *testing.T) {
@ -89,7 +88,6 @@ func TestListOptsWithoutValidator(t *testing.T) {
if len(mapListOpts) != 1 {
t.Errorf("Expected [map[bar:{}]], got [%v]", mapListOpts)
}
}
func TestListOptsWithValidator(t *testing.T) {
@ -264,7 +262,6 @@ func TestValidateLabel(t *testing.T) {
assert.Check(t, is.Equal(result, testCase.expectedResult))
}
})
}
}

View File

@ -385,7 +385,6 @@ func ReplaceFileTarWrapper(inputTarStream io.ReadCloser, mods map[string]TarModi
}
pipeWriter.Close()
}()
return pipeReader
}
@ -772,7 +771,6 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
}
return err
}
}
if len(errors) > 0 {

View File

@ -61,7 +61,6 @@ func checkOpaqueness(t *testing.T, path string, opaque string) {
if string(xattrOpaque) != opaque {
t.Fatalf("Unexpected opaque value: %q, expected %q", string(xattrOpaque), opaque)
}
}
func checkOverlayWhiteout(t *testing.T, path string) {

Some files were not shown because too many files have changed in this diff Show More