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

Remove some unused global variables

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-12-08 16:28:06 +01:00
parent bcad3d5212
commit 58ad9177d7
No known key found for this signature in database
GPG key ID: 083CC6FD6EB699A3
4 changed files with 19 additions and 27 deletions

View file

@ -275,4 +275,7 @@ func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {
out, _ = dockerCmd(c, "ps")
c.Assert(out, checker.Contains, id[:12], check.Commentf("container should be restarted instead of removed: %v", out))
// Kill the container to make sure it will be removed
dockerCmd(c, "kill", id)
}

View file

@ -71,7 +71,7 @@ func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
// nslookup isn't present in nanoserver. Hence just use PowerShell...
dockerCmd(c, "run", WindowsBaseImage, "powershell", "Resolve-DNSName", "google.com")
} else {
dockerCmd(c, "run", DefaultImage, "nslookup", "google.com")
dockerCmd(c, "run", "busybox", "nslookup", "google.com")
}
}

View file

@ -22,16 +22,9 @@ var (
// path to containerd's ctr binary
ctrBinary = "docker-containerd-ctr"
// the private registry image to use for tests involving the registry
registryImageName = "registry"
// the private registry to use for tests
privateRegistryURL = "127.0.0.1:5000"
// TODO Windows CI. These are incorrect and need fixing into
// platform specific pieces.
runtimePath = "/var/run/docker"
workingDirectory string
// isLocalDaemon is true if the daemon under test is on the same
@ -50,10 +43,6 @@ var (
// not support volumes, but TP4 did.
windowsDaemonKV int
// daemonDefaultImage is the name of the default image to use when running
// tests. This is platform dependent.
daemonDefaultImage string
// For a local daemon on Linux, these values will be used for testing
// user namespace support as the standard graph path(s) will be
// appended with the root remapped uid.gid prefix
@ -81,12 +70,6 @@ var (
daemonPid int
)
const (
// DefaultImage is the name of the base image for the majority of tests that
// are run across suites
DefaultImage = "busybox"
)
func init() {
reexec.Init()
if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
@ -98,9 +81,6 @@ func init() {
fmt.Printf("ERROR: couldn't resolve full path to the Docker binary (%v)\n", err)
os.Exit(1)
}
if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
registryImageName = registryImage
}
if registry := os.Getenv("REGISTRY_URL"); registry != "" {
privateRegistryURL = registry
}

View file

@ -358,12 +358,12 @@ func getAllVolumes() ([]*types.Volume, error) {
var protectedImages = map[string]struct{}{}
func deleteAllImages(c *check.C) {
cmd := exec.Command(dockerBinary, "images")
cmd := exec.Command(dockerBinary, "images", "--digests")
cmd.Env = appendBaseEnv(true)
out, err := cmd.CombinedOutput()
c.Assert(err, checker.IsNil)
lines := strings.Split(string(out), "\n")[1:]
var imgs []string
imgMap := map[string]struct{}{}
for _, l := range lines {
if l == "" {
continue
@ -372,13 +372,22 @@ func deleteAllImages(c *check.C) {
imgTag := fields[0] + ":" + fields[1]
if _, ok := protectedImages[imgTag]; !ok {
if fields[0] == "<none>" || fields[1] == "<none>" {
imgs = append(imgs, fields[2])
continue
if fields[2] != "<none>" {
imgMap[fields[0]+"@"+fields[2]] = struct{}{}
} else {
imgMap[fields[3]] = struct{}{}
}
// continue
} else {
imgMap[imgTag] = struct{}{}
}
imgs = append(imgs, imgTag)
}
}
if len(imgs) != 0 {
if len(imgMap) != 0 {
imgs := make([]string, 0, len(imgMap))
for k := range imgMap {
imgs = append(imgs, k)
}
dockerCmd(c, append([]string{"rmi", "-f"}, imgs...)...)
}
}