Skip to content

Commit

Permalink
Merge pull request #210 from 17629354490/master
Browse files Browse the repository at this point in the history
bug fix: OutOfMemoryError
  • Loading branch information
gudaoxuri authored Jan 16, 2024
2 parents 20249d0 + 20a740a commit 9f42d70
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.testcontainers.containers.DockerComposeContainer;

import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;

Expand Down Expand Up @@ -38,7 +39,8 @@ public class RocketMQExtension implements BeforeAllCallback {

static {
try {
TEMP_FILE = Files.createTempFile(null, null);
Path tempDirectory = Files.createTempDirectory(String.valueOf(System.currentTimeMillis()));
TEMP_FILE = Files.createTempFile(tempDirectory, null, null);
Files.writeString(TEMP_FILE, DOCKER_COMPOSE);
} catch (IOException e) {
throw new RuntimeException(e);
Expand All @@ -52,8 +54,9 @@ public class RocketMQExtension implements BeforeAllCallback {
.withExposedService("namesrv_1", 9876);

@Override
public void beforeAll(ExtensionContext extensionContext) {
public void beforeAll(ExtensionContext extensionContext) throws Exception {
rocketmqContainer.start();
Files.deleteIfExists(TEMP_FILE);
String nameSrvUrl = rocketmqContainer.getServiceHost("namesrv_1", 9876)
+ ":" +
rocketmqContainer.getServicePort("namesrv_1", 9876);
Expand Down

0 comments on commit 9f42d70

Please sign in to comment.