Skip to content

Commit

Permalink
Enable container re-use, so tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Aug 11, 2024
1 parent 39cc4ad commit 0644b0e
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.acme.minecrafter.deployment;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -14,21 +13,18 @@ public class MinecraftContainer extends GenericContainer<MinecraftContainer> {

public MinecraftContainer(DockerImageName image) {
super(image);

List<String> portBindings = new ArrayList<>();
portBindings.add("25565:25565"); // Make life easy for the minecraft client
setPortBindings(portBindings);
//withReuse(true);

// withExposedPorts(MINECRAFT_PORT);
// This is a bit of a cheat, since at this point the client isn't ready, but otherwise it's too slow
waitingFor(Wait.forLogMessage(".*" + "Preparing" + ".*", 1));
}


@Override
protected void configure() {
withNetwork(Network.SHARED);
List<String> portBindings = new ArrayList<>();
portBindings.add("25565:25565"); // Make life easy for the minecraft client
setPortBindings(portBindings);

withReuse(true);
addExposedPorts(OBSERVABILITY_PORT);
addExposedPorts(MINECRAFT_PORT);
}
Expand Down

0 comments on commit 0644b0e

Please sign in to comment.