Skip to content

Commit a5fe903

Browse files
authored
Try to reduce flakiness in JvmGcMetricsTest.gcTimingIsCorrectForPauseCycleCollectors() (#5996)
Signed-off-by: Johnny Lim <[email protected]>
1 parent d73e341 commit a5fe903

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

micrometer-core/src/test/java/io/micrometer/core/instrument/binder/jvm/JvmGcMetricsTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ void gcMetricsAvailableAfterGc() {
104104
// in an LTS is 17
105105
@EnabledForJreRange(min = JRE.JAVA_17)
106106
void gcTimingIsCorrectForPauseCycleCollectors() {
107+
// Try to reduce chances for GCs to happen between collecting initial values and
108+
// binding metrics.
109+
System.gc();
110+
107111
// get initial GC timing metrics from JMX, if any
108112
// GC could have happened before this test due to testing infrastructure
109113
// If it did, it will not be captured in the metrics

0 commit comments

Comments
 (0)