Files
seaweedFS/test
Chris Lu 36b8b2147b test: add integration test for versioned object listing path fix (#7731)
* test: add integration test for versioned object listing path fix

Add integration test that validates the fix for GitHub discussion #7573.
The test verifies that:
- Entry names use path.Base() to get base filename only
- Path doubling bug is prevented when listing versioned objects
- Logical entries are created correctly with proper attributes
- .versions folder paths are handled correctly

This test documents the Velero/Kopia compatibility fix and prevents
regression of the path doubling bug.

* test: add Velero/Kopia integration test for versioned object listing

Add integration tests that simulate Velero/Kopia's exact access patterns
when using S3 versioning. These tests validate the fix for GitHub
discussion #7573 where versioned objects with nested paths would have
their paths doubled in ListObjects responses.

Tests added:
- TestVeleroKopiaVersionedObjectListing: Tests various Kopia path patterns
- TestVeleroKopiaGetAfterList: Verifies list-then-get workflow works
- TestVeleroMultipleVersionsWithNestedPaths: Tests multi-version objects
- TestVeleroListVersionsWithNestedPaths: Tests ListObjectVersions API

Each test verifies:
1. Listed keys match original keys without path doubling
2. Objects can be retrieved using the listed keys
3. Content integrity is maintained

Related: https://github.com/seaweedfs/seaweedfs/discussions/7573

* refactor: remove old unit test, keep only Velero integration test

Remove weed/s3api/s3api_versioning_list_test.go as it was a simpler
unit test that the comprehensive Velero integration test supersedes.

The integration test in test/s3/versioning/s3_velero_integration_test.go
provides better coverage by actually exercising the S3 API with real
AWS SDK calls.

* refactor: use defer for response body cleanup in test loop

Use anonymous function with defer for getResp.Body.Close() to be more
defensive against future code additions in the loop body.

* refactor: improve hasDoubledPath function clarity and efficiency

- Fix comment to accurately describe checking for repeated pairs
- Tighten outer loop bound from len(parts)-2 to len(parts)-3
- Remove redundant bounds checks in the condition
2025-12-13 10:56:21 -08:00
..
2023-11-13 08:23:53 -08:00