handle empty envvars for DOCKER_GRAPHDRIVER and DOCKER_EXECDRIVER in daemon test framework

Signed-off-by: Tibor Vass <teabee89@gmail.com>
This commit is contained in:
Tibor Vass 2014-09-03 17:12:36 -07:00
parent defe01daf8
commit 39310448da
1 changed files with 8 additions and 3 deletions

View File

@ -60,7 +60,7 @@ func NewDaemon(t *testing.T) *Daemon {
} }
// Start will start the daemon and return once it is ready to receive requests. // Start will start the daemon and return once it is ready to receive requests.
// You can specify additional daemon flags (e.g. "--restart=false"). // You can specify additional daemon flags.
func (d *Daemon) Start(arg ...string) error { func (d *Daemon) Start(arg ...string) error {
dockerBinary, err := exec.LookPath(dockerBinary) dockerBinary, err := exec.LookPath(dockerBinary)
if err != nil { if err != nil {
@ -71,10 +71,15 @@ func (d *Daemon) Start(arg ...string) error {
"--host", d.sock(), "--host", d.sock(),
"--daemon", "--debug", "--daemon", "--debug",
"--graph", fmt.Sprintf("%s/graph", d.folder), "--graph", fmt.Sprintf("%s/graph", d.folder),
"--storage-driver", d.storageDriver,
"--exec-driver", d.execDriver,
"--pidfile", fmt.Sprintf("%s/docker.pid", d.folder), "--pidfile", fmt.Sprintf("%s/docker.pid", d.folder),
} }
if d.storageDriver != "" {
args = append(args, "--storage-driver", d.storageDriver)
}
if d.execDriver != "" {
args = append(args, "--exec-driver", d.execDriver)
}
args = append(args, arg...) args = append(args, arg...)
d.cmd = exec.Command(dockerBinary, args...) d.cmd = exec.Command(dockerBinary, args...)