Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
Jessica Frazelle authored on 2014/12/24 04:16:23... | ... |
@@ -351,3 +351,19 @@ func TestExecTtyWithoutStdin(t *testing.T) { |
351 | 351 |
|
352 | 352 |
logDone("exec - forbid piped stdin to tty enabled container") |
353 | 353 |
} |
354 |
+ |
|
355 |
+func TestExecParseError(t *testing.T) { |
|
356 |
+ defer deleteAllContainers() |
|
357 |
+ |
|
358 |
+ runCmd := exec.Command(dockerBinary, "run", "-d", "--name", "top", "busybox", "top") |
|
359 |
+ if out, _, err := runCommandWithOutput(runCmd); err != nil { |
|
360 |
+ t.Fatal(out, err) |
|
361 |
+ } |
|
362 |
+ |
|
363 |
+ // Test normal (non-detached) case first |
|
364 |
+ cmd := exec.Command(dockerBinary, "exec", "top") |
|
365 |
+ if out, _, err := runCommandWithOutput(cmd); err == nil || !strings.Contains(out, "Usage:") { |
|
366 |
+ t.Fatalf("Should have thrown error & given usage: %s", out) |
|
367 |
+ } |
|
368 |
+ logDone("exec - error on parseExec should return usage") |
|
369 |
+} |