Skip to content

Commit

Permalink
Merge pull request quarkusio#44499 from brunobat/test-reliability
Browse files Browse the repository at this point in the history
Improve test reliability II
  • Loading branch information
radcortez authored Nov 14, 2024
2 parents 30f25fb + 73b1e5c commit 07041d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ private static boolean isPathFound(String path, Attributes attributes) {
return value.toString().equals(path);
}

public void assertCount(final int count) {
Awaitility.await().atMost(5, SECONDS)
.untilAsserted(() -> Assertions.assertEquals(count, getFinishedMetricItems().size()));
}

public void assertCount(final String name, final String target, final int count) {
Awaitility.await().atMost(5, SECONDS)
.untilAsserted(() -> Assertions.assertEquals(count, getFinishedMetricItems(name, target).size()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ void collectsHttpRouteFromEndAttributes() {
.statusCode(INTERNAL_SERVER_ERROR.getStatusCode());

metricExporter.assertCountPointsAtLeast("http.server.request.duration", null, 2);
MetricData metric = metricExporter.getFinishedMetricItems("http.server.request.duration", null).get(0);
MetricData metric = metricExporter
.getFinishedMetricItems("http.server.request.duration", null).stream()
.reduce((first, second) -> second) // get the last received
.orElse(null);

assertThat(metric)
.hasName("http.server.request.duration")
Expand Down

0 comments on commit 07041d3

Please sign in to comment.