Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
| ... | ... |
@@ -2912,3 +2912,26 @@ func TestRunAllowPortRangeThroughPublish(t *testing.T) {
|
| 2912 | 2912 |
} |
| 2913 | 2913 |
logDone("run - allow port range through --expose flag")
|
| 2914 | 2914 |
} |
| 2915 |
+ |
|
| 2916 |
+func TestRunOOMExitCode(t *testing.T) {
|
|
| 2917 |
+ defer deleteAllContainers() |
|
| 2918 |
+ |
|
| 2919 |
+ done := make(chan struct{})
|
|
| 2920 |
+ go func() {
|
|
| 2921 |
+ defer close(done) |
|
| 2922 |
+ |
|
| 2923 |
+ runCmd := exec.Command(dockerBinary, "run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x; done") |
|
| 2924 |
+ out, exitCode, _ := runCommandWithOutput(runCmd) |
|
| 2925 |
+ if expected := 137; exitCode != expected {
|
|
| 2926 |
+ t.Fatalf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out)
|
|
| 2927 |
+ } |
|
| 2928 |
+ }() |
|
| 2929 |
+ |
|
| 2930 |
+ select {
|
|
| 2931 |
+ case <-done: |
|
| 2932 |
+ case <-time.After(3 * time.Second): |
|
| 2933 |
+ t.Fatal("Timeout waiting for container to die on OOM")
|
|
| 2934 |
+ } |
|
| 2935 |
+ |
|
| 2936 |
+ logDone("run - exit code on oom")
|
|
| 2937 |
+} |