mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
ilm: Expect objects with only free versions when scanning (#21112)
This commit is contained in:
committed by
GitHub
parent
0bd8f06b62
commit
d0cada583f
@@ -146,6 +146,9 @@ loop:
|
||||
|
||||
// Eval will return a lifecycle event for each object in objs
|
||||
func (e *Evaluator) Eval(objs []ObjectOpts) ([]Event, error) {
|
||||
if len(objs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
if len(objs) != objs[0].NumVersions {
|
||||
return nil, fmt.Errorf("number of versions mismatch, expected %d, got %d", objs[0].NumVersions, len(objs))
|
||||
}
|
||||
|
||||
@@ -144,6 +144,12 @@ func TestNewerNoncurrentVersions(t *testing.T) {
|
||||
t.Fatalf("test-%d: got %v, want %v", i+1, gotEvents[i], wantEvents[i])
|
||||
}
|
||||
}
|
||||
|
||||
// Test with zero versions
|
||||
events, err := evaluator.Eval(nil)
|
||||
if len(events) != 0 || err != nil {
|
||||
t.Fatal("expected no events nor error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyEvaluator(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user