Convert ratpack 1.7 tests from groovy to java#12980
Conversation
| @Test | ||
| void testIgnoreHandlersBeforeOpenTelemetryServerHandler() { | ||
| assertThat(app.getHttpClient().get("ignore").getBody().getText()).isEqualTo("ignored"); | ||
| assertThat(testing.spans().stream().filter(span -> "GET /ignore".equals(span.getName()))) |
There was a problem hiding this comment.
In the groovy test we retry until this condition becomes true, here we assume that we already have the completed spans. Mayabe here we should also use awaitility to retry to ensure this test won't be flaky or rewrite to use testing.waitAndAssertTraces that also retries.
|
|
||
| @Test | ||
| void testIgnoreHandlersBeforeOpenTelemetryServerHandler() { | ||
| assertThat(app.getHttpClient().get("ignore").getBody().getText()).isEqualTo("ignored"); |
There was a problem hiding this comment.
original groovy test uses app.test(). I think it should be fine to not use it. The difference between groovy and java version is that in groovy version app = new RatpackFunctionalTest(RatpackApp) is run for each test and the app.test calls close on the app when the test completes. In the java version app is created once for all tests and close is not called. We could close it in a @AfterAll cleanup method.
| span.hasName("another-span") | ||
| .hasParent(trace.getSpan(0)) | ||
| .hasAttributes(Attributes.empty()) | ||
| .hasTotalRecordedEvents(1))); |
There was a problem hiding this comment.
could use hasEventsSatisfyingExactly
Related to #7195