mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add imagename to LogEvent tests
This commit is contained in:
parent
72660a1a2f
commit
7f9ba14b18
2 changed files with 6 additions and 6 deletions
|
@ -97,8 +97,8 @@ func TestGetEvents(t *testing.T) {
|
||||||
listeners: make(map[string]chan utils.JSONMessage),
|
listeners: make(map[string]chan utils.JSONMessage),
|
||||||
}
|
}
|
||||||
|
|
||||||
srv.LogEvent("fakeaction", "fakeid")
|
srv.LogEvent("fakeaction", "fakeid", "fakeimage")
|
||||||
srv.LogEvent("fakeaction2", "fakeid")
|
srv.LogEvent("fakeaction2", "fakeid", "fakeimage")
|
||||||
|
|
||||||
req, err := http.NewRequest("GET", "/events?since=1", nil)
|
req, err := http.NewRequest("GET", "/events?since=1", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -317,23 +317,23 @@ func TestLogEvent(t *testing.T) {
|
||||||
listeners: make(map[string]chan utils.JSONMessage),
|
listeners: make(map[string]chan utils.JSONMessage),
|
||||||
}
|
}
|
||||||
|
|
||||||
srv.LogEvent("fakeaction", "fakeid")
|
srv.LogEvent("fakeaction", "fakeid", "fakeimage")
|
||||||
|
|
||||||
listener := make(chan utils.JSONMessage)
|
listener := make(chan utils.JSONMessage)
|
||||||
srv.Lock()
|
srv.Lock()
|
||||||
srv.listeners["test"] = listener
|
srv.listeners["test"] = listener
|
||||||
srv.Unlock()
|
srv.Unlock()
|
||||||
|
|
||||||
srv.LogEvent("fakeaction2", "fakeid")
|
srv.LogEvent("fakeaction2", "fakeid", "fakeimage")
|
||||||
|
|
||||||
if len(srv.events) != 2 {
|
if len(srv.events) != 2 {
|
||||||
t.Fatalf("Expected 2 events, found %d", len(srv.events))
|
t.Fatalf("Expected 2 events, found %d", len(srv.events))
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
srv.LogEvent("fakeaction3", "fakeid")
|
srv.LogEvent("fakeaction3", "fakeid", "fakeimage")
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
srv.LogEvent("fakeaction4", "fakeid")
|
srv.LogEvent("fakeaction4", "fakeid", "fakeimage")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
setTimeout(t, "Listening for events timed out", 2*time.Second, func() {
|
setTimeout(t, "Listening for events timed out", 2*time.Second, func() {
|
||||||
|
|
Loading…
Reference in a new issue