Docker-DCO-1.1-Signed-off-by: Samuel Reis <srijs@airpost.net> (github: srijs)
| ... | ... |
@@ -3,6 +3,7 @@ package main |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"os/exec" |
| 6 |
+ "strconv" |
|
| 6 | 7 |
"strings" |
| 7 | 8 |
"testing" |
| 8 | 9 |
"time" |
| ... | ... |
@@ -55,3 +56,17 @@ func TestCLIGetEventsPause(t *testing.T) {
|
| 55 | 55 |
|
| 56 | 56 |
logDone("events - pause/unpause is logged")
|
| 57 | 57 |
} |
| 58 |
+ |
|
| 59 |
+func TestCLILimitEvents(t *testing.T) {
|
|
| 60 |
+ for i := 0; i < 30; i++ {
|
|
| 61 |
+ cmd(t, "run", "busybox", "echo", strconv.Itoa(i)) |
|
| 62 |
+ } |
|
| 63 |
+ eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
|
|
| 64 |
+ out, _, _ := runCommandWithOutput(eventsCmd) |
|
| 65 |
+ events := strings.Split(out, "\n") |
|
| 66 |
+ n_events := len(events) - 1 |
|
| 67 |
+ if n_events > 64 {
|
|
| 68 |
+ t.Fatalf("events should be limited to 64, but received %d", n_events)
|
|
| 69 |
+ } |
|
| 70 |
+ logDone("events - limited to 64 entries")
|
|
| 71 |
+} |