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

[compliance tests] addresses timeouts on the server side #712

Merged
merged 4 commits into from
Jan 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ private[compliancetests] class ServerHttpComplianceTestCase[
)(implicit
ce: CompatEffect[F]
) {

import ce._
import org.http4s.implicits._
import router._

private[compliancetests] val originalService: Service[Alg] = serviceInstance
private val baseUri = uri"http://localhost/"

Expand Down Expand Up @@ -110,19 +112,32 @@ private[compliancetests] class ServerHttpComplianceTestCase[
.use { server =>
server.orNotFound
.run(makeRequest(baseUri, testCase))
.attemptNarrow[NotImplementedError] *>
ce.timeout(inputDeferred.get, 1.second).flatMap { foundInput =>
inputFromDocument
.decode(testCase.params.getOrElse(Document.obj()))
.liftTo[F]
.map { decodedInput =>
assert.eql(foundInput, decodedInput)
.attemptNarrow[NotImplementedError]
yisraelU marked this conversation as resolved.
Show resolved Hide resolved
.flatMap {
case Left(_) =>
ce.timeout(inputDeferred.get, 1.second).flatMap {
foundInput =>
inputFromDocument
.decode(testCase.params.getOrElse(Document.obj()))
.liftTo[F]
.map { decodedInput =>
assert.eql(foundInput, decodedInput)
}
}
case Right(response) =>
response.body.compile.toVector.map { message =>
assert.fail(
s"Expected a NotImplementedError, but got a response with status ${response.status} and message ${message
.map(_.toChar)
.mkString}"
)
}
}
}
}
}
)

}

private[compliancetests] def serverResponseTest[I, E, O, SE, SO](
Expand Down