Skip to content

Commit

Permalink
Add debug port for testcontainers
Browse files Browse the repository at this point in the history
  • Loading branch information
kifj committed Apr 29, 2024
1 parent 39ac9bf commit a0f8462
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion etc/k8s/activemq-artemis-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: activemq-artemis
namespace: activemq-artemis
spec:
replicas: 1
replicas: 0
selector:
matchLabels:
deployment: activemq-artemis
Expand Down
12 changes: 0 additions & 12 deletions etc/k8s/stomp-test-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ spec:
- hosts:
- stomp-test.k8s.x1
secretName: pki-wildfly-secret
- hosts:
- activemq-artemis.k8s.x1
secretName: pki-activemq-artemis-secret
rules:
- host: stomp-test.k8s.x1
http:
Expand All @@ -29,13 +26,4 @@ spec:
name: wildfly
port:
name: https
- host: activemq-artemis.k8s.x1
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: activemq-artemis
port:
name: http
3 changes: 2 additions & 1 deletion src/test/java/x1/arquillian/Containers.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public final class Containers implements ArquillianTestContainers {
"--listen-client-urls", "http://0.0.0.0:2379", "--advertise-client-urls", "http://etcd:2379");

private final WildflyContainer wildfly = new WildflyContainer("registry.x1/j7beck/x1-wildfly-stomp-test-it:1.8")
.dependsOn(database).dependsOn(etcd).withNetwork(network).withEnv("wildfly-testcontainers.properties");
.dependsOn(database).dependsOn(etcd).withNetwork(network).withEnv("wildfly-testcontainers.properties")
.withRemoteDebug();

@Override
public List<GenericContainer<?>> instances() {
Expand Down
15 changes: 13 additions & 2 deletions src/test/java/x1/arquillian/WildflyContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public class WildflyContainer extends GenericContainer<WildflyContainer> {

private static final int HTTP_PORT = 8080;
private static final int MGMT_PORT = 9990;
private static final int DEBUG_PORT = 8787;

public WildflyContainer() {
this("registry.x1/j7beck/x1-wildfly-profile:31.0.1.Final");
this("registry.x1/j7beck/x1-wildfly-profile:32.0.0.Final");
}

public WildflyContainer(String image) {
Expand Down Expand Up @@ -72,7 +73,17 @@ public WildflyContainer withConfigurationDirectory(String directory) {
}
return self();
}


public WildflyContainer withRemoteDebug() {
if (Boolean.getBoolean("arquillian.remote.debug")) {
LOGGER.info("Enable remote debugging on port {}", DEBUG_PORT);
addFixedExposedPort(DEBUG_PORT, DEBUG_PORT);
withEnv("JAVA_OPTS",
"-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -XX:+UseG1GC -XX:+UseStringDeduplication -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=*:8787,server=y,suspend=n");
}
return this;
}

public void configureAfterStart(ContainerRegistry registry) {
var arquillianContainer = registry.getContainers().getFirst();
var containerConfiguration = arquillianContainer.getContainerConfiguration();
Expand Down

0 comments on commit a0f8462

Please sign in to comment.