refactor: run Spark tests fully in Docker with bridge network

Better approach than mixing host and container networks.

Changes to docker-compose.yml:
- Remove 'network_mode: host' from spark-tests container
- Add spark-tests to seaweedfs-spark bridge network
- Update SEAWEEDFS_FILER_HOST from 'localhost' to 'seaweedfs-filer'
- Add depends_on to ensure services are healthy before tests
- Update volume publicUrl from 'localhost:8080' to 'seaweedfs-volume:8080'

Changes to workflow:
- Remove separate build and test steps
- Run tests via 'docker compose up spark-tests'
- Use --abort-on-container-exit and --exit-code-from for proper exit codes
- Simpler: one step instead of two

Benefits:
✓ All components use Docker DNS (seaweedfs-master, seaweedfs-volume, seaweedfs-filer)
✓ No host/container network split or DNS resolution issues
✓ Consistent with how other SeaweedFS integration tests work
✓ Tests are fully containerized and reproducible
✓ Volume server accessible via seaweedfs-volume:8080 for all clients
✓ Automatic volume creation works (master can reach volume via gRPC)
✓ Data writes work (Spark can reach volume via Docker network)

This matches the architecture of other integration tests and is cleaner.
This commit is contained in:
chrislu
2025-11-22 23:21:12 -08:00
parent 150d084b3b
commit a481a345ac
2 changed files with 10 additions and 18 deletions
+7 -3
View File
@@ -27,7 +27,7 @@ services:
ports:
- "8080:8080"
- "18080:18080"
command: "volume -mserver=seaweedfs-master:9333 -ip=seaweedfs-volume -ip.bind=0.0.0.0 -port=8080 -port.grpc=18080 -publicUrl=localhost:8080 -max=100 -dir=/data -preStopSeconds=1"
command: "volume -mserver=seaweedfs-master:9333 -ip=seaweedfs-volume -ip.bind=0.0.0.0 -port=8080 -port.grpc=18080 -publicUrl=seaweedfs-volume:8080 -max=100 -dir=/data -preStopSeconds=1"
volumes:
- seaweedfs-volume-data:/data
depends_on:
@@ -69,18 +69,22 @@ services:
spark-tests:
image: maven:3.9-eclipse-temurin-17
container_name: seaweedfs-spark-tests
network_mode: "host"
volumes:
- .:/workspace
- ~/.m2:/root/.m2
working_dir: /workspace
environment:
- SEAWEEDFS_TEST_ENABLED=true
- SEAWEEDFS_FILER_HOST=localhost
- SEAWEEDFS_FILER_HOST=seaweedfs-filer
- SEAWEEDFS_FILER_PORT=8888
- SEAWEEDFS_FILER_GRPC_PORT=18888
- HADOOP_HOME=/tmp
command: sh -c "sleep 30 && mvn test"
depends_on:
seaweedfs-filer:
condition: service_healthy
networks:
- seaweedfs-spark
mem_limit: 4g
cpus: 2