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

update test helper #431

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/test_helper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ python3 test_helper.py clean
+ `pre-existing-10MB`
+ `pre-existing-1MB`
+ `pre-existing-empty`
+ with `-l` or `--large_objects` enable, serval large objects will also be uploaded, which will be needed for the copy multi-part objects:
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
- `pre-existing-256MB`
- `pre-existing-256MB-@`
- `pre-existing-2GB`
- `pre-existing-2GB-@`

* Create `<BUCKET_NAME>-public` in us-west-2
* Upload files:
Expand Down
22 changes: 14 additions & 8 deletions tests/test_helper/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
'bucket_name',
nargs='?',
help='The bucket name base to use for the test buckets. If not specified, the $CRT_S3_TEST_BUCKET_NAME will be used, if set. Otherwise, a random name will be generated.')
parser.add_argument(
'-l', '--large_objects',
TingDaoK marked this conversation as resolved.
Show resolved Hide resolved
action='store_true',
help='enable helper to create pre-existing large objects.')


args = parser.parse_args()

Expand Down Expand Up @@ -140,20 +145,21 @@ def create_bucket_with_lifecycle(availability_zone=None, client=s3_client):
10*MB, 'pre-existing-10MB-aes256', sse='aes256', bucket=bucket_name)
put_pre_existing_objects(
10*MB, 'pre-existing-10MB-kms', sse='kms', bucket=bucket_name)
put_pre_existing_objects(
256*MB, 'pre-existing-256MB', bucket=bucket_name)
put_pre_existing_objects(
256*MB, 'pre-existing-256MB-@', bucket=bucket_name)
put_pre_existing_objects(
2*GB, 'pre-existing-2GB', bucket=bucket_name)
put_pre_existing_objects(
2*GB, 'pre-existing-2GB-@', bucket=bucket_name)
put_pre_existing_objects(
1*MB, 'pre-existing-1MB', bucket=bucket_name)
put_pre_existing_objects(
1*MB, 'pre-existing-1MB-@', bucket=bucket_name)
put_pre_existing_objects(
0, 'pre-existing-empty', bucket=bucket_name)
if args.large_objects:
put_pre_existing_objects(
256*MB, 'pre-existing-256MB', bucket=bucket_name)
put_pre_existing_objects(
256*MB, 'pre-existing-256MB-@', bucket=bucket_name)
put_pre_existing_objects(
2*GB, 'pre-existing-2GB', bucket=bucket_name)
put_pre_existing_objects(
2*GB, 'pre-existing-2GB-@', bucket=bucket_name)

except botocore.exceptions.ClientError as e:
# The bucket already exists. That's fine.
Expand Down