Enable expired-object-all-versions (#18954)

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
This commit is contained in:
Shubhendu 2024-02-07 03:06:22 +05:30 committed by GitHub
parent 9bcc46d93d
commit 980fb5e2ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -177,7 +177,7 @@ func (e Expiration) Validate() error {
return errLifecycleInvalidDeleteMarker
}
if !e.DeleteMarker.set && e.IsDaysNull() && e.IsDateNull() {
if !e.DeleteMarker.set && !e.DeleteAll.set && e.IsDaysNull() && e.IsDateNull() {
return errXMLNotWellFormed
}

View File

@ -94,6 +94,20 @@ func TestInvalidExpiration(t *testing.T) {
</Expiration>`,
expectedErr: errLifecycleInvalidDeleteMarker,
},
{ // Expiration with a valid number of days and ExpiredObjectAllVersions
inputXML: `<Expiration>
<Days>3</Days>
<ExpiredObjectAllVersions>true</ExpiredObjectAllVersions>
</Expiration>`,
expectedErr: nil,
},
{ // Expiration with a valid ISO 8601 date and ExpiredObjectAllVersions
inputXML: `<Expiration>
<Date>2019-04-20T00:00:00Z</Date>
<ExpiredObjectAllVersions>true</ExpiredObjectAllVersions>
</Expiration>`,
expectedErr: nil,
},
}
for i, tc := range validationTestCases {
t.Run(fmt.Sprintf("Test %d", i+1), func(t *testing.T) {