Skip to content

Commit

Permalink
Fix the Keycloak memory issue on Podman setting JAVA_OPTS_APPEND -XX:…
Browse files Browse the repository at this point in the history
…MaxRAM=1g
  • Loading branch information
jcarranzan authored and rsvoboda committed Oct 31, 2024
1 parent 5e7253b commit e45d602
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkus.test.services.containers;

import java.util.Optional;

import org.apache.commons.lang3.StringUtils;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
Expand Down Expand Up @@ -40,8 +38,10 @@ protected GenericContainer<?> initContainer() {
}

container.withCreateContainerCmdModifier(cmd -> cmd.withName(DockerUtils.generateDockerContainerName()));
container.withCreateContainerCmdModifier(cmd -> Optional.ofNullable(cmd.getHostConfig())
.ifPresent(config -> config.withMemory(convertMiBtoBytes(model.getMemoryLimitMiB()))));

// Currently, we can't properly set the container's memory limit when running with Podman.
// More details on this issue can be found here: https://github.com/quarkus-qe/quarkus-test-suite/issues/2106
container.withEnv("JAVA_OPTS_APPEND", String.format("-XX:MaxRAM=%sm", model.getMemoryLimitMiB()));

if (isReusable()) {
Log.info(model.getContext().getOwner(), "Running container on Reusable mode");
Expand Down

0 comments on commit e45d602

Please sign in to comment.