diff --git a/test/s3/copying/Makefile b/test/s3/copying/Makefile index 1a5c98c01..afc510b67 100644 --- a/test/s3/copying/Makefile +++ b/test/s3/copying/Makefile @@ -65,24 +65,13 @@ start-seaweedfs: check-binary @pkill -f "weed s3" || true @pkill -f "weed mini" || true @sleep 2 - - # Create necessary directories @mkdir -p /tmp/seaweedfs-test-copying - - # Start weed mini @echo "Starting weed mini with dir=/tmp/seaweedfs-test-copying" - @export AWS_ACCESS_KEY_ID=$(ACCESS_KEY) && \ - export AWS_SECRET_ACCESS_KEY=$(SECRET_KEY) && \ - # Start weed mini with S3 configuration - @echo "Starting weed mini..." - @nohup $(SEAWEEDFS_BINARY) mini \ - -dir=/tmp/seaweedfs-test-copying \ - -s3.port=$(S3_PORT) \ - -s3.config=/tmp/seaweedfs-s3.json \ - -ip=127.0.0.1 \ - > /tmp/seaweedfs-mini.log 2>&1 & echo $$! > /tmp/weed-mini.pid 5 - - # Wait for S3 service to be ready + @AWS_ACCESS_KEY_ID=$(ACCESS_KEY) AWS_SECRET_ACCESS_KEY=$(SECRET_KEY) nohup $(SEAWEEDFS_BINARY) mini \ + -dir=/tmp/seaweedfs-test-copying \ + -s3.port=$(S3_PORT) \ + -ip=127.0.0.1 \ + > /tmp/seaweedfs-mini.log 2>&1 & echo $$! > /tmp/weed-mini.pid @echo "$(YELLOW)Waiting for S3 service to be ready...$(NC)" @for i in $$(seq 1 30); do \ if curl -s -f http://127.0.0.1:$(S3_PORT) > /dev/null 2>&1; then \ @@ -92,10 +81,8 @@ start-seaweedfs: check-binary echo "Waiting for S3 service... ($$i/30)"; \ sleep 1; \ done - # Additional wait for filer gRPC to be ready - @echo "$(YELLOW)Waiting for filer gRPC to be ready...$(NC)" - @sleep 2 - @echo "$(GREEN)SeaweedFS server started successfully$(NC)" + @sleep 2 + @echo "$(GREEN)SeaweedFS server started successfully$(NC)" @echo "Mini Log: /tmp/seaweedfs-mini.log" @echo "S3: http://localhost:$(S3_PORT)" @@ -105,7 +92,9 @@ stop-seaweedfs: @pkill -f "weed volume" || true @pkill -f "weed filer" || true @pkill -f "weed s3" || true + @pkill -f "weed mini" || true @sleep 2 + @rm -f /tmp/weed-mini.pid @echo "$(GREEN)SeaweedFS server stopped$(NC)" clean: @@ -113,6 +102,7 @@ clean: @rm -rf /tmp/seaweedfs-test-copying-* @rm -f /tmp/seaweedfs-*.log @rm -f /tmp/seaweedfs-s3.json + @rm -f /tmp/weed-mini.pid @echo "$(GREEN)Cleanup completed$(NC)" test-basic: check-binary diff --git a/test/s3/copying/s3_copying_test.go b/test/s3/copying/s3_copying_test.go index 4bad01de4..6b46f6802 100644 --- a/test/s3/copying/s3_copying_test.go +++ b/test/s3/copying/s3_copying_test.go @@ -8,6 +8,7 @@ import ( "io" mathrand "math/rand" "net/url" + "os" "strings" "testing" "time" @@ -43,9 +44,11 @@ var defaultConfig = &S3TestConfig{ SkipVerifySSL: true, } -// Initialize math/rand with current time to ensure randomness func init() { mathrand.Seed(time.Now().UnixNano()) + if endpoint := os.Getenv("S3_ENDPOINT"); endpoint != "" { + defaultConfig.Endpoint = endpoint + } } // getS3Client creates an AWS S3 client for testing