Fix flaky ratpack http client test (#8881)

This commit is contained in:
Lauri Tulmin 2023-07-06 14:17:04 +03:00 committed by GitHub
parent d701967f2d
commit 40938cf9e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 69 additions and 67 deletions

View File

@ -86,8 +86,7 @@ class InstrumentedHttpClientTest extends Specification {
} }
app.test { httpClient -> app.test { httpClient ->
"bar" == httpClient.get("foo").body.text assert "bar" == httpClient.get("foo").body.text
}
new PollingConditions().eventually { new PollingConditions().eventually {
def spanData = spanExporter.finishedSpanItems.find { it.name == "GET /foo" } def spanData = spanExporter.finishedSpanItems.find { it.name == "GET /foo" }
@ -117,6 +116,7 @@ class InstrumentedHttpClientTest extends Specification {
attsApi[HTTP_STATUS_CODE] == 200L attsApi[HTTP_STATUS_CODE] == 200L
} }
} }
}
def "add spans for multiple concurrent client calls"() { def "add spans for multiple concurrent client calls"() {
expect: expect:
@ -148,9 +148,8 @@ class InstrumentedHttpClientTest extends Specification {
} }
app.test { httpClient -> app.test { httpClient ->
"hello" == httpClient.get("path-name").body.text assert "hello" == httpClient.get("path-name").body.text
latch.await(1, TimeUnit.SECONDS) latch.await(1, TimeUnit.SECONDS)
}
new PollingConditions().eventually { new PollingConditions().eventually {
spanExporter.finishedSpanItems.size() == 3 spanExporter.finishedSpanItems.size() == 3
@ -182,6 +181,7 @@ class InstrumentedHttpClientTest extends Specification {
attributes[HTTP_STATUS_CODE] == 200L attributes[HTTP_STATUS_CODE] == 200L
} }
} }
}
def "handling exception errors in http client"() { def "handling exception errors in http client"() {
expect: expect:
@ -214,7 +214,8 @@ class InstrumentedHttpClientTest extends Specification {
} }
} }
app.test { httpClient -> "error" == httpClient.get("path-name").body.text } app.test { httpClient ->
assert "error" == httpClient.get("path-name").body.text
new PollingConditions().eventually { new PollingConditions().eventually {
def spanData = spanExporter.finishedSpanItems.find { it.name == "GET /path-name" } def spanData = spanExporter.finishedSpanItems.find { it.name == "GET /path-name" }
@ -238,6 +239,7 @@ class InstrumentedHttpClientTest extends Specification {
attributes[HTTP_STATUS_CODE] == 200L attributes[HTTP_STATUS_CODE] == 200L
} }
} }
}
def "propagate http trace in ratpack services with compute thread"() { def "propagate http trace in ratpack services with compute thread"() {
expect: expect: