Commit Graph
6 Commits
Author SHA1 Message Date
Chris Lu 754fae92ec Normalize TestMain filenames: ensure s3_test_main_test.go used across S3 tests 2025-12-24 19:59:55 -08:00
Chris Lu ef1d703054 Complete S3 integration test modernization
- Implement TestMain-based auto server management for all 13 S3 test suites
- Fix import paths to use full module names instead of relative imports
- Update Makefiles to use correct build targets and binary detection
- Enhance testutil with improved binary discovery and credential handling
- Fix test session creation to use explicit AWS credentials
- Validate infrastructure with successful test execution
- Update documentation with implementation details and usage instructions

All S3 test suites now support:
- make test-with-server: Auto-managed server lifecycle
- make test-external: Use existing server (for CI/CD)
- Consistent build and dependency checking
- Proper error handling and logging
2025-12-24 19:42:30 -08:00
Chris Lu d762f8d58e fix: use relative imports for testutil in all s3_test_main.go files
- Change imports from absolute module path 'github.com/seaweedfs/seaweedfs/test/s3/testutil'
  to relative path '../testutil'
- Fixes module resolution issues when running tests from individual directories
- All test directories now compile and load testutil correctly
- Enables tests to run with 'go test ./...' from any test subdirectory
2025-12-24 19:35:28 -08:00
Chris Lu ee0e08a32d refactor: add test-with-server targets to all S3 test directories
- Add test-with-server target to acl, basic, delete, etag Makefiles
- Simplify test-with-server to use TestMain-based server auto-management
- Update tagging, cors, filer_group, retention, remote_cache, sse Makefiles
- Add TEST_PATTERN support for CI/CD parameterized testing
- Remove complex manual server management from test-with-server
- All targets now delegate to TestMain for consistent, simplified server lifecycle
- Backward compatible with existing make targets for manual testing
2025-12-24 19:30:57 -08:00
Chris Lu 56f9b5b6ab feat: add weed mini TestMain support to all S3 integration tests
- Added s3_test_main.go with auto-managed weed mini server to:
  - acl, basic, copying, cors, delete, etag, filer_group, iam
  - remote_cache, retention, sse, tagging (12 additional test suites)
- All tests now support automatic server lifecycle management via TestMain
- Backward compatible with USE_EXTERNAL_SERVER=true for CI pipelines
- No changes required to existing test files
- All 13 S3 test suites now use consistent weed mini infrastructure

This enables:
- Tests to run independently with self-managed server
- Simplified CI/CD pipelines
- Reduced infrastructure complexity
- Consistent test infrastructure across all S3 tests
2025-12-24 19:25:11 -08:00
Chris LuandGitHub 014027f75a Fix: Support object tagging in versioned buckets (Issue #7868) (#7871)
* Fix: Support object tagging in versioned buckets (Issue #7868)

This fix addresses the issue where setting tags on files in versioned buckets would fail with 'filer: no entry is found in filer store' error.

Changes:
- Updated GetObjectTaggingHandler to check versioning status and retrieve correct object versions
- Updated PutObjectTaggingHandler to properly locate and update tags on versioned objects
- Updated DeleteObjectTaggingHandler to delete tags from versioned objects
- Added proper handling for both specific versions and latest versions
- Added distinction between null versions (pre-versioning objects) and versioned objects

The fix follows the same versioning-aware pattern already implemented in ACL handlers.

Tests:
- Added comprehensive test suite for tagging operations on versioned buckets
- Tests cover PUT, GET, and DELETE tagging operations on specific versions and latest versions
- Tests verify tag isolation between different versions of the same object

* Fix: Ensure consistent directory path construction in tagging handlers

Changed directory path construction to match the pattern used in ACL handlers:
- Added missing '/' before object path when constructing .versions directory path
- This ensures compatibility with the filer's expected path structure
- Applied to both PutObjectTaggingHandler and DeleteObjectTaggingHandler

* Revert: Remove redundant slash in path construction - object already has leading slash from NormalizeObjectKey

* Fix: Remove redundant slashes in versioning path construction across handlers

- getVersionedObjectDir: object already starts with '/', no need for extra '/'
- ACL handlers: same pattern, fix both PutObjectAcl locations
- Ensures consistent path construction with object parameter normalization

* fix test compilation

* Add: Comprehensive ACL tests for versioned and non-versioned buckets

- Added s3_acl_versioning_test.go with 5 test cases covering:
  * GetObjectAcl on versioned buckets
  * GetObjectAcl on specific versions
  * PutObjectAcl on versioned buckets
  * PutObjectAcl on specific versions
  * Independent ACL management across versions

These tests were missing and would have caught the path construction
issues we just fixed in the ACL handler. Tests validate that ACL
operations work correctly on both versioned and non-versioned objects.

* Fix: Correct tagging versioning test file formatting

* fix: Update AWS SDK endpoint config and improve cleanup to handle delete markers

- Replace deprecated EndpointResolverWithOptions with BaseEndpoint in AWS SDK v2 client configuration
- Update cleanupTestBucket to properly delete both object versions and delete markers
- Apply changes to both ACL and tagging test files for consistency

* Fix S3 multi-delete for versioned objects

The bug was in getVersionedObjectDir() which was constructing paths without
a slash between the bucket and object key:

BEFORE (WRONG): /buckets/mybucket{key}.versions
AFTER (FIXED):  /buckets/mybucket/{key}/.versions

This caused version deletions to claim success but not actually delete files,
breaking S3 compatibility tests:
- test_versioning_multi_object_delete
- test_versioning_multi_object_delete_with_marker
- test_versioning_concurrent_multi_object_delete
- test_object_lock_multi_delete_object_with_retention

Added comprehensive test that reproduces the issue and verifies the fix.

* Remove emojis from test output
2025-12-24 13:09:08 -08:00