Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Add s3 integration tests using directory buckets #8794

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

hssyoo
Copy link
Contributor

@hssyoo hssyoo commented Jul 11, 2024

Set up S3 directory bucket creation/teardown for integration tests with high-level s3 commands. For the existing teardown logic to be compatible with directory buckets, we switch from ListObjects to ListObjectsV2 when clearing out test buckets.

@hssyoo hssyoo requested a review from a team July 11, 2024 18:01
Copy link
Member

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick interface comment, but otherwise looks good.

Comment on lines 189 to 193
if not region:
region = 'us-west-2'
client = session.create_client('s3', region_name=region)
if not az:
az = 'usw2-az1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might consider making the region and az input a tuple since they're inherently bound. i.e. if I pass us-east-1 but forget to add the az, I don't think we want those disjoint, do we?

Something like this:

Suggested change
if not region:
region = 'us-west-2'
client = session.create_client('s3', region_name=region)
if not az:
az = 'usw2-az1'
if not location:
location = ('us-west-2', 'usw2-az1')
region, az = location
client = session.create_client('s3', region_name=region)

Copy link
Member

@kdaily kdaily left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a nit on the naming and docs, looks good otherwise.

"""
if not location:
location = ('us-west-2', 'usw2-az1')
region, az = location
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: name the parameter availability_zone instead of az to avoid using abbreviations.

@@ -181,6 +181,45 @@ def create_bucket(session, name=None, region=None):
return bucket_name


def create_dir_bucket(session, name=None, location=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to a developer to put a docstring for the type of location, since its a tuple.

s3_utils.delete_bucket(bucket_name)


@pytest.fixture(scope='package')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document this the same as shared_copy_bucket:

# Directory bucket for cross-S3 copies

@hssyoo hssyoo merged commit 842d452 into aws:v2 Jul 26, 2024
36 checks passed
@hssyoo hssyoo deleted the s3-express-integ-tests branch July 26, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants