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

Refactor port logic in healthcheck and tests Suite #14736

Merged
merged 1 commit into from
Oct 19, 2016

Conversation

TBonnin
Copy link
Contributor

@TBonnin TBonnin commented Oct 19, 2016

What does this change?

My original goal was to get rid of the Play.current reference into the HealthCheck code.
However I thought it would be a good time to refactor this weird logic where a port is specify to the Healthcheck, which is then used to override the OneServerPerSuite port so multiple suite don't overlap on the same port and the healthcheck is aware of this port on which it needs to run its internal check.

So now:

  • test port logic has been removed from healthcheck
  • test port is explicitly set for each test Suite
  • when testing healthcheck (1 single place), the healthcheck port is overridden with the currently running test suite port

What is the value of this and can you measure success?

  • => Play 2.5
  • Simpler code

Request for comment

@alexduf @jfsoul

protected def fetchResults(testPort: Int, healthChecks: SingleHealthCheck*): Future[Seq[HealthCheckResult]] = {
val defaultPort = 9000
val port = {
Play.current.mode match {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@TBonnin TBonnin mentioned this pull request Oct 19, 2016
23 tasks
@TBonnin TBonnin force-pushed the tbonnin-remove-play-current-healthcheck branch from 51c730b to 4004713 Compare October 19, 2016 11:33
@@ -14,7 +15,9 @@ import org.scalatest.concurrent.ScalaFutures
with WithTestWsClient {

"CDN health check" should "mimic the instance health check" in {
val controller = new HealthCheck(wsClient)
val testPort: Int = port
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for clarity or is it needed for the override to compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary, otherwise the port val in the constructor closure shadows the test port

Copy link
Contributor

@alexduf alexduf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! 👍

@TBonnin TBonnin merged commit f781c88 into master Oct 19, 2016
@TBonnin TBonnin deleted the tbonnin-remove-play-current-healthcheck branch October 19, 2016 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants