Skip to content

Commit 234e741

Browse files
committed
Fix Jersey test by waiting for metrics
For some reason metrics are not always being recorded before the check runs when a full build is running. Adding a sleep seems to "solve" the problem. See gh-45483 See gh-45404
1 parent 69fb56a commit 234e741

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfigurationTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -82,6 +82,7 @@ void shouldProvideAllNecessaryBeans() {
8282
void httpRequestsAreTimed() {
8383
this.webContextRunner.run((context) -> {
8484
doRequest(context);
85+
Thread.sleep(500);
8586
MeterRegistry registry = context.getBean(MeterRegistry.class);
8687
Timer timer = registry.get("http.server.requests").tag("uri", "/users/{id}").timer();
8788
assertThat(timer.count()).isOne();

0 commit comments

Comments
 (0)