Skip to content

Commit

Permalink
added resource limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
shelajev committed Sep 23, 2024
1 parent def479e commit acc8a14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/test/java/com/testcontainers/TestMain.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.testcontainers;

import com.github.dockerjava.api.model.HostConfig;
import com.testcontainers.fun.awaitility.CloudflaredContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
Expand Down Expand Up @@ -50,7 +51,14 @@ public static void main(String[] args) {
.withEnv("SPRING_CLOUD_AWS_ENDPOINT", "localstack:4566")

.withNetwork(network)
.waitingFor(Wait.forHttp("/actuator/health"));
.waitingFor(Wait.forHttp("/actuator/health"))
.withCreateContainerCmdModifier(createContainerCmd -> {
var hostConfig = new HostConfig();
hostConfig.withMemory(1 * 1024L * 1024L);
hostConfig.withCpuCount(1L);
createContainerCmd.withHostConfig(hostConfig);
}
);

Startables.deepStart(postgres, kafka, localStack).join();

Expand Down

0 comments on commit acc8a14

Please sign in to comment.