From 618fbbd94f1ab9b7e30c207970f99b5125d6f856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 24 Apr 2024 08:58:41 +0200 Subject: [PATCH] When verifying image metrics, return all failures instead of just the first one Building a native image takes a lot of time, so it's quite frustrating to iterate on this and solve errors one by one. Better have all the information upfront. --- .../nativeimage/NativeBuildOutputExtension.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/NativeBuildOutputExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/NativeBuildOutputExtension.java index 84c3e847a11a6..8d73517a359d4 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/NativeBuildOutputExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/nativeimage/NativeBuildOutputExtension.java @@ -56,15 +56,17 @@ public void verifyImageMetrics(String propertiesFileName) { Properties properties = getProperties(propertiesFileName); - properties.forEach((key, value) -> { - if (((String) key).endsWith(".tolerance")) { + Assertions.assertAll(properties.entrySet().stream().map(entry -> () -> { + var key = (String) entry.getKey(); + var value = (String) entry.getValue(); + if (key.endsWith(".tolerance")) { return; } - String[] keyParts = ((String) key).split("\\."); + String[] keyParts = key.split("\\."); String tolerance = properties.getProperty(key + ".tolerance"); assert tolerance != null : "tolerance not defined for " + key; - assertValueWithinRange(Integer.parseInt((String) value), Integer.parseInt(tolerance), keyParts); - }); + assertValueWithinRange(Integer.parseInt(value), Integer.parseInt(tolerance), keyParts); + })); } private Properties getProperties(String propertiesFileName) {