mirror of
https://github.com/pgsty/minio.git
synced 2026-11-09 17:21:51 +03:00
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 <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user