Skip to content

Commit

Permalink
Add a skip on slow CI server flag on specs (playframework#6993)
Browse files Browse the repository at this point in the history
* Add a skip on slow CI server flag on specs

* Add another skip
  • Loading branch information
wsargent authored and Will Sargent committed Feb 23, 2017
1 parent 36f7c5c commit b8325c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ trait ServerIntegrationSpecification extends PendingUntilFixed with AroundEach {
}
}

implicit class UntilFastCIServer[T: AsResult](t: => T) {
def skipOnSlowCIServer: Result = parent match {
case _ if isContinuousIntegrationEnvironment => Skipped()
case _ => ResultExecution.execute(AsResult(t))
}
}

// There are some tests that we still want to run, but Travis CI will fail
// because the server is underpowered...
def isContinuousIntegrationEnvironment: Boolean = {
System.getenv("CONTINUOUS_INTEGRATION") == "true"
}

/**
* Override the standard TestServer factory method.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ trait HttpPipeliningSpec extends PlaySpecification with ServerIntegrationSpecifi
responses(0).body must beLeft("long")
responses(1).status must_== 200
responses(1).body must beLeft("short")
}
}.skipOnSlowCIServer

"wait for the first response body to return before returning the second" in withServer(EssentialAction { req =>
req.path match {
Expand All @@ -68,7 +68,7 @@ trait HttpPipeliningSpec extends PlaySpecification with ServerIntegrationSpecifi
responses(0).body.right.get._1 must containAllOf(Seq("chunk", "chunk", "chunk")).inOrder
responses(1).status must_== 200
responses(1).body must beLeft("short")
}
}.skipOnSlowCIServer

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ trait IdleTimeoutSpec extends PlaySpecification with ServerIntegrationSpecificat
Accumulator(Sink.ignore).map(_ => Results.Ok)
}) { port =>
doRequests(port, trickle = 400L) must throwA[SocketException]
}
}.skipOnSlowCIServer

"support a separate timeout for https" in withServer(1.second, httpsPort = Some(httpsPort), httpsTimeout = 400.millis)(EssentialAction { req =>
Accumulator(Sink.ignore).map(_ => Results.Ok)
Expand All @@ -77,13 +77,13 @@ trait IdleTimeoutSpec extends PlaySpecification with ServerIntegrationSpecificat
responses(1).status must_== 200

doRequests(httpsPort, trickle = 600L, secure = true) must throwA[SocketException]
}
}.skipOnSlowCIServer

"support multi-second timeouts" in withServer(1500.millis)(EssentialAction { req =>
Accumulator(Sink.ignore).map(_ => Results.Ok)
}) { port =>
doRequests(port, trickle = 1600L) must throwA[SocketException]
}
}.skipOnSlowCIServer

"not timeout for slow requests with a sub-second timeout" in withServer(700.millis)(EssentialAction { req =>
Accumulator(Sink.ignore).map(_ => Results.Ok)
Expand All @@ -92,7 +92,7 @@ trait IdleTimeoutSpec extends PlaySpecification with ServerIntegrationSpecificat
responses.length must_== 2
responses(0).status must_== 200
responses(1).status must_== 200
}
}.skipOnSlowCIServer

"not timeout for slow requests with a multi-second timeout" in withServer(1500.millis)(EssentialAction { req =>
Accumulator(Sink.ignore).map(_ => Results.Ok)
Expand All @@ -101,7 +101,7 @@ trait IdleTimeoutSpec extends PlaySpecification with ServerIntegrationSpecificat
responses.length must_== 2
responses(0).status must_== 200
responses(1).status must_== 200
}
}.skipOnSlowCIServer
}

}

0 comments on commit b8325c7

Please sign in to comment.