Skip to content

Commit

Permalink
Fix sporadic grizzly test failure (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored May 28, 2020
1 parent 5c7e321 commit dbec1fb
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,27 @@ abstract class HttpServerTest<SERVER> extends AgentTestRunner {
@Shared
OkHttpClient client = OkHttpUtils.client()
@Shared
int port = PortUtils.randomOpenPort()
int port
@Shared
URI address = buildAddress()
URI address

URI buildAddress() {
return new URI("http://localhost:$port/")
def setupSpec() {
withRetryOnBindException({
setupSpecUnderRetry()
})
}

def setupSpec() {
def setupSpecUnderRetry() {
port = PortUtils.randomOpenPort()
address = buildAddress()
server = startServer(port)
println getClass().name + " http server started at: http://localhost:$port/"
}

URI buildAddress() {
return new URI("http://localhost:$port/")
}

abstract SERVER startServer(int port)

def cleanupSpec() {
Expand Down

0 comments on commit dbec1fb

Please sign in to comment.