Add a way to retrieve a test container event channel

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2016-03-28 11:27:12 -07:00
parent e6b2ed4b7f
commit 3481996e9d

View file

@ -110,12 +110,21 @@ func (c *containerProcess) openIo() (err error) {
return nil
}
func (c *containerProcess) GetEventsChannel() chan *types.Event {
return c.eventsCh
}
func (c *containerProcess) GetNextEvent() *types.Event {
if c.hasExited {
return nil
}
e := <-c.eventsCh
if e.Type == "exit" && e.Pid == c.pid {
c.Cleanup()
c.hasExited = true
close(c.eventsCh)
}
return e