Skip to content

Add integration tests for Hilla support #219

@heruan

Description

@heruan

Now that we have a Hilla module for backend and frontend observability, we need to verify that data is exported correctly.

We can approach this in the same way we did for flow, using the OTLP exported and a MockServer instance:

@ExtendWith(MockServerExtension.class)
@MockServerSettings(ports = { MainViewIT.EXPORTER_ENDPOINT_PORT })
public class MainViewIT extends AbstractViewIT {
static final int EXPORTER_ENDPOINT_PORT = 4318;
private static final int AWAIT_TIMEOUT = 15;
private ClientAndServer collector;
@BeforeEach
public void navigateToView(ClientAndServer collector) throws Exception {
this.collector = collector;
this.collector.when(request()).respond(response().withStatusCode(200));
// Wait for the view to be rendered
waitUntil(driver -> $(H1Element.class).exists());
}
@BrowserTest
public void verifyExportedTraces() {
await().atMost(AWAIT_TIMEOUT, TimeUnit.SECONDS).untilAsserted(() -> {
var requests = collector.retrieveRecordedRequests(request());
var spans = extractSpansFromRequests(requests);
assertThat(spans).extracting(Span::getName)
.contains("SessionRequestHandler.handleRequest");
});
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions