Browse Source

make test-basic-native

adding-message-queue-integration-tests
chrislu 5 months ago
parent
commit
46602a229c
  1. 48
      test/mq/Makefile
  2. 32
      test/mq/docker-compose.test.yml

48
test/mq/Makefile

@ -1,9 +1,15 @@
.PHONY: help build test test-basic test-performance test-failover test-agent clean up down logs
# Detect architecture
# Detect architecture and Docker platform compatibility
ARCH := $(shell uname -m)
OS := $(shell uname -s)
ifeq ($(ARCH),arm64)
DOCKER_PLATFORM := linux/arm64
ifeq ($(OS),Darwin)
# On Apple Silicon macOS, use native arm64 for better performance
DOCKER_PLATFORM := linux/arm64
else
DOCKER_PLATFORM := linux/arm64
endif
else
DOCKER_PLATFORM := linux/amd64
endif
@ -14,8 +20,10 @@ help:
@echo ""
@echo "Available targets:"
@echo " build - Build SeaweedFS Docker images"
@echo " test - Run all integration tests"
@echo " test-basic - Run basic pub/sub tests"
@echo " test - Run all integration tests (in Docker)"
@echo " test-basic - Run basic pub/sub tests (in Docker)"
@echo " test-native - Run all tests natively (no Docker test container)"
@echo " test-basic-native - Run basic tests natively (recommended for Apple Silicon)"
@echo " test-performance - Run performance tests"
@echo " test-failover - Run failover tests"
@echo " test-agent - Run agent tests"
@ -28,10 +36,10 @@ help:
# Build SeaweedFS Docker images
build:
@echo "Building SeaweedFS Docker image..."
cd ../.. && docker build --platform linux/arm64 -f docker/Dockerfile.go_build -t chrislusf/seaweedfs:local .
@echo "Building test runner image..."
cd ../.. && docker build --platform linux/arm64 -f test/mq/Dockerfile.test -t seaweedfs-test-runner .
@echo "Building SeaweedFS Docker image for $(DOCKER_PLATFORM)..."
cd ../.. && docker build --platform $(DOCKER_PLATFORM) -f docker/Dockerfile.go_build -t chrislusf/seaweedfs:local .
@echo "Building test runner image for $(DOCKER_PLATFORM)..."
cd ../.. && docker build --platform $(DOCKER_PLATFORM) -f test/mq/Dockerfile.test -t seaweedfs-test-runner .
# Start the test environment
up: build
@ -69,8 +77,8 @@ up-prod: build-test-runner
# Build only the test runner image (for production setup)
build-test-runner:
@echo "Building test runner image..."
cd ../.. && docker build --platform linux/arm64 -f test/mq/Dockerfile.test -t seaweedfs-test-runner .
@echo "Building test runner image for $(DOCKER_PLATFORM)..."
cd ../.. && docker build --platform $(DOCKER_PLATFORM) -f test/mq/Dockerfile.test -t seaweedfs-test-runner .
# Start cluster only (no test runner, no build required)
up-cluster:
@ -140,14 +148,30 @@ test-agent: up
docker-compose -f docker-compose.test.yml run --rm test-runner \
sh -c "go test -v -timeout=10m ./test/mq/integration/ -run TestAgent"
# Development targets
test-dev:
# Development targets (run tests natively without Docker container)
test-dev: up-cluster
@echo "Running tests in development mode (using local binaries)..."
SEAWEED_MASTERS="localhost:19333,localhost:19334,localhost:19335" \
SEAWEED_BROKERS="localhost:17777,localhost:17778,localhost:17779" \
SEAWEED_FILERS="localhost:18888,localhost:18889" \
go test -v -timeout=10m ./integration/...
# Native test running (no Docker container for tests)
test-native: up
@echo "Running tests natively (without Docker container for tests)..."
cd ../.. && SEAWEED_MASTERS="localhost:19333,localhost:19334,localhost:19335" \
SEAWEED_BROKERS="localhost:17777,localhost:17778,localhost:17779" \
SEAWEED_FILERS="localhost:18888,localhost:18889" \
go test -v -timeout=10m ./test/mq/integration/...
# Basic native tests
test-basic-native: up
@echo "Running basic tests natively..."
cd ../.. && SEAWEED_MASTERS="localhost:19333,localhost:19334,localhost:19335" \
SEAWEED_BROKERS="localhost:17777,localhost:17778,localhost:17779" \
SEAWEED_FILERS="localhost:18888,localhost:18889" \
go test -v -timeout=10m ./test/mq/integration/ -run TestBasic
# Quick smoke test
smoke-test: up
@echo "Running smoke test..."

32
test/mq/docker-compose.test.yml

@ -82,8 +82,11 @@ services:
ports:
- "18080:8080"
- "28080:18080"
volumes:
- volume1-data:/data/volume1
entrypoint: ["/bin/sh", "-c"]
command: >
-v=1
"mkdir -p /data/volume1 && exec weed -v=1
volume
-dataCenter=dc1
-rack=rack1
@ -92,7 +95,7 @@ services:
-ip=volume1
-publicUrl=localhost:18080
-preStopSeconds=1
-dir=/tmp/volume1
-dir=/data/volume1"
networks:
- seaweedmq-test
depends_on:
@ -105,8 +108,11 @@ services:
ports:
- "18081:8081"
- "28081:18081"
volumes:
- volume2-data:/data/volume2
entrypoint: ["/bin/sh", "-c"]
command: >
-v=1
"mkdir -p /data/volume2 && exec weed -v=1
volume
-dataCenter=dc1
-rack=rack2
@ -115,7 +121,7 @@ services:
-ip=volume2
-publicUrl=localhost:18081
-preStopSeconds=1
-dir=/tmp/volume2
-dir=/data/volume2"
networks:
- seaweedmq-test
depends_on:
@ -128,8 +134,11 @@ services:
ports:
- "18082:8082"
- "28082:18082"
volumes:
- volume3-data:/data/volume3
entrypoint: ["/bin/sh", "-c"]
command: >
-v=1
"mkdir -p /data/volume3 && exec weed -v=1
volume
-dataCenter=dc2
-rack=rack1
@ -138,7 +147,7 @@ services:
-ip=volume3
-publicUrl=localhost:18082
-preStopSeconds=1
-dir=/tmp/volume3
-dir=/data/volume3"
networks:
- seaweedmq-test
depends_on:
@ -204,7 +213,7 @@ services:
mq.broker
-master=master0:9333,master1:9334,master2:9335
-port=17777
-ip=broker1
-ip=localhost
-dataCenter=dc1
-rack=rack1
networks:
@ -228,7 +237,7 @@ services:
mq.broker
-master=master0:9333,master1:9334,master2:9335
-port=17778
-ip=broker2
-ip=localhost
-dataCenter=dc1
-rack=rack2
networks:
@ -247,7 +256,7 @@ services:
mq.broker
-master=master0:9333,master1:9334,master2:9335
-port=17779
-ip=broker3
-ip=localhost
-dataCenter=dc2
-rack=rack1
networks:
@ -328,4 +337,7 @@ networks:
- subnet: 172.20.0.0/16
volumes:
grafana-storage:
grafana-storage:
volume1-data:
volume2-data:
volume3-data:
Loading…
Cancel
Save