Fix events test flakiness.

Since channel is getting a send instead of a close now, this can cause
random issues ranging through the list of channels if the channel is
unbuffered since the send may be blocked.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff 2016-02-18 16:10:29 -05:00
parent 038c3b8287
commit abbf2aa6dd
3 changed files with 11 additions and 11 deletions

View File

@ -265,8 +265,8 @@ func (s *DockerAuthzSuite) TestAuthZPluginAllowEventStream(c *check.C) {
c.Assert(s.d.waitRun(containerID), checker.IsNil)
events := map[string]chan bool{
"create": make(chan bool),
"start": make(chan bool),
"create": make(chan bool, 1),
"start": make(chan bool, 1),
}
matcher := matchEventLine(containerID, "container", events)
@ -277,7 +277,7 @@ func (s *DockerAuthzSuite) TestAuthZPluginAllowEventStream(c *check.C) {
for event, eventChannel := range events {
select {
case <-time.After(5 * time.Second):
case <-time.After(30 * time.Second):
// Fail the test
observer.CheckEventError(c, containerID, event, matcher)
c.FailNow()

View File

@ -171,8 +171,8 @@ func (s *DockerSuite) TestBuildCancellationKillsSleep(c *check.C) {
}
testActions := map[string]chan bool{
"start": make(chan bool),
"die": make(chan bool),
"start": make(chan bool, 1),
"die": make(chan bool, 1),
}
matcher := matchEventLine(buildID, "container", testActions)

View File

@ -232,10 +232,10 @@ func (s *DockerSuite) TestEventsStreaming(c *check.C) {
containerID := strings.TrimSpace(out)
testActions := map[string]chan bool{
"create": make(chan bool),
"start": make(chan bool),
"die": make(chan bool),
"destroy": make(chan bool),
"create": make(chan bool, 1),
"start": make(chan bool, 1),
"die": make(chan bool, 1),
"destroy": make(chan bool, 1),
}
matcher := matchEventLine(containerID, "container", testActions)
@ -291,8 +291,8 @@ func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) {
c.Assert(deleteImages(name), checker.IsNil)
testActions := map[string]chan bool{
"untag": make(chan bool),
"delete": make(chan bool),
"untag": make(chan bool, 1),
"delete": make(chan bool, 1),
}
matcher := matchEventLine(imageID, "image", testActions)