Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScalatestRouteTest ignoring withRequestTimeout in Route #952

Open
miguel-leon opened this issue Mar 9, 2017 · 2 comments

Comments

@miguel-leon
Copy link

commented Mar 9, 2017

Hi,

In this code for example, similar to the code in the akka-http documentation:

path("test") {
  withRequestTimeout(100 millis) {
    onSuccess(Future { Thread.sleep(300) }) {
      complete(OK)
    }
  }
}

If I then write a test like such:

Get("/test") ~> route ~> check {
  status shouldBe ServiceUnavailable
}

I get a log WARN saying "withRequestTimeout was used in route however no request-timeout is set!"
and the test fails with "200 OK was not equal to 503 Service Unavailable"

However if I test this manually, say with Postman, it works as expected.

@miguel-leon

This comment has been minimized.

Copy link
Author

commented Mar 9, 2017

Needless to say, I didn't find documentation for this or comments of this happening to someone else anywhere on the internet.

@ktoso

This comment has been minimized.

Copy link
Member

commented Mar 9, 2017

This is because a route test like this avoids starting the real http server, the ticket that would solve it is: #39

Basically, if you want to test timeouts or "the entire http stack" you should start the full http server in your test nowadays.

I'll keep the issue open but the solution is the linked Issue I believe.

@ktoso ktoso added the 1 - triaged label Mar 9, 2017

@jonas jonas referenced this issue May 14, 2017
1 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.