|
|
3 mesi fa | |
|---|---|---|
| .. | ||
| Makefile | 3 mesi fa | |
| README.md | 3 mesi fa | |
| README_KMS.md | 3 mesi fa | |
| docker-compose.yml | 3 mesi fa | |
| s3-config-template.json | 3 mesi fa | |
| s3_kms.json | 3 mesi fa | |
| s3_sse_integration_test.go | 3 mesi fa | |
| s3_sse_multipart_copy_test.go | 3 mesi fa | |
| setup_openbao_sse.sh | 3 mesi fa | |
| simple_sse_test.go | 3 mesi fa | |
| sse.test | 3 mesi fa | |
| sse_kms_openbao_test.go | 3 mesi fa | |
| test_single_ssec.txt | 3 mesi fa | |
This directory contains comprehensive integration tests for SeaweedFS S3 API Server-Side Encryption functionality. These tests validate the complete end-to-end encryption/decryption pipeline from S3 API requests through filer metadata storage.
The SSE integration tests cover three main encryption methods:
The tests now include real KMS integration with OpenBao, providing:
See README_KMS.md for detailed KMS integration documentation.
These integration tests were created to address a critical gap in test coverage that previously existed. While the SeaweedFS codebase had comprehensive unit tests for SSE components, it lacked integration tests that validated the complete request flow:
Client Request → S3 API → Filer Storage → Metadata Persistence → Retrieval → Decryption
A critical bug was discovered where:
Unit tests passed because they tested components in isolation, but the integration was broken. These integration tests specifically validate that:
TestSSECIntegrationBasic - Basic SSE-C PUT/GET cycleTestSSEKMSIntegrationBasic - Basic SSE-KMS PUT/GET cycleTestSSECIntegrationVariousDataSizes - SSE-C with various data sizes (0B to 1MB)TestSSEKMSIntegrationVariousDataSizes - SSE-KMS with various data sizesTestSSECObjectCopyIntegration - SSE-C object copying (key rotation, encryption changes)TestSSEKMSObjectCopyIntegration - SSE-KMS object copyingTestSSEMultipartUploadIntegration - SSE multipart uploads for large objectsTestSSEErrorConditions - Invalid keys, malformed requests, error handlingBenchmarkSSECThroughput - SSE-C performance benchmarkingBenchmarkSSEKMSThroughput - SSE-KMS performance benchmarkingBuild SeaweedFS: Ensure the weed binary is built and available in PATH
cd /path/to/seaweedfs
make
Dependencies: Tests use AWS SDK Go v2 and testify - these are handled by Go modules
Run basic SSE integration tests:
make test-basic
Run all SSE integration tests:
make test
make test-ssec # SSE-C tests only
make test-ssekms # SSE-KMS tests only
make test-copy # Copy operation tests
make test-multipart # Multipart upload tests
make test-errors # Error condition tests
make benchmark # Performance benchmarks
make perf # Various data size performance tests
make setup-openbao # Set up OpenBao KMS
make test-with-kms # Run all SSE tests with real KMS
make test-ssekms-integration # Run SSE-KMS with OpenBao only
make clean-kms # Clean up KMS environment
make manual-start # Start SeaweedFS for manual testing
# ... run manual tests ...
make manual-stop # Stop and cleanup
The tests use these default settings:
http://127.0.0.1:8333some_access_key1some_secret_key1us-east-1test-sse-Override defaults via environment variables:
S3_PORT=8444 FILER_PORT=8889 make test
Each test run:
The integration tests specifically validate scenarios that would catch metadata storage bugs:
// 1. Upload with SSE-C
client.PutObject(..., SSECustomerKey: key) // ← Metadata sent to filer
// 2. Retrieve with SSE-C
client.GetObject(..., SSECustomerKey: key) // ← Metadata retrieved from filer
// 3. Verify decryption works
assert.Equal(originalData, decryptedData) // ← Would fail if metadata lost
Tests verify that Content-Length headers are correct, which would catch bugs related to IV handling:
assert.Equal(int64(originalSize), resp.ContentLength) // ← Would catch IV-in-stream bugs
make debug-logs # Show recent log entries
make debug-status # Show process and port status
make manual-start # Start SeaweedFS
# Test with S3 clients, curl, etc.
make manual-stop # Cleanup
These integration tests provide:
For CI/CD pipelines, use:
make ci-test # Quick tests suitable for CI
make stress # Stress testing for stability validation
| Aspect | Unit Tests | Integration Tests |
|---|---|---|
| Scope | Individual functions | Complete request pipeline |
| Dependencies | Mocked/simulated | Real SeaweedFS cluster |
| Network | None | Real HTTP requests |
| Storage | In-memory | Real filer database |
| Metadata | Manual simulation | Actual storage/retrieval |
| Speed | Fast (milliseconds) | Slower (seconds) |
| Coverage | Component logic | System integration |
These integration tests ensure that SeaweedFS SSE functionality works correctly in production-like environments. They complement the existing unit tests by validating that all components work together properly, providing confidence that encryption/decryption operations will succeed for real users.
Most importantly, these tests would have immediately caught the critical filer metadata storage bug that was previously undetected, demonstrating the crucial importance of integration testing for distributed systems.