Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow RunAndCheckMojoTestBase subclasses to override how much memory extension tests are allowed #38818

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading