Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Add S3 object tagging tests to CI workflow

Chris Lua33e5a9e6a69
diff --git a/.github/workflows/s3-go-tests.yml b/.github/workflows/s3-go-tests.yml
index 6e04a8d44e..556cf534ef 100644
--- a/.github/workflows/s3-go-tests.yml
+++ b/.github/workflows/s3-go-tests.yml
@@ -411,4 +411,115 @@ jobs:
path: test/s3/versioning/weed-test*.log
retention-days: 7
+ s3-tagging-tests:
+ name: S3 Tagging Tests
+ runs-on: ubuntu-22.04
+ timeout-minutes: 20
+
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v6
+
+ - name: Set up Go
+ uses: actions/setup-go@v6
+ with:
+ go-version-file: 'go.mod'
+ id: go
+
+ - name: Install SeaweedFS
+ run: |
+ go install -buildvcs=false
+
+ - name: Run S3 Tagging Tests
+ timeout-minutes: 15
+ run: |
+ cd weed
+ set -x
+ # Create clean data directory for this test run
+ export WEED_DATA_DIR="/tmp/seaweedfs-tagging-test-$(date +%s)"
+ mkdir -p "$WEED_DATA_DIR"
+ weed server -filer -filer.maxMB=64 -s3 -ip.bind 0.0.0.0 \
+ -dir="$WEED_DATA_DIR" \
+ -master.raftHashicorp -master.electionTimeout 1s -master.volumeSizeLimitMB=100 \
+ -volume.max=100 -volume.preStopSeconds=1 \
+ -master.port=9338 -volume.port=8084 -filer.port=8893 -s3.port=8006 -metricsPort=9329 \
+ -s3.allowEmptyFolder=false -s3.allowDeleteBucketNotEmpty=true -s3.config="$GITHUB_WORKSPACE/docker/compose/s3.json" -master.peers=none &
+ pid=$!
+
+ # Wait for all SeaweedFS components to be ready
+ echo "Waiting for SeaweedFS components to start..."
+ for i in {1..30}; do
+ if curl -s http://localhost:9338/cluster/status > /dev/null 2>&1; then
+ echo "Master server is ready"
+ break
+ fi
+ echo "Waiting for master server... ($i/30)"
+ sleep 2
+ done
+
+ for i in {1..30}; do
+ if curl -s http://localhost:8084/status > /dev/null 2>&1; then
+ echo "Volume server is ready"
+ break
+ fi
+ echo "Waiting for volume server... ($i/30)"
+ sleep 2
+ done
+
+ for i in {1..30}; do
+ if curl -s http://localhost:8893/ > /dev/null 2>&1; then
+ echo "Filer is ready"
+ break
+ fi
+ echo "Waiting for filer... ($i/30)"
+ sleep 2
+ done
+
+ for i in {1..30}; do
+ if curl -s http://localhost:8006/ > /dev/null 2>&1; then
+ echo "S3 server is ready"
+ break
+ fi
+ echo "Waiting for S3 server... ($i/30)"
+ sleep 2
+ done
+
+ echo "All SeaweedFS components are ready!"
+ cd ../test/s3/tagging
+
+ # Set environment variables for the test
+ export S3_ENDPOINT="http://localhost:8006"
+ export S3_ACCESS_KEY="0555b35654ad1656d804"
+ export S3_SECRET_KEY="h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=="
+
+ # Additional wait for S3-Filer integration to be fully ready
+ echo "Waiting additional 10 seconds for S3-Filer integration..."
+ sleep 10
+
+ # Test S3 connection before running tests
+ echo "Testing S3 connection..."
+ for i in {1..10}; do
+ if curl -s -f http://localhost:8006/ > /dev/null 2>&1; then
+ echo "S3 connection test successful"
+ break
+ fi
+ echo "S3 connection test failed, retrying... ($i/10)"
+ sleep 2
+ done
+
+ echo "✅ S3 server is responding, starting tests..."
+
+ go test -v ./...
+ kill -9 $pid || true
+ # Clean up data directory
+ rm -rf "$WEED_DATA_DIR" || true
+
+ - name: Upload test logs on failure
+ if: failure()
+ uses: actions/upload-artifact@v5
+ with:
+ name: s3-tagging-test-logs
+ path: test/s3/tagging/weed-test*.log
+ retention-days: 3
+
# Removed SSE-C integration tests and compatibility job
\ No newline at end of file
diff --git a/test/s3/tagging/s3_tagging_test.go b/test/s3/tagging/s3_tagging_test.go
index 1dd4895b60..c490ca1aa2 100644
--- a/test/s3/tagging/s3_tagging_test.go
+++ b/test/s3/tagging/s3_tagging_test.go
@@ -3,6 +3,7 @@ package tagging
import (
"context"
"fmt"
+ "os"
"strings"
"testing"
"time"
@@ -29,10 +30,22 @@ type S3TestConfig struct {
// getDefaultConfig returns a fresh instance of the default test configuration
func getDefaultConfig() *S3TestConfig {
+ endpoint := os.Getenv("S3_ENDPOINT")
+ if endpoint == "" {
+ endpoint = "http://localhost:8333" // Default SeaweedFS S3 port
+ }
+ accessKey := os.Getenv("S3_ACCESS_KEY")
+ if accessKey == "" {
+ accessKey = "some_access_key1"
+ }
+ secretKey := os.Getenv("S3_SECRET_KEY")
+ if secretKey == "" {
+ secretKey = "some_secret_key1"
+ }
return &S3TestConfig{
- Endpoint: "http://localhost:8333", // Default SeaweedFS S3 port
- AccessKey: "some_access_key1",
- SecretKey: "some_secret_key1",
+ Endpoint: endpoint,
+ AccessKey: accessKey,
+ SecretKey: secretKey,
Region: "us-east-1",
BucketPrefix: "test-tagging-",
UseSSL: false,