Add a test case for fix #20684 (#20688)

The test fails without the change.
Also, removed a duplicate test case involving lifecycle config with no rules.
This commit is contained in:
Krutika Dhananjay 2024-11-28 13:13:31 +05:30 committed by GitHub
parent 02e93fd6ba
commit 4c46668da8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,11 +120,15 @@ func TestParseAndValidateLifecycleConfig(t *testing.T) {
expectedParsingErr: errDuplicatedXMLTag, expectedParsingErr: errDuplicatedXMLTag,
expectedValidationErr: nil, expectedValidationErr: nil,
}, },
{ // lifecycle config with no rules { // lifecycle config without prefixes
inputConfig: `<LifecycleConfiguration> inputConfig: `<LifecycleConfiguration>
<Rule>
<Expiration><Days>3</Days></Expiration>
<Status>Enabled</Status>
</Rule>
</LifecycleConfiguration>`, </LifecycleConfiguration>`,
expectedParsingErr: nil, expectedParsingErr: nil,
expectedValidationErr: errLifecycleNoRule, expectedValidationErr: nil,
}, },
{ // lifecycle config with rules having overlapping prefix { // lifecycle config with rules having overlapping prefix
inputConfig: `<LifecycleConfiguration><Rule><ID>rule1</ID><Status>Enabled</Status><Filter><Prefix>/a/b</Prefix></Filter><Expiration><Days>3</Days></Expiration></Rule><Rule><ID>rule2</ID><Status>Enabled</Status><Filter><And><Prefix>/a/b/c</Prefix><Tag><Key>key1</Key><Value>val1</Value></Tag></And></Filter><Expiration><Days>3</Days></Expiration></Rule></LifecycleConfiguration> `, inputConfig: `<LifecycleConfiguration><Rule><ID>rule1</ID><Status>Enabled</Status><Filter><Prefix>/a/b</Prefix></Filter><Expiration><Days>3</Days></Expiration></Rule><Rule><ID>rule2</ID><Status>Enabled</Status><Filter><And><Prefix>/a/b/c</Prefix><Tag><Key>key1</Key><Value>val1</Value></Tag></And></Filter><Expiration><Days>3</Days></Expiration></Rule></LifecycleConfiguration> `,