Browse code

handle empty envvars for DOCKER_GRAPHDRIVER and DOCKER_EXECDRIVER in daemon test framework

Signed-off-by: Tibor Vass <teabee89@gmail.com>

Tibor Vass authored on 2014/09/04 09:12:36
Showing 1 changed files
... ...
@@ -60,7 +60,7 @@ func NewDaemon(t *testing.T) *Daemon {
60 60
 }
61 61
 
62 62
 // Start will start the daemon and return once it is ready to receive requests.
63
-// You can specify additional daemon flags (e.g. "--restart=false").
63
+// You can specify additional daemon flags.
64 64
 func (d *Daemon) Start(arg ...string) error {
65 65
 	dockerBinary, err := exec.LookPath(dockerBinary)
66 66
 	if err != nil {
... ...
@@ -71,10 +71,15 @@ func (d *Daemon) Start(arg ...string) error {
71 71
 		"--host", d.sock(),
72 72
 		"--daemon", "--debug",
73 73
 		"--graph", fmt.Sprintf("%s/graph", d.folder),
74
-		"--storage-driver", d.storageDriver,
75
-		"--exec-driver", d.execDriver,
76 74
 		"--pidfile", fmt.Sprintf("%s/docker.pid", d.folder),
77 75
 	}
76
+	if d.storageDriver != "" {
77
+		args = append(args, "--storage-driver", d.storageDriver)
78
+	}
79
+	if d.execDriver != "" {
80
+		args = append(args, "--exec-driver", d.execDriver)
81
+	}
82
+
78 83
 	args = append(args, arg...)
79 84
 	d.cmd = exec.Command(dockerBinary, args...)
80 85