fix test requirement about devicemapper and not overlay

Signed-off-by: mYmNeo <thomassong@tencent.com>
(cherry picked from commit 90f512427f)
This commit is contained in:
mYmNeo 2016-04-06 09:45:30 +08:00 committed by Tibor Vass
parent 5d1b0aecd0
commit 9e4c6c75f5
3 changed files with 8 additions and 10 deletions

View File

@ -54,6 +54,11 @@ var (
dockerBasePath string
volumesConfigPath 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 (

View File

@ -86,6 +86,7 @@ func init() {
var info types.Info
err = json.Unmarshal(body, &info)
daemonStorageDriver = info.Driver
dockerBasePath = info.DockerRootDir
volumesConfigPath = filepath.Join(dockerBasePath, "volumes")
containerStoragePath = filepath.Join(dockerBasePath, "containers")

View File

@ -109,22 +109,14 @@ var (
}
NotOverlay = testRequirement{
func() bool {
cmd := exec.Command("grep", "^overlay / overlay", "/proc/mounts")
if err := cmd.Run(); err != nil {
return true
}
return false
return !strings.HasPrefix(daemonStorageDriver, "overlay")
},
"Test requires underlying root filesystem not be backed by overlay.",
}
Devicemapper = testRequirement{
func() bool {
cmd := exec.Command("grep", "^devicemapper / devicemapper", "/proc/mounts")
if err := cmd.Run(); err != nil {
return false
}
return true
return strings.HasPrefix(daemonStorageDriver, "devicemapper")
},
"Test requires underlying root filesystem to be backed by devicemapper.",
}