From a0f846246541ad63cc106ecd4140599dff7f21df Mon Sep 17 00:00:00 2001 From: Johannes Beck Date: Mon, 29 Apr 2024 19:41:19 +0200 Subject: [PATCH] Add debug port for testcontainers --- etc/k8s/activemq-artemis-deployment.yaml | 2 +- etc/k8s/stomp-test-ingress.yaml | 12 ------------ src/test/java/x1/arquillian/Containers.java | 3 ++- src/test/java/x1/arquillian/WildflyContainer.java | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/etc/k8s/activemq-artemis-deployment.yaml b/etc/k8s/activemq-artemis-deployment.yaml index dfb75377..eb074a39 100644 --- a/etc/k8s/activemq-artemis-deployment.yaml +++ b/etc/k8s/activemq-artemis-deployment.yaml @@ -6,7 +6,7 @@ metadata: name: activemq-artemis namespace: activemq-artemis spec: - replicas: 1 + replicas: 0 selector: matchLabels: deployment: activemq-artemis diff --git a/etc/k8s/stomp-test-ingress.yaml b/etc/k8s/stomp-test-ingress.yaml index 82bc5c15..d044550b 100644 --- a/etc/k8s/stomp-test-ingress.yaml +++ b/etc/k8s/stomp-test-ingress.yaml @@ -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: @@ -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 diff --git a/src/test/java/x1/arquillian/Containers.java b/src/test/java/x1/arquillian/Containers.java index ba34c165..8c4c8bea 100644 --- a/src/test/java/x1/arquillian/Containers.java +++ b/src/test/java/x1/arquillian/Containers.java @@ -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> instances() { diff --git a/src/test/java/x1/arquillian/WildflyContainer.java b/src/test/java/x1/arquillian/WildflyContainer.java index dd02741f..f2ef9495 100644 --- a/src/test/java/x1/arquillian/WildflyContainer.java +++ b/src/test/java/x1/arquillian/WildflyContainer.java @@ -23,9 +23,10 @@ public class WildflyContainer extends GenericContainer { 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) { @@ -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();