mirror of
https://github.com/moby/moby.git
synced 2025-08-08 13:22:22 +03:00
Optimize some wrong usage and spelling
Signed-off-by: wgliang <liangcszzu@163.com>
This commit is contained in:
@@ -181,7 +181,7 @@ type ImageBuildOptions struct {
|
|||||||
SessionID string
|
SessionID string
|
||||||
|
|
||||||
// TODO @jhowardmsft LCOW Support: This will require extending to include
|
// TODO @jhowardmsft LCOW Support: This will require extending to include
|
||||||
// `Platform string`, but is ommited for now as it's hard-coded temporarily
|
// `Platform string`, but is omitted for now as it's hard-coded temporarily
|
||||||
// to avoid API changes.
|
// to avoid API changes.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -168,7 +168,7 @@ func (daemon *Daemon) containerAttach(c *container.Container, cfg *stream.Attach
|
|||||||
// Wait for the container to stop before returning.
|
// Wait for the container to stop before returning.
|
||||||
waitChan := c.Wait(context.Background(), container.WaitConditionNotRunning)
|
waitChan := c.Wait(context.Background(), container.WaitConditionNotRunning)
|
||||||
defer func() {
|
defer func() {
|
||||||
_ = <-waitChan // Ignore returned exit code.
|
<-waitChan // Ignore returned exit code.
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -860,7 +860,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
|||||||
|
|
||||||
// Wait without timeout for the container to exit.
|
// Wait without timeout for the container to exit.
|
||||||
// Ignore the result.
|
// Ignore the result.
|
||||||
_ = <-c.Wait(context.Background(), container.WaitConditionNotRunning)
|
<-c.Wait(context.Background(), container.WaitConditionNotRunning)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ func checkFile(drv graphdriver.Driver, layer, filename string, content []byte) e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.Compare(fileContent, content) != 0 {
|
if !bytes.Equal(fileContent, content) {
|
||||||
return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content)
|
return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ func checkManyFiles(drv graphdriver.Driver, layer string, count int, seed int64)
|
|||||||
|
|
||||||
content := randomContent(64, seed+int64(i+j))
|
content := randomContent(64, seed+int64(i+j))
|
||||||
|
|
||||||
if bytes.Compare(fileContent, content) != 0 {
|
if !bytes.Equal(fileContent, content) {
|
||||||
return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content)
|
return fmt.Errorf("mismatched file content %v, expecting %v", fileContent, content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ func checkManyLayers(drv graphdriver.Driver, layer string, count int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.Compare(layerIDBytes, []byte(layer)) != 0 {
|
if !bytes.Equal(layerIDBytes, []byte(layer)) {
|
||||||
return fmt.Errorf("mismatched file content %v, expecting %v", layerIDBytes, []byte(layer))
|
return fmt.Errorf("mismatched file content %v, expecting %v", layerIDBytes, []byte(layer))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ func checkManyLayers(drv graphdriver.Driver, layer string, count int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if bytes.Compare(thisLayerIDBytes, layerIDBytes) != 0 {
|
if !bytes.Equal(thisLayerIDBytes, layerIDBytes) {
|
||||||
return fmt.Errorf("mismatched file content %v, expecting %v", thisLayerIDBytes, layerIDBytes)
|
return fmt.Errorf("mismatched file content %v, expecting %v", thisLayerIDBytes, layerIDBytes)
|
||||||
}
|
}
|
||||||
layerIDBytes, err = ioutil.ReadFile(path.Join(layerDir, "parent-id"))
|
layerIDBytes, err = ioutil.ReadFile(path.Join(layerDir, "parent-id"))
|
||||||
|
@@ -23,33 +23,33 @@
|
|||||||
//
|
//
|
||||||
// * lcow.sandboxsize - Specifies a custom sandbox size in GB for starting a container
|
// * lcow.sandboxsize - Specifies a custom sandbox size in GB for starting a container
|
||||||
// -- Possible values: >= default sandbox size (opengcs defined, currently 20)
|
// -- Possible values: >= default sandbox size (opengcs defined, currently 20)
|
||||||
// -- Default if ommitted: 20
|
// -- Default if omitted: 20
|
||||||
//
|
//
|
||||||
// The following options are read by opengcs:
|
// The following options are read by opengcs:
|
||||||
//
|
//
|
||||||
// * lcow.kirdpath - Specifies a custom path to a kernel/initrd pair
|
// * lcow.kirdpath - Specifies a custom path to a kernel/initrd pair
|
||||||
// -- Possible values: Any local path that is not a mapped drive
|
// -- Possible values: Any local path that is not a mapped drive
|
||||||
// -- Default if ommitted: %ProgramFiles%\Linux Containers
|
// -- Default if omitted: %ProgramFiles%\Linux Containers
|
||||||
//
|
//
|
||||||
// * lcow.kernel - Specifies a custom kernel file located in the `lcow.kirdpath` path
|
// * lcow.kernel - Specifies a custom kernel file located in the `lcow.kirdpath` path
|
||||||
// -- Possible values: Any valid filename
|
// -- Possible values: Any valid filename
|
||||||
// -- Default if ommitted: bootx64.efi
|
// -- Default if omitted: bootx64.efi
|
||||||
//
|
//
|
||||||
// * lcow.initrd - Specifies a custom initrd file located in the `lcow.kirdpath` path
|
// * lcow.initrd - Specifies a custom initrd file located in the `lcow.kirdpath` path
|
||||||
// -- Possible values: Any valid filename
|
// -- Possible values: Any valid filename
|
||||||
// -- Default if ommitted: initrd.img
|
// -- Default if omitted: initrd.img
|
||||||
//
|
//
|
||||||
// * lcow.bootparameters - Specifies additional boot parameters for booting in kernel+initrd mode
|
// * lcow.bootparameters - Specifies additional boot parameters for booting in kernel+initrd mode
|
||||||
// -- Possible values: Any valid linux kernel boot options
|
// -- Possible values: Any valid linux kernel boot options
|
||||||
// -- Default if ommitted: <nil>
|
// -- Default if omitted: <nil>
|
||||||
//
|
//
|
||||||
// * lcow.vhdx - Specifies a custom vhdx file to boot (instead of a kernel+initrd)
|
// * lcow.vhdx - Specifies a custom vhdx file to boot (instead of a kernel+initrd)
|
||||||
// -- Possible values: Any valid filename
|
// -- Possible values: Any valid filename
|
||||||
// -- Default if ommitted: uvm.vhdx under `lcow.kirdpath`
|
// -- Default if omitted: uvm.vhdx under `lcow.kirdpath`
|
||||||
//
|
//
|
||||||
// * lcow.timeout - Specifies a timeout for utility VM operations in seconds
|
// * lcow.timeout - Specifies a timeout for utility VM operations in seconds
|
||||||
// -- Possible values: >=0
|
// -- Possible values: >=0
|
||||||
// -- Default if ommitted: 300
|
// -- Default if omitted: 300
|
||||||
|
|
||||||
// TODO: Grab logs from SVM at terminate or errors
|
// TODO: Grab logs from SVM at terminate or errors
|
||||||
|
|
||||||
@@ -836,7 +836,7 @@ func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) {
|
|||||||
ci.Unlock()
|
ci.Unlock()
|
||||||
|
|
||||||
// Start the SVM with a mapped virtual disk. Note that if the SVM is
|
// Start the SVM with a mapped virtual disk. Note that if the SVM is
|
||||||
// already runing and we are in global mode, this will be
|
// already running and we are in global mode, this will be
|
||||||
// hot-added.
|
// hot-added.
|
||||||
mvd := &hcsshim.MappedVirtualDisk{
|
mvd := &hcsshim.MappedVirtualDisk{
|
||||||
HostPath: ci.hostPath,
|
HostPath: ci.hostPath,
|
||||||
|
@@ -160,7 +160,7 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
|
|||||||
|
|
||||||
// Wait for exit with no timeout.
|
// Wait for exit with no timeout.
|
||||||
// Ignore returned status.
|
// Ignore returned status.
|
||||||
_ = <-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning)
|
<-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ func (daemon *Daemon) containerStop(container *containerpkg.Container, seconds i
|
|||||||
// 3. If it doesn't, then send SIGKILL
|
// 3. If it doesn't, then send SIGKILL
|
||||||
if err := daemon.Kill(container); err != nil {
|
if err := daemon.Kill(container); err != nil {
|
||||||
// Wait without a timeout, ignore result.
|
// Wait without a timeout, ignore result.
|
||||||
_ = <-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning)
|
<-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning)
|
||||||
logrus.Warn(err) // Don't return error because we only care that container is stopped, not what function stopped it
|
logrus.Warn(err) // Don't return error because we only care that container is stopped, not what function stopped it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -73,14 +73,14 @@ func executeTests(funkerName string, testChunks [][]string) error {
|
|||||||
}
|
}
|
||||||
log.Printf("Finished chunk %d [%d/%d] with %d test filters in %s, code=%d.",
|
log.Printf("Finished chunk %d [%d/%d] with %d test filters in %s, code=%d.",
|
||||||
chunkID, passed+failed, len(testChunks), len(tests),
|
chunkID, passed+failed, len(testChunks), len(tests),
|
||||||
time.Now().Sub(chunkBegin), result.Code)
|
time.Since(chunkBegin), result.Code)
|
||||||
}
|
}
|
||||||
}(chunkID, tests)
|
}(chunkID, tests)
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
// TODO: print actual tests rather than chunks
|
// TODO: print actual tests rather than chunks
|
||||||
log.Printf("Executed %d chunks in %s. PASS: %d, FAIL: %d.",
|
log.Printf("Executed %d chunks in %s. PASS: %d, FAIL: %d.",
|
||||||
len(testChunks), time.Now().Sub(begin), passed, failed)
|
len(testChunks), time.Since(begin), passed, failed)
|
||||||
if failed > 0 {
|
if failed > 0 {
|
||||||
return fmt.Errorf("%d chunks failed", failed)
|
return fmt.Errorf("%d chunks failed", failed)
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ func executeTestChunk(funkerName string, args types.Args) (types.Result, error)
|
|||||||
|
|
||||||
func executeTestChunkWithRetry(funkerName string, args types.Args) (types.Result, error) {
|
func executeTestChunkWithRetry(funkerName string, args types.Args) (types.Result, error) {
|
||||||
begin := time.Now()
|
begin := time.Now()
|
||||||
for i := 0; time.Now().Sub(begin) < funkerRetryTimeout; i++ {
|
for i := 0; time.Since(begin) < funkerRetryTimeout; i++ {
|
||||||
result, err := executeTestChunk(funkerName, args)
|
result, err := executeTestChunk(funkerName, args)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Printf("executeTestChunk(%q, %d) returned code %d in trial %d", funkerName, args.ChunkID, result.Code, i)
|
log.Printf("executeTestChunk(%q, %d) returned code %d in trial %d", funkerName, args.ChunkID, result.Code, i)
|
||||||
|
@@ -58,7 +58,7 @@ func handle(workerImageDigest string, executor testChunkExecutor) error {
|
|||||||
RawLog: rawLog,
|
RawLog: rawLog,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elapsed := time.Now().Sub(begin)
|
elapsed := time.Since(begin)
|
||||||
log.Printf("Finished chunk %d, code=%d, elapsed=%v", args.ChunkID, code, elapsed)
|
log.Printf("Finished chunk %d, code=%d, elapsed=%v", args.ChunkID, code, elapsed)
|
||||||
return types.Result{
|
return types.Result{
|
||||||
ChunkID: args.ChunkID,
|
ChunkID: args.ChunkID,
|
||||||
|
@@ -193,9 +193,7 @@ func runDockerCp(c *check.C, src, dst string, params []string) (err error) {
|
|||||||
|
|
||||||
args := []string{"cp"}
|
args := []string{"cp"}
|
||||||
|
|
||||||
for _, param := range params {
|
args = append(args, params...)
|
||||||
args = append(args, param)
|
|
||||||
}
|
|
||||||
|
|
||||||
args = append(args, src, dst)
|
args = append(args, src, dst)
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
|
|||||||
// List of available time formats to --since
|
// List of available time formats to --since
|
||||||
unixTs := func(t time.Time) string { return fmt.Sprintf("%v", t.Unix()) }
|
unixTs := func(t time.Time) string { return fmt.Sprintf("%v", t.Unix()) }
|
||||||
rfc3339 := func(t time.Time) string { return t.Format(time.RFC3339) }
|
rfc3339 := func(t time.Time) string { return t.Format(time.RFC3339) }
|
||||||
duration := func(t time.Time) string { return time.Now().Sub(t).String() }
|
duration := func(t time.Time) string { return time.Since(t).String() }
|
||||||
|
|
||||||
// --since=$start must contain only the 'untag' event
|
// --since=$start must contain only the 'untag' event
|
||||||
for _, f := range []func(time.Time) string{unixTs, rfc3339, duration} {
|
for _, f := range []func(time.Time) string{unixTs, rfc3339, duration} {
|
||||||
|
@@ -7,7 +7,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateOpt is is passed used to change the defualt plugin config before
|
// CreateOpt is is passed used to change the default plugin config before
|
||||||
// creating it
|
// creating it
|
||||||
type CreateOpt func(*Config)
|
type CreateOpt func(*Config)
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DevmapperLogger defines methods required to register as a callback for
|
// DevmapperLogger defines methods required to register as a callback for
|
||||||
// logging events recieved from devicemapper. Note that devicemapper will send
|
// logging events received from devicemapper. Note that devicemapper will send
|
||||||
// *all* logs regardless to callbacks (including debug logs) so it's
|
// *all* logs regardless to callbacks (including debug logs) so it's
|
||||||
// recommended to not spam the console with the outputs.
|
// recommended to not spam the console with the outputs.
|
||||||
type DevmapperLogger interface {
|
type DevmapperLogger interface {
|
||||||
|
Reference in New Issue
Block a user