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

Merge pull request #10101 from LK4D4/fix_vet_errors

Fix vet errors
This commit is contained in:
Michael Crosby 2015-01-14 15:18:20 -08:00
commit 3118ccc6bc
7 changed files with 14 additions and 14 deletions

View file

@ -25,13 +25,13 @@ func New() *libcontainer.Config {
"KILL", "KILL",
"AUDIT_WRITE", "AUDIT_WRITE",
}, },
Namespaces: libcontainer.Namespaces{ Namespaces: libcontainer.Namespaces([]libcontainer.Namespace{
{Type: "NEWNS"}, {Type: "NEWNS"},
{Type: "NEWUTS"}, {Type: "NEWUTS"},
{Type: "NEWIPC"}, {Type: "NEWIPC"},
{Type: "NEWPID"}, {Type: "NEWPID"},
{Type: "NEWNET"}, {Type: "NEWNET"},
}, }),
Cgroups: &cgroups.Cgroup{ Cgroups: &cgroups.Cgroup{
Parent: "docker", Parent: "docker",
AllowAllDevices: false, AllowAllDevices: false,

View file

@ -1550,13 +1550,13 @@ func (devices *DeviceSet) poolStatus() (totalSizeInSectors, transactionId, dataU
// MetadataDevicePath returns the path to the metadata storage for this deviceset, // MetadataDevicePath returns the path to the metadata storage for this deviceset,
// regardless of loopback or block device // regardless of loopback or block device
func (devices DeviceSet) DataDevicePath() string { func (devices *DeviceSet) DataDevicePath() string {
return devices.dataDevice return devices.dataDevice
} }
// MetadataDevicePath returns the path to the metadata storage for this deviceset, // MetadataDevicePath returns the path to the metadata storage for this deviceset,
// regardless of loopback or block device // regardless of loopback or block device
func (devices DeviceSet) MetadataDevicePath() string { func (devices *DeviceSet) MetadataDevicePath() string {
return devices.metadataDevice return devices.metadataDevice
} }

View file

@ -67,7 +67,7 @@ func TestRmRunningContainerCheckError409(t *testing.T) {
t.Fatalf("Expected error, can't rm a running container") t.Fatalf("Expected error, can't rm a running container")
} }
if !strings.Contains(err.Error(), "409 Conflict") { if !strings.Contains(err.Error(), "409 Conflict") {
t.Fatalf("Expected error to contain '409 Conflict' but found", err) t.Fatalf("Expected error to contain '409 Conflict' but found %s", err)
} }
deleteAllContainers() deleteAllContainers()

View file

@ -319,18 +319,18 @@ func TestRunLinksContainerWithContainerName(t *testing.T) {
cmd := exec.Command(dockerBinary, "run", "-t", "-d", "--name", "parent", "busybox") cmd := exec.Command(dockerBinary, "run", "-t", "-d", "--name", "parent", "busybox")
out, _, _, err := runCommandWithStdoutStderr(cmd) out, _, _, err := runCommandWithStdoutStderr(cmd)
if err != nil { if err != nil {
t.Fatal("failed to run container: %v, output: %q", err, out) t.Fatalf("failed to run container: %v, output: %q", err, out)
} }
cmd = exec.Command(dockerBinary, "inspect", "-f", "{{.NetworkSettings.IPAddress}}", "parent") cmd = exec.Command(dockerBinary, "inspect", "-f", "{{.NetworkSettings.IPAddress}}", "parent")
ip, _, _, err := runCommandWithStdoutStderr(cmd) ip, _, _, err := runCommandWithStdoutStderr(cmd)
if err != nil { if err != nil {
t.Fatal("failed to inspect container: %v, output: %q", err, ip) t.Fatalf("failed to inspect container: %v, output: %q", err, ip)
} }
ip = strings.TrimSpace(ip) ip = strings.TrimSpace(ip)
cmd = exec.Command(dockerBinary, "run", "--link", "parent:test", "busybox", "/bin/cat", "/etc/hosts") cmd = exec.Command(dockerBinary, "run", "--link", "parent:test", "busybox", "/bin/cat", "/etc/hosts")
out, _, err = runCommandWithOutput(cmd) out, _, err = runCommandWithOutput(cmd)
if err != nil { if err != nil {
t.Fatal("failed to run container: %v, output: %q", err, out) t.Fatalf("failed to run container: %v, output: %q", err, out)
} }
if !strings.Contains(out, ip+" test") { if !strings.Contains(out, ip+" test") {
t.Fatalf("use a container name to link target failed") t.Fatalf("use a container name to link target failed")
@ -345,19 +345,19 @@ func TestRunLinksContainerWithContainerId(t *testing.T) {
cmd := exec.Command(dockerBinary, "run", "-t", "-d", "busybox") cmd := exec.Command(dockerBinary, "run", "-t", "-d", "busybox")
cID, _, _, err := runCommandWithStdoutStderr(cmd) cID, _, _, err := runCommandWithStdoutStderr(cmd)
if err != nil { if err != nil {
t.Fatal("failed to run container: %v, output: %q", err, cID) t.Fatalf("failed to run container: %v, output: %q", err, cID)
} }
cID = strings.TrimSpace(cID) cID = strings.TrimSpace(cID)
cmd = exec.Command(dockerBinary, "inspect", "-f", "{{.NetworkSettings.IPAddress}}", cID) cmd = exec.Command(dockerBinary, "inspect", "-f", "{{.NetworkSettings.IPAddress}}", cID)
ip, _, _, err := runCommandWithStdoutStderr(cmd) ip, _, _, err := runCommandWithStdoutStderr(cmd)
if err != nil { if err != nil {
t.Fatal("faild to inspect container: %v, output: %q", err, ip) t.Fatalf("faild to inspect container: %v, output: %q", err, ip)
} }
ip = strings.TrimSpace(ip) ip = strings.TrimSpace(ip)
cmd = exec.Command(dockerBinary, "run", "--link", cID+":test", "busybox", "/bin/cat", "/etc/hosts") cmd = exec.Command(dockerBinary, "run", "--link", cID+":test", "busybox", "/bin/cat", "/etc/hosts")
out, _, err := runCommandWithOutput(cmd) out, _, err := runCommandWithOutput(cmd)
if err != nil { if err != nil {
t.Fatal("failed to run container: %v, output: %q", err, out) t.Fatalf("failed to run container: %v, output: %q", err, out)
} }
if !strings.Contains(out, ip+" test") { if !strings.Contains(out, ip+" test") {
t.Fatalf("use a container id to link target failed") t.Fatalf("use a container id to link target failed")

View file

@ -226,7 +226,7 @@ out2:
case <-tick: case <-tick:
i++ i++
if i > 4 { if i > 4 {
d.t.Log("tried to interrupt daemon for %d times, now try to kill it", i) d.t.Logf("tried to interrupt daemon for %d times, now try to kill it", i)
break out2 break out2
} }
d.t.Logf("Attempt #%d: daemon is still running with pid %d", i, d.cmd.Process.Pid) d.t.Logf("Attempt #%d: daemon is still running with pid %d", i, d.cmd.Process.Pid)

View file

@ -281,7 +281,7 @@ func TestParsePortSpecsWithRange(t *testing.T) {
for portspec, bindings := range bindingMap { for portspec, bindings := range bindingMap {
_, port := SplitProtoPort(string(portspec)) _, port := SplitProtoPort(string(portspec))
if len(bindings) != 1 || bindings[0].HostIp != "0.0.0.0" || bindings[0].HostPort != port { if len(bindings) != 1 || bindings[0].HostIp != "0.0.0.0" || bindings[0].HostPort != port {
t.Fatalf("Expect single binding to port %d but found %s", port, bindings) t.Fatalf("Expect single binding to port %s but found %s", port, bindings)
} }
} }

View file

@ -151,7 +151,7 @@ func TestResolveAuthConfigFullURL(t *testing.T) {
for configKey, registries := range validRegistries { for configKey, registries := range validRegistries {
configured, ok := expectedAuths[configKey] configured, ok := expectedAuths[configKey]
if !ok || configured.Email == "" { if !ok || configured.Email == "" {
t.Fatal() t.Fail()
} }
index := &IndexInfo{ index := &IndexInfo{
Name: configKey, Name: configKey,