Hi!
I have problem with creating Solace container via testcontainers plugin. Exception which appear:
09:15:15.486 [main] ERROR ? [solace:1.0.0] - Could not start container
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [51600, 51601, 51492, 51493, 51494, 51495, 51596, 51597, 51599] should be listening)
Below full log:
Also here is my class for Solace container:
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;
import java.util.Arrays;
public class PubSubPlusContainer extends GenericContainer {
private String adminUsername;
private String adminPassword;
public static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse(“solace/solace-pubsub-standard”);
public static final String DEFAULT_IMAGE_TAG = “latest”;
private static final String DEFAULT_ADMIN_USERNAME = “admin”;
private static final String DEFAULT_ADMIN_PASSWORD = “admin”;
private static final String DEFAULT_MAX_CONNECTION_COUNT = “100”;
private static final long DEFAULT_SHM_SIZE = (long) Math.pow(1024, 3); // 1 GB
public PubSubPlusContainer() {
this(DEFAULT_IMAGE_NAME.withTag(DEFAULT_IMAGE_TAG));
}
public PubSubPlusContainer(String dockerImageName) {
this(DockerImageName.parse(dockerImageName));
}
public PubSubPlusContainer(DockerImageName dockerImageName) {
super(dockerImageName);
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);
this.withExposedPorts(Arrays.stream(Port.values()).map(Port::getInternalPort).toArray(Integer::new));
this.withAdminUsername(DEFAULT_ADMIN_USERNAME);
this.withAdminPassword(DEFAULT_ADMIN_PASSWORD);
this.withMaxConnectionCount(DEFAULT_MAX_CONNECTION_COUNT);
this.withSharedMemorySize(DEFAULT_SHM_SIZE);
this.waitingFor(Wait.forListeningPort());
}
public String getAdminUsername() {
return adminUsername;
}
public String getAdminPassword() {
return adminPassword;
}
public String getOrigin(Port port) {
if (port.getProtocol() == null) {
throw new IllegalArgumentException(String.format(“Getting origin of port %s is not supported”, port.name()));
}
return String.format(“%s://%s:%s”, port.getProtocol(), getContainerIpAddress(),
getMappedPort(port.getInternalPort()));
}
public Integer getSshPort() {
return getMappedPort(Port.SSH.getInternalPort());
}
public PubSubPlusContainer withAdminUsername(String username) {
adminUsername = username;
return withEnv(“username_admin_globalaccesslevel”, adminUsername);
}
public PubSubPlusContainer withAdminPassword(String password) {
adminPassword = password;
return withEnv(“username_admin_password”, password);
}
public PubSubPlusContainer withMaxConnectionCount(String maxConnectionCount) {
return withEnv(“system_scaling_maxconnectioncount”, maxConnectionCount);
}
public enum Port {
AMQP(5672, “amqp”),
MQTT(1883, “tcp”),
MQTT_WEB(8000, “ws”),
REST(9000, “http”),
SEMP(8080, “http”),
SMF(55555, “tcp”),
SMF_TLS(55443, “tcps”),
SMF_WEB(8008, “ws”),
SSH(2222, null);
private final int containerPort;
private final String protocol;
Port(int containerPort, String protocol) {
this.containerPort = containerPort;
this.protocol = protocol;
}
public int getInternalPort() {
return containerPort;
}
private String getProtocol() {
return protocol;
}
}
}
I contact testcontainers team, but they responded that I need to try contact Solace whether I’m using correctly that image “solace/solace-pubsub-standard”. Could somebody help me?
logs.txt (42.6 KB)