From af0afd2321c8481a8c227395a1b0da04b04bd3b1 Mon Sep 17 00:00:00 2001 From: Feng Ruohang Date: Sun, 8 Nov 2026 11:39:03 +0800 Subject: [PATCH] test(batch): pin the parity of the tiered purge transition helper TestBatchExpirePurgeRefusesTieredKey marks a version transitioned through DecomTieredObject, which takes its parity from the global storage class. Run after tests that leave a parity the one-drive fixture cannot have, it wrote on no drive and still returned nil, and the purge then removed the key. The helper now sets the set's own parity for the test and reads the transition back from every drive. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Feng Ruohang --- cmd/batch-expire-purge-authz_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/batch-expire-purge-authz_test.go b/cmd/batch-expire-purge-authz_test.go index 92ab295c3..fd77c1b88 100644 --- a/cmd/batch-expire-purge-authz_test.go +++ b/cmd/batch-expire-purge-authz_test.go @@ -196,11 +196,23 @@ func TestBatchExpirePurgeRefusesLockedAfterWalk(t *testing.T) { func (f *batchAuthzFixture) transition(t *testing.T, key, versionID string) { t.Helper() set := f.obj.(*erasureServerPools).serverPools[0] - infos, errs := readAllFileInfo(f.ctx, set.getHashedSet(key).getDisks(), "", f.bucket, key, versionID, false, false) + er := set.getHashedSet(key) + // DecomTieredObject takes its parity from the global storage class, which + // earlier tests can leave at a parity this set cannot have; it then + // writes on no drive and still succeeds. Use the set's own parity; the + // whole configuration is restored when the test ends. + setTestStandardParity(t, er.defaultParityCount) + infos, errs := readAllFileInfo(f.ctx, er.getDisks(), "", f.bucket, key, versionID, false, false) mustIAM(t, errs[0]) fi := infos[0] fi.TransitionStatus, fi.TransitionTier, fi.TransitionedObjName = lifecycle.TransitionComplete, "WARM", "remote/"+key+"/"+versionID mustIAM(t, set.DecomTieredObject(f.ctx, f.bucket, key, fi, ObjectOptions{})) + infos, errs = readAllFileInfo(f.ctx, er.getDisks(), "", f.bucket, key, versionID, false, false) + for i := range infos { + if errs[i] != nil || infos[i].TransitionStatus != lifecycle.TransitionComplete { + t.Fatalf("drive %d does not hold the transition: %v", i, errs[i]) + } + } } // A key with a transitioned version is refused as a whole, as a key with a