snapshot of https://github.com/seaweedfs/seaweedfs.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
go: build dev binaries / cleanup (push) Successful in 4s
Codespell / Check for spelling errors (push) Failing after 3s
docker: build dev containers / build-rust-binaries (amd64, x86_64-unknown-linux-musl) (push) Failing after 3s
docker: build dev containers / build-dev-containers (push) Has been skipped
docker: build dev containers / build-rust-binaries (arm64, true, aarch64-unknown-linux-musl) (push) Failing after 3s
End to End / FUSE Mount (push) Failing after 2s
EC Integration Tests / EC Integration Tests (push) Failing after 30s
FUSE DLM Integration Tests / FUSE DLM Integration Tests (push) Failing after 3s
FUSE Volume Server Failover Tests / FUSE Volume Server Failover (push) Failing after 3s
FUSE Integration Tests / FUSE Integration Testing (push) Failing after 2s
FUSE P2P Peer Chunk Sharing Integration Tests / FUSE P2P Peer Chunk Sharing (push) Failing after 3s
go: build binary / Go Vet (push) Failing after 2s
go: build binary / Go Vet 32-bit (push) Failing after 3s
go: build binary / Build (push) Failing after 4s
go: build binary / Build cross-platform (freebsd/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (darwin/arm64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/arm64) (push) Failing after 3s
go: build binary / Test (push) Failing after 2s
go: build binary / Test 32-bit (push) Failing after 3s
helm: lint and test charts / lint-test (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (11) (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (17) (push) Failing after 3s
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Failing after 2s
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Failing after 3s
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Has been skipped
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Has been skipped
Java Client Unit Tests / Java Unit Tests (11) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (17) (push) Failing after 2s
Java Client Unit Tests / Java Unit Tests (21) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (8) (push) Failing after 3s
Kafka Quick Test (Load Test with Schema Registry) / Kafka Client Load Test (Quick) (push) Failing after 3s
Kafka Gateway Tests / Kafka Unit Tests (unit-tests-1) (push) Failing after 11s
Kafka Gateway Tests / Kafka Integration Tests (Critical) (integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka End-to-End Tests (with SMQ) (e2e-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Consumer Group Tests (Highly Isolated) (consumer-group-1) (push) Failing after 2s
Kafka Gateway Tests / Kafka Client Compatibility (with SMQ) (client-compat-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka SMQ Integration Tests (Full Stack) (smq-integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Protocol Tests (Isolated) (protocol-1) (push) Failing after 3s
KMS Tests / KMS Provider Integration Tests (push) Failing after 2s
KMS Tests / S3 KMS End-to-End Tests (push) Failing after 3s
Master Cold Start Tests / Master Cold Start Tests (push) Failing after 4s
Metadata Subscribe Integration Tests / Metadata Subscribe Integration Tests (push) Failing after 3s
Multi-Master Tests / Multi-Master Failover Tests (push) Failing after 3s
Performance / CPU and Heap Profile (push) Failing after 2s
Performance / S3 Read/Write Benchmark (rust volume) (push) Failing after 3s
pjdfstest POSIX Compliance / pjdfstest (push) Failing after 2s
Plugin Worker Integration Tests / Plugin Worker: erasure_coding (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: vacuum (push) Failing after 3s
Rust Volume Server Tests / Rust Integration Tests (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 1) (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 1) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 3) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Distributed Tests (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Performance Tests (push) Failing after 3s
Performance / Throughput Benchmark (go volume) (push) Failing after 3s
Performance / Throughput Benchmark (rust volume) (push) Failing after 2s
Performance / S3 Read/Write Benchmark (go volume) (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: volume_balance (push) Failing after 3s
PostgreSQL Gateway Tests / PostgreSQL Basic Tests (push) Failing after 3s
Rust Volume Server Tests / Rust Unit Tests (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 3) (push) Failing after 3s
Rust Plugin Worker Tests / Rust Plugin Worker Build and Unit Tests (push) Failing after 3s
rust: build dev volume server binaries / cleanup (push) Successful in 3s
S3 ETag and ACL Tests / S3 ETag + ACL Integration Tests (push) Failing after 3s
S3 IAM Integration Tests / IAM Unit Tests (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (advanced) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (basic) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (group) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (policy-enforcement) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (sts) (push) Failing after 4s
S3 Keycloak Integration Tests / S3 Keycloak Integration Tests (push) Failing after 3s
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.11) (push) Failing after 3s
S3 PyArrow Parquet Tests / Go Unit Tests (Implicit Directory) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.12) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-amd64, x86_64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-arm64, aarch64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-linux (linux-amd64, x86_64-unknown-linux-gnu) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.9) (push) Has been cancelled
S3 Proxy Signature Tests / S3 Proxy Signature Verification Tests (push) Has been cancelled
S3 SDK V2 Route Disambiguation Tests / S3 SDK V2 Routing Tests (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (quick) (push) Has been cancelled
S3 SSE Tests / S3 SSE Compatibility Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Metadata Persistence Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Copy Operations Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Multipart Upload Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Performance Test (push) Has been cancelled
S3 SSE Tests / S3 Volume Encryption Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (comprehensive) (push) Has been cancelled
Spark Integration Tests / Spark Integration Tests (push) Failing after 2s
Telemetry Integration Tests / telemetry-integration-test (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 1) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 1) (push) Failing after 3s
Ceph S3 tests / Basic S3 tests (KV store) (push) Has been cancelled
Ceph S3 tests / S3 Versioning & Object Lock tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Unit Tests (push) Failing after 3s
Ceph S3 tests / S3 CORS tests (push) Has been cancelled
Ceph S3 tests / SeaweedFS Custom S3 Copy tests (push) Has been cancelled
Ceph S3 tests / Basic S3 tests (SQL store) (push) Has been cancelled
test s3 over https using aws-cli / awscli-tests (push) Has been cancelled
TLS Rotation Integration Tests / TLS Rotation Integration Tests (push) Has been cancelled
Vacuum Integration Tests / Vacuum Integration Tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Variables Integration Tests (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (advanced-policy) (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (basic-policy) (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (contextual-policy) (push) Failing after 4s
S3 Policy Integration Tests / Trusted Proxy Detection Tests (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Shell Integration Tests (push) Failing after 3s
Samba on FUSE Integration / samba-integration (push) Failing after 2s
SFTP Integration Tests / SFTP Integration Testing (push) Failing after 3s
terraform: validate and test modules / fmt, validate, plan-level tests (push) Failing after 3s
terraform: validate and test modules / local cluster smoke test (real weed) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 3) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 2) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 2) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 3) (push) Failing after 5s
mount: windows conformance / WinFsp conformance (push) Has been cancelled
mount: windows / Mount on Windows (push) Has been cancelled
Some checks failed
go: build dev binaries / cleanup (push) Successful in 4s
Codespell / Check for spelling errors (push) Failing after 3s
docker: build dev containers / build-rust-binaries (amd64, x86_64-unknown-linux-musl) (push) Failing after 3s
docker: build dev containers / build-dev-containers (push) Has been skipped
docker: build dev containers / build-rust-binaries (arm64, true, aarch64-unknown-linux-musl) (push) Failing after 3s
End to End / FUSE Mount (push) Failing after 2s
EC Integration Tests / EC Integration Tests (push) Failing after 30s
FUSE DLM Integration Tests / FUSE DLM Integration Tests (push) Failing after 3s
FUSE Volume Server Failover Tests / FUSE Volume Server Failover (push) Failing after 3s
FUSE Integration Tests / FUSE Integration Testing (push) Failing after 2s
FUSE P2P Peer Chunk Sharing Integration Tests / FUSE P2P Peer Chunk Sharing (push) Failing after 3s
go: build binary / Go Vet (push) Failing after 2s
go: build binary / Go Vet 32-bit (push) Failing after 3s
go: build binary / Build (push) Failing after 4s
go: build binary / Build cross-platform (freebsd/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (darwin/arm64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/arm64) (push) Failing after 3s
go: build binary / Test (push) Failing after 2s
go: build binary / Test 32-bit (push) Failing after 3s
helm: lint and test charts / lint-test (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (11) (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (17) (push) Failing after 3s
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Failing after 2s
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Failing after 3s
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Has been skipped
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Has been skipped
Java Client Unit Tests / Java Unit Tests (11) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (17) (push) Failing after 2s
Java Client Unit Tests / Java Unit Tests (21) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (8) (push) Failing after 3s
Kafka Quick Test (Load Test with Schema Registry) / Kafka Client Load Test (Quick) (push) Failing after 3s
Kafka Gateway Tests / Kafka Unit Tests (unit-tests-1) (push) Failing after 11s
Kafka Gateway Tests / Kafka Integration Tests (Critical) (integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka End-to-End Tests (with SMQ) (e2e-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Consumer Group Tests (Highly Isolated) (consumer-group-1) (push) Failing after 2s
Kafka Gateway Tests / Kafka Client Compatibility (with SMQ) (client-compat-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka SMQ Integration Tests (Full Stack) (smq-integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Protocol Tests (Isolated) (protocol-1) (push) Failing after 3s
KMS Tests / KMS Provider Integration Tests (push) Failing after 2s
KMS Tests / S3 KMS End-to-End Tests (push) Failing after 3s
Master Cold Start Tests / Master Cold Start Tests (push) Failing after 4s
Metadata Subscribe Integration Tests / Metadata Subscribe Integration Tests (push) Failing after 3s
Multi-Master Tests / Multi-Master Failover Tests (push) Failing after 3s
Performance / CPU and Heap Profile (push) Failing after 2s
Performance / S3 Read/Write Benchmark (rust volume) (push) Failing after 3s
pjdfstest POSIX Compliance / pjdfstest (push) Failing after 2s
Plugin Worker Integration Tests / Plugin Worker: erasure_coding (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: vacuum (push) Failing after 3s
Rust Volume Server Tests / Rust Integration Tests (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 1) (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 1) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 3) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Distributed Tests (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Performance Tests (push) Failing after 3s
Performance / Throughput Benchmark (go volume) (push) Failing after 3s
Performance / Throughput Benchmark (rust volume) (push) Failing after 2s
Performance / S3 Read/Write Benchmark (go volume) (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: volume_balance (push) Failing after 3s
PostgreSQL Gateway Tests / PostgreSQL Basic Tests (push) Failing after 3s
Rust Volume Server Tests / Rust Unit Tests (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 3) (push) Failing after 3s
Rust Plugin Worker Tests / Rust Plugin Worker Build and Unit Tests (push) Failing after 3s
rust: build dev volume server binaries / cleanup (push) Successful in 3s
S3 ETag and ACL Tests / S3 ETag + ACL Integration Tests (push) Failing after 3s
S3 IAM Integration Tests / IAM Unit Tests (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (advanced) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (basic) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (group) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (policy-enforcement) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (sts) (push) Failing after 4s
S3 Keycloak Integration Tests / S3 Keycloak Integration Tests (push) Failing after 3s
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.11) (push) Failing after 3s
S3 PyArrow Parquet Tests / Go Unit Tests (Implicit Directory) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.12) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-amd64, x86_64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-arm64, aarch64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-linux (linux-amd64, x86_64-unknown-linux-gnu) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.9) (push) Has been cancelled
S3 Proxy Signature Tests / S3 Proxy Signature Verification Tests (push) Has been cancelled
S3 SDK V2 Route Disambiguation Tests / S3 SDK V2 Routing Tests (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (quick) (push) Has been cancelled
S3 SSE Tests / S3 SSE Compatibility Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Metadata Persistence Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Copy Operations Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Multipart Upload Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Performance Test (push) Has been cancelled
S3 SSE Tests / S3 Volume Encryption Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (comprehensive) (push) Has been cancelled
Spark Integration Tests / Spark Integration Tests (push) Failing after 2s
Telemetry Integration Tests / telemetry-integration-test (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 1) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 1) (push) Failing after 3s
Ceph S3 tests / Basic S3 tests (KV store) (push) Has been cancelled
Ceph S3 tests / S3 Versioning & Object Lock tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Unit Tests (push) Failing after 3s
Ceph S3 tests / S3 CORS tests (push) Has been cancelled
Ceph S3 tests / SeaweedFS Custom S3 Copy tests (push) Has been cancelled
Ceph S3 tests / Basic S3 tests (SQL store) (push) Has been cancelled
test s3 over https using aws-cli / awscli-tests (push) Has been cancelled
TLS Rotation Integration Tests / TLS Rotation Integration Tests (push) Has been cancelled
Vacuum Integration Tests / Vacuum Integration Tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Variables Integration Tests (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (advanced-policy) (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (basic-policy) (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (contextual-policy) (push) Failing after 4s
S3 Policy Integration Tests / Trusted Proxy Detection Tests (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Shell Integration Tests (push) Failing after 3s
Samba on FUSE Integration / samba-integration (push) Failing after 2s
SFTP Integration Tests / SFTP Integration Testing (push) Failing after 3s
terraform: validate and test modules / fmt, validate, plan-level tests (push) Failing after 3s
terraform: validate and test modules / local cluster smoke test (real weed) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 3) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 2) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 2) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 3) (push) Failing after 5s
mount: windows conformance / WinFsp conformance (push) Has been cancelled
mount: windows / Mount on Windows (push) Has been cancelled
This commit is contained in:
50
test/s3/etag/Makefile
Normal file
50
test/s3/etag/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
# ETag Format Integration Tests
|
||||
#
|
||||
# These tests verify S3 ETag format compatibility, particularly for large files
|
||||
# that trigger SeaweedFS auto-chunking. This addresses GitHub Issue #7768.
|
||||
#
|
||||
# Prerequisites:
|
||||
# - SeaweedFS running with S3 API enabled on port 8333
|
||||
# - Go 1.21+
|
||||
#
|
||||
# Usage:
|
||||
# make test - Run all tests
|
||||
# make test-large - Run only large file tests
|
||||
# make test-verbose - Run with verbose output
|
||||
# make clean - Clean test artifacts
|
||||
|
||||
.PHONY: all test test-large test-verbose test-quick clean help
|
||||
|
||||
# Default S3 endpoint
|
||||
S3_ENDPOINT ?= http://127.0.0.1:8333
|
||||
|
||||
all: test
|
||||
|
||||
test:
|
||||
@echo "Running ETag format tests against $(S3_ENDPOINT)..."
|
||||
S3_ENDPOINT=$(S3_ENDPOINT) go test -v -timeout 5m ./...
|
||||
|
||||
test-large:
|
||||
@echo "Running large file ETag tests..."
|
||||
S3_ENDPOINT=$(S3_ENDPOINT) go test -v -timeout 5m -run "LargeFile|ExtraLarge" ./...
|
||||
|
||||
test-verbose:
|
||||
S3_ENDPOINT=$(S3_ENDPOINT) go test -v -timeout 5m -count=1 ./...
|
||||
|
||||
test-quick:
|
||||
@echo "Running quick ETag tests (small files only)..."
|
||||
S3_ENDPOINT=$(S3_ENDPOINT) go test -v -timeout 1m -run "SmallFile|Consistency" ./...
|
||||
|
||||
clean:
|
||||
go clean -testcache
|
||||
|
||||
help:
|
||||
@echo "ETag Format Integration Tests"
|
||||
@echo "Targets:"
|
||||
@echo " test Run all ETag format tests"
|
||||
@echo " test-large Run only large file tests (>8MB)"
|
||||
@echo " test-quick Run quick tests (small files only)"
|
||||
@echo " test-verbose Run with verbose output"
|
||||
@echo " clean Clean test cache"
|
||||
@echo "Environment Variables:"
|
||||
@echo " S3_ENDPOINT S3 endpoint URL (default: http://127.0.0.1:8333)"
|
||||
93
test/s3/etag/README.md
Normal file
93
test/s3/etag/README.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# S3 ETag Format Integration Tests
|
||||
|
||||
This test suite verifies that SeaweedFS returns correct ETag formats for S3 operations, ensuring compatibility with AWS S3 SDKs.
|
||||
|
||||
## Background
|
||||
|
||||
**GitHub Issue #7768**: AWS S3 SDK for Java v2 was failing with `Invalid base 16 character: '-'` when performing `PutObject` on large files.
|
||||
|
||||
### Root Cause
|
||||
|
||||
SeaweedFS internally auto-chunks large files (>8MB) for efficient storage. Previously, when a regular `PutObject` request resulted in multiple internal chunks, SeaweedFS returned a composite ETag format (`<md5>-<count>`) instead of a pure MD5 hash.
|
||||
|
||||
### AWS S3 Specification
|
||||
|
||||
| Operation | ETag Format | Example |
|
||||
|-----------|-------------|---------|
|
||||
| PutObject (any size) | Pure MD5 hex (32 chars) | `d41d8cd98f00b204e9800998ecf8427e` |
|
||||
| CompleteMultipartUpload | Composite (`<md5>-<partcount>`) | `d41d8cd98f00b204e9800998ecf8427e-3` |
|
||||
|
||||
AWS S3 SDK v2 for Java validates `PutObject` ETags as hexadecimal, which fails when the ETag contains a hyphen.
|
||||
|
||||
## Test Coverage
|
||||
|
||||
| Test | File Size | Purpose |
|
||||
|------|-----------|---------|
|
||||
| `TestPutObjectETagFormat_SmallFile` | 1KB | Verify single-chunk uploads return pure MD5 |
|
||||
| `TestPutObjectETagFormat_LargeFile` | 10MB | **Critical**: Verify auto-chunked uploads return pure MD5 |
|
||||
| `TestPutObjectETagFormat_ExtraLargeFile` | 25MB | Verify multi-chunk auto-chunked uploads return pure MD5 |
|
||||
| `TestMultipartUploadETagFormat` | 15MB | Verify multipart uploads correctly return composite ETag |
|
||||
| `TestPutObjectETagConsistency` | Various | Verify ETag consistency across PUT/HEAD/GET |
|
||||
| `TestETagHexValidation` | 10MB | Simulate AWS SDK v2 hex validation |
|
||||
| `TestMultipleLargeFileUploads` | 10MB x5 | Stress test multiple large uploads |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. SeaweedFS running with S3 API enabled:
|
||||
```bash
|
||||
weed server -s3
|
||||
```
|
||||
|
||||
2. Go 1.21 or later
|
||||
|
||||
3. AWS SDK v2 for Go (installed via go modules)
|
||||
|
||||
## Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
make test
|
||||
|
||||
# Run only large file tests (the critical ones for issue #7768)
|
||||
make test-large
|
||||
|
||||
# Run quick tests (small files only)
|
||||
make test-quick
|
||||
|
||||
# Run with verbose output
|
||||
make test-verbose
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
By default, tests connect to `http://127.0.0.1:8333`. To use a different endpoint:
|
||||
|
||||
```bash
|
||||
S3_ENDPOINT=http://localhost:8333 make test
|
||||
```
|
||||
|
||||
Or modify `defaultConfig` in `s3_etag_test.go`.
|
||||
|
||||
## SDK Compatibility
|
||||
|
||||
These tests use **AWS SDK v2 for Go**, which has the same ETag validation behavior as AWS SDK v2 for Java. The tests include:
|
||||
|
||||
- ETag format validation (pure MD5 vs composite)
|
||||
- Hex decoding validation (simulates `Base16Codec.decode`)
|
||||
- Content integrity verification
|
||||
|
||||
## Validated SDK Versions
|
||||
|
||||
| SDK | Version | Status |
|
||||
|-----|---------|--------|
|
||||
| AWS SDK v2 for Go | 1.20+ | ✅ Tested |
|
||||
| AWS SDK v2 for Java | 2.20+ | ✅ Compatible (issue #7768 fixed) |
|
||||
| AWS SDK v1 for Go | 1.x | ✅ Compatible (less strict validation) |
|
||||
| AWS SDK v1 for Java | 1.x | ✅ Compatible (less strict validation) |
|
||||
|
||||
## Related
|
||||
|
||||
- [GitHub Issue #7768](https://github.com/seaweedfs/seaweedfs/issues/7768)
|
||||
- [AWS S3 ETag Documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html)
|
||||
|
||||
|
||||
644
test/s3/etag/s3_etag_test.go
Normal file
644
test/s3/etag/s3_etag_test.go
Normal file
@@ -0,0 +1,644 @@
|
||||
// Package etag_test provides integration tests for S3 ETag format validation.
|
||||
//
|
||||
// These tests verify that SeaweedFS returns correct ETag formats for different
|
||||
// upload scenarios, ensuring compatibility with AWS S3 SDKs that validate ETags.
|
||||
//
|
||||
// Background (GitHub Issue #7768):
|
||||
// AWS S3 SDK for Java v2 validates ETags as hexadecimal MD5 hashes for PutObject
|
||||
// responses. SeaweedFS was incorrectly returning composite ETags ("<md5>-<count>")
|
||||
// for regular PutObject when files were internally auto-chunked (>8MB), causing
|
||||
// the SDK to fail with "Invalid base 16 character: '-'".
|
||||
//
|
||||
// Per AWS S3 specification:
|
||||
// - Regular PutObject: ETag is always a pure MD5 hex string (32 chars)
|
||||
// - Multipart Upload (CompleteMultipartUpload): ETag is "<md5>-<partcount>"
|
||||
//
|
||||
// These tests ensure this behavior is maintained.
|
||||
package etag_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
mathrand "math/rand"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/config"
|
||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// S3TestConfig holds configuration for S3 tests
|
||||
type S3TestConfig struct {
|
||||
Endpoint string
|
||||
AccessKey string
|
||||
SecretKey string
|
||||
Region string
|
||||
BucketPrefix string
|
||||
}
|
||||
|
||||
// Default test configuration
|
||||
var defaultConfig = &S3TestConfig{
|
||||
Endpoint: "http://127.0.0.1:8333",
|
||||
AccessKey: "some_access_key1",
|
||||
SecretKey: "some_secret_key1",
|
||||
Region: "us-east-1",
|
||||
BucketPrefix: "test-etag-",
|
||||
}
|
||||
|
||||
// Constants for auto-chunking thresholds (must match s3api_object_handlers_put.go)
|
||||
const (
|
||||
// SeaweedFS auto-chunks files larger than 8MB
|
||||
autoChunkSize = 8 * 1024 * 1024
|
||||
|
||||
// Test sizes
|
||||
smallFileSize = 1 * 1024 // 1KB - single chunk
|
||||
mediumFileSize = 256 * 1024 // 256KB - single chunk (at threshold)
|
||||
largeFileSize = 10 * 1024 * 1024 // 10MB - triggers auto-chunking (2 chunks)
|
||||
xlFileSize = 25 * 1024 * 1024 // 25MB - triggers auto-chunking (4 chunks)
|
||||
multipartSize = 5 * 1024 * 1024 // 5MB per part for multipart uploads
|
||||
)
|
||||
|
||||
// ETag format patterns
|
||||
var (
|
||||
// Pure MD5 ETag: 32 hex characters (with or without quotes)
|
||||
pureMD5Pattern = regexp.MustCompile(`^"?[a-f0-9]{32}"?$`)
|
||||
|
||||
// Composite ETag for multipart: 32 hex chars, hyphen, part count (with or without quotes)
|
||||
compositePattern = regexp.MustCompile(`^"?[a-f0-9]{32}-\d+"?$`)
|
||||
)
|
||||
|
||||
func init() {
|
||||
mathrand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// getS3Client creates an AWS S3 v2 client for testing
|
||||
func getS3Client(t *testing.T) *s3.Client {
|
||||
endpoint := os.Getenv("S3_ENDPOINT")
|
||||
if endpoint == "" {
|
||||
endpoint = defaultConfig.Endpoint
|
||||
}
|
||||
t.Logf("Using S3 endpoint: %s", endpoint)
|
||||
|
||||
cfg, err := config.LoadDefaultConfig(context.TODO(),
|
||||
config.WithRegion(defaultConfig.Region),
|
||||
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
|
||||
defaultConfig.AccessKey,
|
||||
defaultConfig.SecretKey,
|
||||
"",
|
||||
)),
|
||||
config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(
|
||||
func(service, region string, options ...interface{}) (aws.Endpoint, error) {
|
||||
return aws.Endpoint{
|
||||
URL: endpoint,
|
||||
SigningRegion: defaultConfig.Region,
|
||||
HostnameImmutable: true,
|
||||
}, nil
|
||||
})),
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
return s3.NewFromConfig(cfg, func(o *s3.Options) {
|
||||
o.UsePathStyle = true
|
||||
})
|
||||
}
|
||||
|
||||
// getNewBucketName generates a unique bucket name
|
||||
func getNewBucketName() string {
|
||||
timestamp := time.Now().UnixNano()
|
||||
randomSuffix := mathrand.Intn(100000)
|
||||
return fmt.Sprintf("%s%d-%d", defaultConfig.BucketPrefix, timestamp, randomSuffix)
|
||||
}
|
||||
|
||||
// generateRandomData generates random test data of specified size
|
||||
func generateRandomData(size int) []byte {
|
||||
data := make([]byte, size)
|
||||
if _, err := rand.Read(data); err != nil {
|
||||
panic(fmt.Sprintf("failed to generate random test data: %v", err))
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// calculateMD5 calculates the MD5 hash of data and returns hex string
|
||||
func calculateMD5(data []byte) string {
|
||||
hash := md5.Sum(data)
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
|
||||
// cleanETag removes quotes from ETag
|
||||
func cleanETag(etag string) string {
|
||||
return strings.Trim(etag, `"`)
|
||||
}
|
||||
|
||||
// isPureMD5ETag checks if ETag is a pure MD5 hex string (no composite format)
|
||||
func isPureMD5ETag(etag string) bool {
|
||||
return pureMD5Pattern.MatchString(etag)
|
||||
}
|
||||
|
||||
// isCompositeETag checks if ETag is in composite format (md5-count)
|
||||
func isCompositeETag(etag string) bool {
|
||||
return compositePattern.MatchString(etag)
|
||||
}
|
||||
|
||||
// createTestBucket creates a new bucket for testing
|
||||
func createTestBucket(ctx context.Context, client *s3.Client, bucketName string) error {
|
||||
_, err := client.CreateBucket(ctx, &s3.CreateBucketInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
// cleanupTestBucket deletes all objects and the bucket
|
||||
func cleanupTestBucket(ctx context.Context, client *s3.Client, bucketName string) {
|
||||
// Delete all objects
|
||||
paginator := s3.NewListObjectsV2Paginator(client, &s3.ListObjectsV2Input{
|
||||
Bucket: aws.String(bucketName),
|
||||
})
|
||||
|
||||
for paginator.HasMorePages() {
|
||||
page, err := paginator.NextPage(ctx)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
for _, obj := range page.Contents {
|
||||
client.DeleteObject(ctx, &s3.DeleteObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: obj.Key,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Abort any in-progress multipart uploads
|
||||
mpPaginator := s3.NewListMultipartUploadsPaginator(client, &s3.ListMultipartUploadsInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
})
|
||||
for mpPaginator.HasMorePages() {
|
||||
page, err := mpPaginator.NextPage(ctx)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
for _, upload := range page.Uploads {
|
||||
client.AbortMultipartUpload(ctx, &s3.AbortMultipartUploadInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: upload.Key,
|
||||
UploadId: upload.UploadId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete bucket
|
||||
client.DeleteBucket(ctx, &s3.DeleteBucketInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
})
|
||||
}
|
||||
|
||||
// TestPutObjectETagFormat_SmallFile verifies ETag format for small files (single chunk)
|
||||
func TestPutObjectETagFormat_SmallFile(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
testData := generateRandomData(smallFileSize)
|
||||
expectedMD5 := calculateMD5(testData)
|
||||
objectKey := "small-file.bin"
|
||||
|
||||
// Upload small file
|
||||
putResp, err := client.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
Body: bytes.NewReader(testData),
|
||||
})
|
||||
require.NoError(t, err, "Failed to upload small file")
|
||||
|
||||
// Verify ETag format
|
||||
etag := aws.ToString(putResp.ETag)
|
||||
t.Logf("Small file (%d bytes) ETag: %s", smallFileSize, etag)
|
||||
|
||||
assert.True(t, isPureMD5ETag(etag),
|
||||
"Small file ETag should be pure MD5, got: %s", etag)
|
||||
assert.False(t, isCompositeETag(etag),
|
||||
"Small file ETag should NOT be composite format, got: %s", etag)
|
||||
assert.Equal(t, expectedMD5, cleanETag(etag),
|
||||
"ETag should match calculated MD5")
|
||||
}
|
||||
|
||||
// TestPutObjectETagFormat_LargeFile verifies ETag format for large files that trigger auto-chunking
|
||||
// This is the critical test for GitHub Issue #7768
|
||||
func TestPutObjectETagFormat_LargeFile(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
testData := generateRandomData(largeFileSize)
|
||||
expectedMD5 := calculateMD5(testData)
|
||||
objectKey := "large-file.bin"
|
||||
|
||||
t.Logf("Uploading large file (%d bytes, > %d byte auto-chunk threshold)...",
|
||||
largeFileSize, autoChunkSize)
|
||||
|
||||
// Upload large file (triggers auto-chunking internally)
|
||||
putResp, err := client.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
Body: bytes.NewReader(testData),
|
||||
})
|
||||
require.NoError(t, err, "Failed to upload large file")
|
||||
|
||||
// Verify ETag format - MUST be pure MD5, NOT composite
|
||||
etag := aws.ToString(putResp.ETag)
|
||||
t.Logf("Large file (%d bytes, ~%d internal chunks) ETag: %s",
|
||||
largeFileSize, (largeFileSize/autoChunkSize)+1, etag)
|
||||
|
||||
assert.True(t, isPureMD5ETag(etag),
|
||||
"Large file PutObject ETag MUST be pure MD5 (not composite), got: %s", etag)
|
||||
assert.False(t, isCompositeETag(etag),
|
||||
"Large file PutObject ETag should NOT contain '-' (composite format), got: %s", etag)
|
||||
assert.False(t, strings.Contains(cleanETag(etag), "-"),
|
||||
"ETag should not contain hyphen for regular PutObject, got: %s", etag)
|
||||
assert.Equal(t, expectedMD5, cleanETag(etag),
|
||||
"ETag should match calculated MD5 of entire content")
|
||||
|
||||
// Verify we can read back the object correctly
|
||||
getResp, err := client.GetObject(ctx, &s3.GetObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err, "Failed to get large file")
|
||||
defer getResp.Body.Close()
|
||||
|
||||
downloadedData, err := io.ReadAll(getResp.Body)
|
||||
require.NoError(t, err, "Failed to read large file content")
|
||||
assert.Equal(t, testData, downloadedData, "Downloaded content should match uploaded content")
|
||||
}
|
||||
|
||||
// TestPutObjectETagFormat_ExtraLargeFile tests even larger files with multiple internal chunks
|
||||
func TestPutObjectETagFormat_ExtraLargeFile(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
testData := generateRandomData(xlFileSize)
|
||||
expectedMD5 := calculateMD5(testData)
|
||||
objectKey := "xl-file.bin"
|
||||
|
||||
expectedChunks := (xlFileSize / autoChunkSize) + 1
|
||||
t.Logf("Uploading XL file (%d bytes, expected ~%d internal chunks)...",
|
||||
xlFileSize, expectedChunks)
|
||||
|
||||
// Upload extra large file
|
||||
putResp, err := client.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
Body: bytes.NewReader(testData),
|
||||
})
|
||||
require.NoError(t, err, "Failed to upload XL file")
|
||||
|
||||
// Verify ETag format
|
||||
etag := aws.ToString(putResp.ETag)
|
||||
t.Logf("XL file (%d bytes) ETag: %s", xlFileSize, etag)
|
||||
|
||||
assert.True(t, isPureMD5ETag(etag),
|
||||
"XL file PutObject ETag MUST be pure MD5, got: %s", etag)
|
||||
assert.False(t, isCompositeETag(etag),
|
||||
"XL file PutObject ETag should NOT be composite, got: %s", etag)
|
||||
assert.Equal(t, expectedMD5, cleanETag(etag),
|
||||
"ETag should match calculated MD5")
|
||||
}
|
||||
|
||||
// TestMultipartUploadETagFormat verifies that ONLY multipart uploads get composite ETags
|
||||
func TestMultipartUploadETagFormat(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
// Create test data for multipart upload (15MB = 3 parts of 5MB each)
|
||||
totalSize := 15 * 1024 * 1024
|
||||
testData := generateRandomData(totalSize)
|
||||
objectKey := "multipart-file.bin"
|
||||
|
||||
expectedPartCount := (totalSize + multipartSize - 1) / multipartSize // ceiling division
|
||||
t.Logf("Performing multipart upload (%d bytes, %d parts)...",
|
||||
totalSize, expectedPartCount)
|
||||
|
||||
// Initiate multipart upload
|
||||
createResp, err := client.CreateMultipartUpload(ctx, &s3.CreateMultipartUploadInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err, "Failed to create multipart upload")
|
||||
|
||||
uploadId := createResp.UploadId
|
||||
var completedParts []types.CompletedPart
|
||||
partNumber := int32(1)
|
||||
|
||||
// Upload parts
|
||||
for offset := 0; offset < totalSize; offset += multipartSize {
|
||||
end := offset + multipartSize
|
||||
if end > totalSize {
|
||||
end = totalSize
|
||||
}
|
||||
partData := testData[offset:end]
|
||||
|
||||
uploadResp, err := client.UploadPart(ctx, &s3.UploadPartInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
UploadId: uploadId,
|
||||
PartNumber: aws.Int32(partNumber),
|
||||
Body: bytes.NewReader(partData),
|
||||
})
|
||||
require.NoError(t, err, "Failed to upload part %d", partNumber)
|
||||
|
||||
completedParts = append(completedParts, types.CompletedPart{
|
||||
ETag: uploadResp.ETag,
|
||||
PartNumber: aws.Int32(partNumber),
|
||||
})
|
||||
partNumber++
|
||||
}
|
||||
|
||||
// Complete multipart upload
|
||||
completeResp, err := client.CompleteMultipartUpload(ctx, &s3.CompleteMultipartUploadInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
UploadId: uploadId,
|
||||
MultipartUpload: &types.CompletedMultipartUpload{
|
||||
Parts: completedParts,
|
||||
},
|
||||
})
|
||||
require.NoError(t, err, "Failed to complete multipart upload")
|
||||
|
||||
// Verify ETag format - SHOULD be composite for multipart
|
||||
etag := aws.ToString(completeResp.ETag)
|
||||
t.Logf("Multipart upload ETag: %s", etag)
|
||||
|
||||
assert.True(t, isCompositeETag(etag),
|
||||
"Multipart upload ETag SHOULD be composite format (md5-count), got: %s", etag)
|
||||
assert.True(t, strings.Contains(cleanETag(etag), "-"),
|
||||
"Multipart ETag should contain hyphen, got: %s", etag)
|
||||
|
||||
// Verify the part count in the ETag matches
|
||||
parts := strings.Split(cleanETag(etag), "-")
|
||||
require.Len(t, parts, 2, "Composite ETag should have format 'hash-count'")
|
||||
assert.Equal(t, fmt.Sprintf("%d", len(completedParts)), parts[1],
|
||||
"Part count in ETag should match number of parts uploaded")
|
||||
}
|
||||
|
||||
func TestMultipartUploadETagVerification(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
// Create test data for multipart upload (11MB = 2 parts: 5MB + 6MB)
|
||||
// Using parts of different sizes to ensure correct calculation
|
||||
part1Size := 5 * 1024 * 1024
|
||||
part2Size := 6 * 1024 * 1024
|
||||
data1 := generateRandomData(part1Size)
|
||||
data2 := generateRandomData(part2Size)
|
||||
|
||||
objectKey := "verify-etag-multipart.bin"
|
||||
|
||||
// Pre-calculate expected ETag
|
||||
md1 := md5.Sum(data1)
|
||||
md2 := md5.Sum(data2)
|
||||
concatenatedMD5s := append(md1[:], md2[:]...)
|
||||
finalMD5 := md5.Sum(concatenatedMD5s)
|
||||
expectedETagValue := fmt.Sprintf("%x-2", finalMD5)
|
||||
|
||||
t.Logf("Expected multipart ETag: %s", expectedETagValue)
|
||||
|
||||
// 1. CreateMultipartUpload
|
||||
createResp, err := client.CreateMultipartUpload(ctx, &s3.CreateMultipartUploadInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
uploadId := createResp.UploadId
|
||||
|
||||
// 2. UploadPart 1
|
||||
putPart1, err := client.UploadPart(ctx, &s3.UploadPartInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
UploadId: uploadId,
|
||||
PartNumber: aws.Int32(1),
|
||||
Body: bytes.NewReader(data1),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "\""+calculateMD5(data1)+"\"", aws.ToString(putPart1.ETag))
|
||||
|
||||
// 3. UploadPart 2
|
||||
putPart2, err := client.UploadPart(ctx, &s3.UploadPartInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
UploadId: uploadId,
|
||||
PartNumber: aws.Int32(2),
|
||||
Body: bytes.NewReader(data2),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "\""+calculateMD5(data2)+"\"", aws.ToString(putPart2.ETag))
|
||||
|
||||
// 4. CompleteMultipartUpload
|
||||
completeResp, err := client.CompleteMultipartUpload(ctx, &s3.CompleteMultipartUploadInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
UploadId: uploadId,
|
||||
MultipartUpload: &types.CompletedMultipartUpload{
|
||||
Parts: []types.CompletedPart{
|
||||
{ETag: putPart1.ETag, PartNumber: aws.Int32(1)},
|
||||
{ETag: putPart2.ETag, PartNumber: aws.Int32(2)},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
completeETag := cleanETag(aws.ToString(completeResp.ETag))
|
||||
t.Logf("CompleteMultipartUpload ETag: %s", completeETag)
|
||||
assert.Equal(t, expectedETagValue, completeETag, "CompleteMultipartUpload ETag mismatch")
|
||||
|
||||
// 5. HeadObject
|
||||
headResp, err := client.HeadObject(ctx, &s3.HeadObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
headETag := cleanETag(aws.ToString(headResp.ETag))
|
||||
assert.Equal(t, expectedETagValue, headETag, "HeadObject ETag mismatch")
|
||||
|
||||
// 6. GetObject
|
||||
getResp, err := client.GetObject(ctx, &s3.GetObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
getETag := cleanETag(aws.ToString(getResp.ETag))
|
||||
assert.Equal(t, expectedETagValue, getETag, "GetObject ETag mismatch")
|
||||
getResp.Body.Close()
|
||||
}
|
||||
|
||||
// TestPutObjectETagConsistency verifies ETag consistency between PUT and GET
|
||||
func TestPutObjectETagConsistency(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
size int
|
||||
}{
|
||||
{"tiny", 100},
|
||||
{"small", smallFileSize},
|
||||
{"medium", mediumFileSize},
|
||||
{"large", largeFileSize},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
testData := generateRandomData(tc.size)
|
||||
objectKey := fmt.Sprintf("consistency-test-%s.bin", tc.name)
|
||||
|
||||
// PUT object
|
||||
putResp, err := client.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
Body: bytes.NewReader(testData),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
putETag := aws.ToString(putResp.ETag)
|
||||
|
||||
// HEAD object
|
||||
headResp, err := client.HeadObject(ctx, &s3.HeadObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
headETag := aws.ToString(headResp.ETag)
|
||||
|
||||
// GET object
|
||||
getResp, err := client.GetObject(ctx, &s3.GetObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
getETag := aws.ToString(getResp.ETag)
|
||||
getResp.Body.Close()
|
||||
|
||||
// All ETags should match
|
||||
t.Logf("%s (%d bytes): PUT=%s, HEAD=%s, GET=%s",
|
||||
tc.name, tc.size, putETag, headETag, getETag)
|
||||
|
||||
assert.Equal(t, putETag, headETag,
|
||||
"PUT and HEAD ETags should match")
|
||||
assert.Equal(t, putETag, getETag,
|
||||
"PUT and GET ETags should match")
|
||||
|
||||
// All should be pure MD5 (not composite) for regular PutObject
|
||||
assert.True(t, isPureMD5ETag(putETag),
|
||||
"PutObject ETag should be pure MD5, got: %s", putETag)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestETagHexValidation simulates the AWS SDK v2 validation that caused issue #7768
|
||||
func TestETagHexValidation(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
// Test with a file large enough to trigger auto-chunking
|
||||
testData := generateRandomData(largeFileSize)
|
||||
objectKey := "hex-validation-test.bin"
|
||||
|
||||
putResp, err := client.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
Body: bytes.NewReader(testData),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
etag := cleanETag(aws.ToString(putResp.ETag))
|
||||
|
||||
// Simulate AWS SDK v2's hex validation (Base16Codec.decode)
|
||||
// This is what fails in issue #7768 when ETag contains '-'
|
||||
t.Logf("Validating ETag as hex: %s", etag)
|
||||
|
||||
_, err = hex.DecodeString(etag)
|
||||
assert.NoError(t, err,
|
||||
"ETag should be valid hexadecimal (AWS SDK v2 validation). "+
|
||||
"Got ETag: %s. If this fails with 'invalid byte', the ETag contains non-hex chars like '-'",
|
||||
etag)
|
||||
}
|
||||
|
||||
// TestMultipleLargeFileUploads verifies ETag format across multiple large uploads
|
||||
func TestMultipleLargeFileUploads(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
client := getS3Client(t)
|
||||
|
||||
bucketName := getNewBucketName()
|
||||
err := createTestBucket(ctx, client, bucketName)
|
||||
require.NoError(t, err, "Failed to create test bucket")
|
||||
defer cleanupTestBucket(ctx, client, bucketName)
|
||||
|
||||
numFiles := 5
|
||||
for i := 0; i < numFiles; i++ {
|
||||
testData := generateRandomData(largeFileSize)
|
||||
expectedMD5 := calculateMD5(testData)
|
||||
objectKey := fmt.Sprintf("large-file-%d.bin", i)
|
||||
|
||||
putResp, err := client.PutObject(ctx, &s3.PutObjectInput{
|
||||
Bucket: aws.String(bucketName),
|
||||
Key: aws.String(objectKey),
|
||||
Body: bytes.NewReader(testData),
|
||||
})
|
||||
require.NoError(t, err, "Failed to upload file %d", i)
|
||||
|
||||
etag := aws.ToString(putResp.ETag)
|
||||
t.Logf("File %d ETag: %s (expected MD5: %s)", i, etag, expectedMD5)
|
||||
|
||||
assert.True(t, isPureMD5ETag(etag),
|
||||
"File %d ETag should be pure MD5, got: %s", i, etag)
|
||||
assert.Equal(t, expectedMD5, cleanETag(etag),
|
||||
"File %d ETag should match MD5", i)
|
||||
|
||||
// Validate as hex (AWS SDK v2 check)
|
||||
_, err = hex.DecodeString(cleanETag(etag))
|
||||
assert.NoError(t, err, "File %d ETag should be valid hex", i)
|
||||
}
|
||||
}
|
||||
20
test/s3/etag/test_config.json
Normal file
20
test/s3/etag/test_config.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"endpoint": "http://127.0.0.1:8333",
|
||||
"access_key": "some_access_key1",
|
||||
"secret_key": "some_secret_key1",
|
||||
"region": "us-east-1",
|
||||
"bucket_prefix": "test-etag-",
|
||||
"notes": {
|
||||
"description": "S3 ETag format integration tests",
|
||||
"issue": "https://github.com/seaweedfs/seaweedfs/issues/7768",
|
||||
"auto_chunk_size": "8MB - files larger than this trigger auto-chunking",
|
||||
"test_sizes": {
|
||||
"small": "1KB - single chunk",
|
||||
"medium": "256KB - at inline threshold",
|
||||
"large": "10MB - 2 internal chunks",
|
||||
"xl": "25MB - 4 internal chunks"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user