test(s3): address review feedback on the versioning suite (#9846)

- Different-users bucket test: use getNewBucketName() so the bucket carries the
  tracked prefix and run id and gets swept if the test leaks, instead of an
  untracked name.
- Makefile: clarify that '.' matches the opt-in stress tests but they self-skip
  without ENABLE_STRESS_TESTS, so they don't execute in the default run.
- Versioned list test: guard the Object.Size dereference with require.NotNil.
This commit is contained in:
Chris Lu
2026-06-06 20:50:09 -07:00
committed by GitHub
parent d321f9efb4
commit 01637410e2
3 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ FILER_PORT := 8888
TEST_TIMEOUT := 10m
# Run every test in the suite by default. "TestVersioning" used to leave whole
# tests (bucket creation, suspended delete, directory/version listing) ungated.
# Opt-in stress tests self-skip without ENABLE_STRESS_TESTS and run in their own
# targets, so "." does not pull them in here.
# Opt-in stress tests are matched by "." but self-skip without ENABLE_STRESS_TESTS
# (they run with it set in their own targets), so they don't actually execute here.
TEST_PATTERN := .
.DEFAULT_GOAL := help
@@ -135,7 +135,8 @@ func TestBucketCreationBehavior(t *testing.T) {
// (versus BucketAlreadyOwnedByYou for the owner re-creating it).
func TestBucketCreationWithDifferentUsers(t *testing.T) {
ctx := context.Background()
bucketName := "test-different-users-" + fmt.Sprintf("%d", time.Now().UnixNano())
// Tracked prefix + run id so cleanupAllTestBuckets sweeps it if the test leaks.
bucketName := getNewBucketName()
// User A owns the bucket.
clientA := getS3Client(t)
@@ -681,6 +681,7 @@ func TestVersionedObjectListBehavior(t *testing.T) {
assert.NotContains(t, *listedObject.Key, versionId, "Object key should not contain version ID")
// Verify object properties
require.NotNil(t, listedObject.Size, "Object size should not be nil")
assert.Equal(t, int64(len(content)), *listedObject.Size, "Object size should match")
assert.NotNil(t, listedObject.ETag, "Object should have ETag")
assert.NotNil(t, listedObject.LastModified, "Object should have LastModified")