Skip to content

Commit

Permalink
Merge pull request #38818 from holly-cummins/configurable-test-memory
Browse files Browse the repository at this point in the history
Allow `RunAndCheckMojoTestBase` subclasses to override how much memory extension tests are allowed
  • Loading branch information
aloubyansky authored Feb 16, 2024
2 parents 234e0e9 + 554bb02 commit 9ace5ba
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 9ace5ba

Please sign in to comment.