From 1c64ec647694e5da18cf7d48d9fe1e915d605667 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 27 Aug 2025 16:28:42 -0700 Subject: [PATCH] pre-allocate volumes --- test/s3/iam/Makefile | 3 +++ test/s3/iam/s3_iam_distributed_test.go | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/s3/iam/Makefile b/test/s3/iam/Makefile index 63b7c92d2..0ed4b535e 100644 --- a/test/s3/iam/Makefile +++ b/test/s3/iam/Makefile @@ -70,6 +70,7 @@ start-services: ## Start SeaweedFS services for testing @$(WEED_BINARY) volume -port=$(VOLUME_PORT) \ -dataCenter=dc1 -rack=rack1 \ -dir=test-volume-data \ + -max=100 \ -mserver=localhost:$(MASTER_PORT) > weed-volume.log 2>&1 & \ echo $$! > $(VOLUME_PID_FILE) @@ -103,6 +104,8 @@ wait-for-services: ## Wait for all services to be ready @echo "Checking S3 API server..." @timeout 30 bash -c 'until curl -s http://localhost:$(S3_PORT) > /dev/null 2>&1; do sleep 1; done' || (echo "❌ S3 API failed to start" && exit 1) + @echo "Pre-allocating volumes for concurrent operations..." + @curl -s "http://localhost:$(MASTER_PORT)/vol/grow?collection=default&count=10&replication=000" > /dev/null || echo "⚠️ Volume pre-allocation failed, but continuing..." @sleep 3 @echo "✅ All services are ready" diff --git a/test/s3/iam/s3_iam_distributed_test.go b/test/s3/iam/s3_iam_distributed_test.go index 330be6bd6..acb1e61f4 100644 --- a/test/s3/iam/s3_iam_distributed_test.go +++ b/test/s3/iam/s3_iam_distributed_test.go @@ -105,10 +105,10 @@ func TestS3IAMDistributedTests(t *testing.T) { t.Run("distributed_concurrent_operations", func(t *testing.T) { // Test concurrent operations across distributed instances with robust retry mechanisms // This approach implements proper retry logic instead of tolerating errors to catch real concurrency issues - const numGoroutines = 4 // Optimal concurrency for CI reliability - const numOperationsPerGoroutine = 2 // Minimal operations per goroutine - const maxRetries = 3 // Maximum retry attempts for transient failures - const retryDelay = 100 * time.Millisecond + const numGoroutines = 3 // Reduced concurrency for better CI reliability + const numOperationsPerGoroutine = 2 // Minimal operations per goroutine + const maxRetries = 3 // Maximum retry attempts for transient failures + const retryDelay = 200 * time.Millisecond // Increased delay for better stability var wg sync.WaitGroup errors := make(chan error, numGoroutines*numOperationsPerGoroutine) @@ -224,8 +224,8 @@ func TestS3IAMDistributedTests(t *testing.T) { t.Logf("Warning: Failed to cleanup bucket %s: %v", bucketName, err) } - // Small delay between operation sequences to reduce server load - time.Sleep(50 * time.Millisecond) + // Increased delay between operation sequences to reduce server load and improve stability + time.Sleep(100 * time.Millisecond) } }(i) }