Comprehensive guide for running mod_cluster tests with WildFly/EAP distributions.
- Quick Start
- Using WildFly Distributions
- Using EAP Distributions
- Test Execution Modes
- Balancer Types
- Troubleshooting
# 1. Place WildFly/EAP ZIP (optional but recommended)
# The SAME ZIP is used for both workers and undertow balancer!
cp ~/Downloads/wildfly-39.0.1.Final.zip distributions/
# 2. Check prerequisites (optional)
./setup.sh
# 3. Run tests (Docker images are built automatically on first run)
mvn testWhat ./setup.sh does:
- ✓ Checks Java, Maven, Docker/Podman
- ✓ Finds ZIPs in
distributions/
Docker images are built automatically by the test framework on first run (and cached for subsequent runs).
Note: When you provide a ZIP, it's used for both:
- Workers - WildFly/EAP instances serving applications
- Undertow balancer - Same WildFly/EAP, but configured as a load balancer
This ensures version consistency between workers and balancer!
# Download WildFly 31 (latest stable)
cd distributions/
wget https://github.com/wildfly/wildfly/releases/download/31.0.1.Final/wildfly-31.0.1.Final.zip
cd ..
# Run tests
mvn test# Test with WildFly 31
mvn test -Dwildfly.zip.path=distributions/wildfly-31.0.1.Final.zip
# Test with WildFly 30
mvn test -Dwildfly.zip.path=distributions/wildfly-30.0.1.Final.zipEAP requires Red Hat credentials. Download from: https://access.redhat.com/jbossnetwork/restricted/listSoftware.html
# After downloading EAP 8.0
cp ~/Downloads/jboss-eap-8.0.0.zip distributions/
# Run tests
mvn testSupported EAP versions:
- EAP 8.x - Based on WildFly 30+ (Jakarta EE 10)
# Test with EAP 8
mvn test -Dwildfly.zip.path=distributions/jboss-eap-8.0.0.zipPlace ZIP in distributions/ - automatically detected:
cp ~/Downloads/wildfly-31.0.1.Final.zip distributions/
mvn testSpecify exact ZIP location:
mvn test -Dwildfly.zip.path=/opt/distributions/wildfly-31.0.1.Final.zipGood for CI/CD:
export WILDFLY_ZIP_PATH=/opt/distributions/jboss-eap-8.0.0.zip
mvn testForce a specific Java version instead of auto-detection:
# Force Java 17
mvn test -Dcontainer.java.version=17
# Useful for custom builds
mvn test -Dwildfly.zip.path=/path/to/custom-wildfly.zip -Dcontainer.java.version=17When to use:
- Custom WildFly builds
- Non-standard ZIP file names
- Testing compatibility with different Java versions
- Troubleshooting Java version issues
No ZIP provided — attempts to pull pre-built images. Note: the default quay.io/modcluster/ images are placeholders that do not exist yet. Provide a ZIP or override with your own images.
mvn test -Dwildfly.version=31.0.1.Final# Explicit undertow profile
mvn test -Pundertow
# Via property
mvn test -Dbalancer.type=undertow# Using httpd profile
mvn test -Phttpd
# Via property
mvn test -Dbalancer.type=httpd# Custom undertow
mvn test -Dbalancer.undertow.image=my-registry.com/undertow:1.0
# Custom httpd
mvn test -Phttpd -Dbalancer.httpd.image=my-registry.com/httpd:2.4mvn test -Dtest=StickySessionTestmvn test -Dtest=StickySessionTest#testStickySessionsMaintainedAcrossRequests# All failover tests
mvn test -Dtest=org.jboss.modcluster.test.failover.*
# All SSL tests
mvn test -Dtest=org.jboss.modcluster.test.ssl.*mvn test -Dtest=StickySessionTest,SSLTest,LoadBalancingGroupFailoverTest# Test with both balancers
mvn test -Pundertow && mvn test -Phttpd# Run in parallel
mvn test -Pundertow & mvn test -Phttpd & wait#!/bin/bash
for balancer in undertow httpd; do
echo "Testing with $balancer..."
mvn test -P$balancer
mv target/surefire-reports target/surefire-reports-$balancer
donemvn test -Dlogback.configurationFile=src/test/resources/logback-debug.xmlSpeed up development by reusing containers:
# In src/test/resources/testcontainers.properties
testcontainers.reuse.enable=true
# Run tests
mvn test// In WildFlyContainer.java, modify:
.waitingFor(Wait.forLogMessage(".*WFLYSRV0025.*", 1)
.withStartupTimeout(Duration.ofMinutes(5))) // Increase for slow systemsError: No ZIP distribution found
Solution:
# Check distributions directory
ls -la distributions/
# Verify ZIP exists
ls -la distributions/*.zip
# Use explicit path
mvn test -Dwildfly.zip.path=/full/path/to/wildfly.zipError building container from ZIP
Solutions:
-
Check ZIP integrity:
unzip -t distributions/wildfly-31.0.1.Final.zip
-
Increase Docker memory:
- Docker Desktop → Settings → Resources → Memory (at least 4GB)
-
Clean Docker cache:
docker system prune -a
Container did not start within timeout
Solutions:
-
Check Docker logs:
docker logs <container-id>
-
Increase timeout (see Advanced Configuration above)
-
Check system resources:
docker stats
Solutions:
-
Disable container reuse:
mvn test -Dtestcontainers.reuse.enable=false -
Run sequentially (not parallel):
mvn test -DforkCount=1 -
Increase wait times in test code using Awaitility
Error: Permission denied accessing Docker socket
Solution:
# Add user to docker group
sudo usermod -aG docker $USER
newgrp docker
# Or use sudo (not recommended for regular use)
sudo mvn testError: Cannot connect to Podman socket
Solution:
# Enable Podman socket
systemctl --user enable --now podman.socket
# Set environment variable
export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock
# Or create symlink
sudo ln -s /run/user/$(id -u)/podman/podman.sock /var/run/docker.sock- Use container reuse (development only)
- Run specific tests instead of full suite
- Keep distributions/ on fast storage (SSD, not network drive)
- Use local Docker registry for frequently used images
- Cache Maven dependencies (configured in GitHub Actions workflow)
- Parallel matrix builds (configured via strategy matrix)
- Prune containers after tests
mvn test -X # Maven debug mode# Test output
cat target/surefire-reports/*.txt
# Container logs (while running)
docker ps # Get container ID
docker logs <container-id>- Maven output: Console
- Test results:
target/surefire-reports/ - Container logs: Via Docker/Podman
- Application logs: Inside containers at
/opt/wildfly/standalone/log/
- ✅ Run setup.sh to verify prerequisites before first test run
- ✅ Use specific ZIP paths in CI/CD for reproducibility
- ✅ Clean distributions/ when switching major versions
- ✅ Keep only one ZIP in distributions/ for auto-detection
- ✅ Disable container reuse in CI/CD
- ✅ Use soft assertions for multiple checks per test
- ✅ Check container logs when debugging failures
- ❌ Don't commit ZIPs to git (large files)
- ❌ Don't use container reuse in CI (causes flakiness)
For the fastest local iteration, enable Testcontainers reuse:
# In src/test/resources/testcontainers.properties
testcontainers.reuse.enable=trueWith reuse enabled, containers stay running between test runs. The first run starts containers normally, but subsequent runs reuse them — reducing startup from minutes to seconds.
Important: Stop containers manually when done: docker stop $(docker ps -aq)
Don't run the full suite during development:
# Single test class
mvn test -Dtest=StickySessionTest
# Single test method
mvn test -Dtest=StickySessionTest#testStickySessionsMaintainedAcrossRequests
# Package
mvn test -Dtest=org.jboss.modcluster.test.failover.*