mirror of https://github.com/docker/docs.git
fix test requirement about devicemapper and not overlay
Signed-off-by: mYmNeo <thomassong@tencent.com>
This commit is contained in:
parent
c7cf245053
commit
90f512427f
|
@ -54,6 +54,11 @@ var (
|
||||||
dockerBasePath string
|
dockerBasePath string
|
||||||
volumesConfigPath string
|
volumesConfigPath string
|
||||||
containerStoragePath string
|
containerStoragePath string
|
||||||
|
|
||||||
|
// daemonStorageDriver is held globally so that tests can know the storage
|
||||||
|
// driver of the daemon. This is initialized in docker_utils by sending
|
||||||
|
// a version call to the daemon and examining the response header.
|
||||||
|
daemonStorageDriver string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -67,6 +67,7 @@ func init() {
|
||||||
panic(fmt.Errorf("Init failed to unmarshal docker info: %v", err))
|
panic(fmt.Errorf("Init failed to unmarshal docker info: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
daemonStorageDriver = info.Driver
|
||||||
dockerBasePath = info.DockerRootDir
|
dockerBasePath = info.DockerRootDir
|
||||||
volumesConfigPath = filepath.Join(dockerBasePath, "volumes")
|
volumesConfigPath = filepath.Join(dockerBasePath, "volumes")
|
||||||
containerStoragePath = filepath.Join(dockerBasePath, "containers")
|
containerStoragePath = filepath.Join(dockerBasePath, "containers")
|
||||||
|
|
|
@ -109,22 +109,14 @@ var (
|
||||||
}
|
}
|
||||||
NotOverlay = testRequirement{
|
NotOverlay = testRequirement{
|
||||||
func() bool {
|
func() bool {
|
||||||
cmd := exec.Command("grep", "^overlay / overlay", "/proc/mounts")
|
return !strings.HasPrefix(daemonStorageDriver, "overlay")
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
},
|
||||||
"Test requires underlying root filesystem not be backed by overlay.",
|
"Test requires underlying root filesystem not be backed by overlay.",
|
||||||
}
|
}
|
||||||
|
|
||||||
Devicemapper = testRequirement{
|
Devicemapper = testRequirement{
|
||||||
func() bool {
|
func() bool {
|
||||||
cmd := exec.Command("grep", "^devicemapper / devicemapper", "/proc/mounts")
|
return strings.HasPrefix(daemonStorageDriver, "devicemapper")
|
||||||
if err := cmd.Run(); err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
},
|
},
|
||||||
"Test requires underlying root filesystem to be backed by devicemapper.",
|
"Test requires underlying root filesystem to be backed by devicemapper.",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue