From 7f93c786b70cf38d22db2a10f4e52db4b026b499 Mon Sep 17 00:00:00 2001 From: MishaDemianenko Date: Sat, 8 Sep 2018 17:51:40 +0200 Subject: [PATCH] Update eventual condition in ServerMetricsIT. --- .../functional/ServerMetricsIT.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/enterprise/server-enterprise/src/test/java/org/neo4j/server/enterprise/functional/ServerMetricsIT.java b/enterprise/server-enterprise/src/test/java/org/neo4j/server/enterprise/functional/ServerMetricsIT.java index c5ea18ac92280..041bf39c4a4e3 100644 --- a/enterprise/server-enterprise/src/test/java/org/neo4j/server/enterprise/functional/ServerMetricsIT.java +++ b/enterprise/server-enterprise/src/test/java/org/neo4j/server/enterprise/functional/ServerMetricsIT.java @@ -29,6 +29,7 @@ import java.io.File; import java.io.IOException; +import java.io.UncheckedIOException; import java.util.concurrent.TimeUnit; import org.neo4j.metrics.MetricsSettings; @@ -91,10 +92,21 @@ public void shouldShowServerMetrics() throws Throwable } } - private static void assertMetricsExists( File metricsPath, String meticsName ) throws IOException, InterruptedException + private static void assertMetricsExists( File metricsPath, String metricsName ) throws InterruptedException { - File file = metricsCsv( metricsPath, meticsName ); - long threadCount = readLongValue( file ); - assertEventually( () -> threadCount, greaterThan( 0L ), 1, TimeUnit.MINUTES ); + File file = metricsCsv( metricsPath, metricsName ); + assertEventually( () -> threadCountReader( file ), greaterThan( 0L ), 1, TimeUnit.MINUTES ); + } + + private static Long threadCountReader( File file ) throws InterruptedException + { + try + { + return readLongValue( file ); + } + catch ( IOException io ) + { + throw new UncheckedIOException( io ); + } } }