ceph / ceph/s3-tests

Cannot specify multiple filters in bucket lifecycle configuration without using the `And` operator

Open
#638 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
372
Forks
328
PR merge metrics
No merged PRs in 30d

Description

We cannot specify multiple filters in the bucket lifecycle configuration without wrapping them inside the logical `And` operator. But some of the ceph-s3 tests using rule having multiple filters without logical `And`, which is not allowed in aws and creating issue.

Below are some of the tests using such rules (please check for more):

- `test_lifecycle_expiration_tags1()`
- `setup_lifecycle_tags2()`
- `setup_lifecycle_noncur_tags()`
- `test_lifecycle_expiration_size_gt()`
- `test_lifecycle_expiration_size_lt()`

Adding output of invalid rule:

> $ aws s3api put-bucket-lifecycle-configuration --bucket aayush-buck --lifecycle-configuration '{
"Rules": [
{
"ID": "InvalidRule",
"Status": "Enabled",
"Filter": {
"Prefix": "logs/",
"Tag": {
"Key": "archive",
"Value": "true"
}
},
"Expiration": {
"Days": 30
}
}
]
}'
An error occurred (MalformedXML) when calling the PutBucketLifecycleConfiguration operation: The XML you provided was not well-formed or did not validate against our published schema

valid rule:

> $ aws s3api put-bucket-lifecycle-configuration --bucket aayush-buck --lifecycle-configuration '{
"Rules": [
{
"ID": "PrefixAndTagRule",
"Status": "Enabled",
"Filter": {
"And": {
"Prefix": "logs/",
"Tags": [
{
"Key": "archive",
"Value": "true"
}
]
}
},
"Expiration": {
"Days": 30
}
}
]
}'

reference aws document: https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-filters.html

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the named tests: test_lifecycle_expiration_tags1(), setup_lifecycle_tags2(), setup_lifecycle_noncur_tags(), test_lifecycle_expiration_size_gt(), and test_lifecycle_expiration_size_lt(). Review their lifecycle rules and check for other rules with multiple filters, then update the invalid configurations to use the documented And form and run the relevant lifecycle tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.