Toggle /ping to artificially return unhealthy response on SIGTERM during requestAcceptGraceTimeout interval
This commit is contained in:
parent
9699dc2a85
commit
5792a19b97
5 changed files with 45 additions and 4 deletions
|
@ -128,6 +128,10 @@ func (s *SimpleSuite) TestRequestAcceptGraceTimeout(c *check.C) {
|
|||
err = try.GetRequest("http://127.0.0.1:8000/service", 3*time.Second, try.StatusCodeIs(http.StatusOK))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// Check that /ping endpoint is responding with 200.
|
||||
err = try.GetRequest("http://127.0.0.1:8001/ping", 3*time.Second, try.StatusCodeIs(http.StatusOK))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// Send SIGTERM to Traefik.
|
||||
proc, err := os.FindProcess(cmd.Process.Pid)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
@ -143,6 +147,12 @@ func (s *SimpleSuite) TestRequestAcceptGraceTimeout(c *check.C) {
|
|||
defer resp.Body.Close()
|
||||
c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
|
||||
|
||||
// ping endpoint should now return a Service Unavailable.
|
||||
resp, err = http.Get("http://127.0.0.1:8001/ping")
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer resp.Body.Close()
|
||||
c.Assert(resp.StatusCode, checker.Equals, http.StatusServiceUnavailable)
|
||||
|
||||
// Expect Traefik to shut down gracefully once the request accepting grace
|
||||
// period has elapsed.
|
||||
waitErr := make(chan error)
|
||||
|
|
|
@ -6,6 +6,9 @@ logLevel = "DEBUG"
|
|||
[entryPoints.http]
|
||||
address = ":8000"
|
||||
|
||||
[entryPoints.traefik]
|
||||
address = ":8001"
|
||||
|
||||
[lifeCycle]
|
||||
requestAcceptGraceTimeout = "10s"
|
||||
|
||||
|
@ -20,3 +23,5 @@ logLevel = "DEBUG"
|
|||
backend = "backend"
|
||||
[frontends.frontend.routes.service]
|
||||
rule = "Path:/service"
|
||||
|
||||
[ping]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue