mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 01:30:33 +00:00
Signed-off-by: 安正超 <anzhengchao@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: houseme <housemecn@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
S3 Compatibility Tests Configuration
This directory contains the configuration for running Ceph S3 compatibility tests against RustFS.
Configuration File
The s3tests.conf file is based on the official s3tests.conf.SAMPLE from the ceph/s3-tests repository. It uses environment variable substitution via envsubst to configure the endpoint and credentials.
Key Configuration Points
- Host: Set via
${S3_HOST}environment variable (e.g.,rustfs-singlefor single-node,lbfor multi-node) - Port: 9000 (standard RustFS port)
- Credentials: Uses
${S3_ACCESS_KEY}and${S3_SECRET_KEY}from workflow environment - TLS: Disabled (
is_secure = False)
Test Execution Strategy
Network Connectivity Fix
Tests run inside a Docker container on the rustfs-net network, which allows them to resolve and connect to the RustFS container hostnames. This fixes the "Temporary failure in name resolution" error that occurred when tests ran on the GitHub runner host.
Performance Optimizations
- Parallel Execution: Uses
pytest-xdistwith-n 4to run tests in parallel across 4 workers - Load Distribution: Uses
--dist=loadgroupto distribute test groups across workers - Fail-Fast: Uses
--maxfail=50to stop after 50 failures, saving time on catastrophic failures
Feature Filtering
Tests are filtered using pytest markers (-m) to skip features not yet supported by RustFS:
lifecycle- Bucket lifecycle policiesversioning- Object versionings3website- Static website hostingbucket_logging- Bucket loggingencryption/sse_s3- Server-side encryptioncloud_transition/cloud_restore- Cloud storage transitionslifecycle_expiration/lifecycle_transition- Lifecycle operations
This filtering:
- Reduces test execution time significantly (from 1+ hour to ~10-15 minutes)
- Focuses on features RustFS currently supports
- Avoids hundreds of expected failures
Running Tests Locally
Single-Node Test
# Set credentials
export S3_ACCESS_KEY=rustfsadmin
export S3_SECRET_KEY=rustfsadmin
# Start RustFS container
docker run -d --name rustfs-single \
--network rustfs-net \
-e RUSTFS_ADDRESS=0.0.0.0:9000 \
-e RUSTFS_ACCESS_KEY=$S3_ACCESS_KEY \
-e RUSTFS_SECRET_KEY=$S3_SECRET_KEY \
-e RUSTFS_VOLUMES="/data/rustfs0 /data/rustfs1 /data/rustfs2 /data/rustfs3" \
rustfs-ci
# Generate config
export S3_HOST=rustfs-single
envsubst < .github/s3tests/s3tests.conf > /tmp/s3tests.conf
# Run tests
docker run --rm \
--network rustfs-net \
-v /tmp/s3tests.conf:/etc/s3tests.conf:ro \
python:3.12-slim \
bash -c '
apt-get update -qq && apt-get install -y -qq git
git clone --depth 1 https://github.com/ceph/s3-tests.git /s3-tests
cd /s3-tests
pip install -q -r requirements.txt pytest-xdist
S3TEST_CONF=/etc/s3tests.conf pytest -v -n 4 \
s3tests/functional/test_s3.py \
-m "not lifecycle and not versioning and not s3website and not bucket_logging and not encryption and not sse_s3"
'
Test Results Interpretation
- PASSED: Test succeeded, feature works correctly
- FAILED: Test failed, indicates a potential bug or incompatibility
- ERROR: Test setup failed (e.g., network issues, missing dependencies)
- SKIPPED: Test skipped due to marker filtering
Adding New Feature Support
When adding support for a new S3 feature to RustFS:
- Remove the corresponding marker from the filter in
.github/workflows/e2e-s3tests.yml - Run the tests to verify compatibility
- Fix any failing tests
- Update this README to reflect the newly supported feature