From 554bb02493b94bb2e2f11286f39ea93fb587c38e Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Fri, 16 Feb 2024 13:01:03 +0000 Subject: [PATCH] Allow subclasses to override how much memory extension tests are allowed --- .../io/quarkus/maven/it/RunAndCheckMojoTestBase.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test-framework/maven/src/main/java/io/quarkus/maven/it/RunAndCheckMojoTestBase.java b/test-framework/maven/src/main/java/io/quarkus/maven/it/RunAndCheckMojoTestBase.java index 5ea0c98be1315..810d934b13852 100644 --- a/test-framework/maven/src/main/java/io/quarkus/maven/it/RunAndCheckMojoTestBase.java +++ b/test-framework/maven/src/main/java/io/quarkus/maven/it/RunAndCheckMojoTestBase.java @@ -25,6 +25,7 @@ public class RunAndCheckMojoTestBase extends MojoTestBase { protected File testDir; protected DevModeClient devModeClient = new DevModeClient(getPort()); private static final int DEFAULT_PORT = 8080; + private static final int DEFAULT_MEMORY_IN_MB = 128; /** * Default to port 8080, but allow subtests to override. @@ -33,6 +34,14 @@ protected int getPort() { return DEFAULT_PORT; } + /** + * Default to quite constrained memory, but allow subclasses to override, for hungrier tests. + */ + + protected int getAllowedHeapInMb() { + return DEFAULT_MEMORY_IN_MB; + } + @AfterEach public void cleanup() { shutdownTheApp(); @@ -101,7 +110,7 @@ protected void run(boolean performCompile, LaunchMode mode, boolean skipAnalytic //running at once, if they add default to 75% of total mem we can easily run out //of physical memory as they will consume way more than what they need instead of //just running GC - args.add("-Djvm.args=-Xmx128m"); + args.add("-Djvm.args=-Xmx" + getAllowedHeapInMb() + "m"); running.execute(args, Map.of()); }