зеркало из https://github.com/microsoft/docker.git
Add test for event limitation
Docker-DCO-1.1-Signed-off-by: Samuel Reis <srijs@airpost.net> (github: srijs)
This commit is contained in:
Родитель
5d4986c755
Коммит
46747963b6
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -55,3 +56,17 @@ func TestCLIGetEventsPause(t *testing.T) {
|
||||||
|
|
||||||
logDone("events - pause/unpause is logged")
|
logDone("events - pause/unpause is logged")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCLILimitEvents(t *testing.T) {
|
||||||
|
for i := 0; i < 30; i++ {
|
||||||
|
cmd(t, "run", "busybox", "echo", strconv.Itoa(i))
|
||||||
|
}
|
||||||
|
eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
|
||||||
|
out, _, _ := runCommandWithOutput(eventsCmd)
|
||||||
|
events := strings.Split(out, "\n")
|
||||||
|
n_events := len(events) - 1
|
||||||
|
if n_events > 64 {
|
||||||
|
t.Fatalf("events should be limited to 64, but received %d", n_events)
|
||||||
|
}
|
||||||
|
logDone("events - limited to 64 entries")
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче