Skip to content

Commit

Permalink
Allow subclasses to override how much memory extension tests are allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Feb 16, 2024
1 parent 1092bbc commit 554bb02
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit 554bb02

Please sign in to comment.