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

Add a skip on slow CI server flag on specs #6993

Merged
merged 2 commits into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}

}