2015-07-02 11:43:07 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
|
2015-10-15 12:40:36 -04:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2015-07-02 11:43:07 -04:00
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestEventsApiEmptyOutput(c *check.C) {
|
|
|
|
type apiResp struct {
|
|
|
|
resp *http.Response
|
|
|
|
err error
|
|
|
|
}
|
|
|
|
chResp := make(chan *apiResp)
|
|
|
|
go func() {
|
|
|
|
resp, body, err := sockRequestRaw("GET", "/events", nil, "")
|
|
|
|
body.Close()
|
|
|
|
chResp <- &apiResp{resp, err}
|
|
|
|
}()
|
|
|
|
|
|
|
|
select {
|
|
|
|
case r := <-chResp:
|
2015-10-15 12:40:36 -04:00
|
|
|
c.Assert(r.err, checker.IsNil)
|
|
|
|
c.Assert(r.resp.StatusCode, checker.Equals, http.StatusOK)
|
2015-07-02 11:43:07 -04:00
|
|
|
case <-time.After(3 * time.Second):
|
|
|
|
c.Fatal("timeout waiting for events api to respond, should have responded immediately")
|
|
|
|
}
|
|
|
|
}
|