Skip to content

Commit 9baaa31

Browse files
TingDaoKgraebm
andauthored
Make public bucket optional (#495)
Co-authored-by: Michael Graeb <graebm@amazon.com>
1 parent 562e7d3 commit 9baaa31

2 files changed

Lines changed: 40 additions & 29 deletions

File tree

tests/test_helper/README.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,38 @@ python3 test_helper.py clean
2424
### `init` action
2525

2626
* Create `<BUCKET_NAME>` in us-west-2.
27-
* Add the lifecycle to automatic clean up the `upload/` after one day
28-
* Upload files:
29-
+ `pre-existing-10MB-aes256-c` [SSE-C](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#sse-c-highlights) encrypted fille
30-
+ `pre-existing-10MB-aes256` [SSE-S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/specifying-s3-encryption.html) encrypted fille
31-
+ `pre-existing-10MB-kms` [SSE-KMS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html) encrypted fille
32-
+ `pre-existing-10MB`
33-
+ `pre-existing-1MB`
34-
+ `pre-existing-empty`
35-
+ `pre-existing-error-xml`
36-
+ with `--large_objects` enabled, several large objects will also be uploaded. Currently, only aws-c-s3's tests require these files, the aws-crt-*** repos do not:
37-
- `pre-existing-256MB`
38-
- `pre-existing-256MB-@`
39-
- `pre-existing-2GB`
40-
- `pre-existing-2GB-@`
41-
42-
* Create `<BUCKET_NAME>-public` in us-west-2
43-
* Upload files:
44-
+ `pre-existing-1MB` 1MB file with public read access.
27+
+ Add the lifecycle to automatic clean up the `upload/` and clean up incomplete multipart uploads after one day.
28+
+ Upload files:
29+
- `pre-existing-10MB-aes256-c` [SSE-C](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#sse-c-highlights) encrypted fille
30+
- `pre-existing-10MB-aes256` [SSE-S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/specifying-s3-encryption.html) encrypted fille
31+
- `pre-existing-10MB-kms` [SSE-KMS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingKMSEncryption.html) encrypted fille
32+
- `pre-existing-10MB`
33+
- `pre-existing-1MB`
34+
- `pre-existing-empty`
35+
- `pre-existing-error-xml`
36+
- with `--large_objects` enabled, several large objects will also be uploaded. Currently, only aws-c-s3's tests require these files, the aws-crt-*** repos do not:
37+
- `pre-existing-256MB`
38+
- `pre-existing-256MB-@`
39+
- `pre-existing-2GB`
40+
- `pre-existing-2GB-@`
41+
42+
* with `--create_public_bucket` enabled, create `<BUCKET_NAME>-public` in us-west-2
43+
+ Upload files:
44+
- `pre-existing-1MB` 1MB file with public read access.
4545

4646
* Create directory bucket `<BUCKET_NAME>--usw2-az1--x-s3` in us-west-2
47-
* Upload files:
48-
+ `pre-existing-10MB` 10MB file.
49-
+ with `--large_objects` enabled
50-
- `pre-existing-2GB`
47+
+ Add the lifecycle to automatic clean up the `upload/` and clean up incomplete multipart uploads after one day.
48+
+ Upload files:
49+
- `pre-existing-10MB` 10MB file.
50+
- with `--large_objects` enabled
51+
- `pre-existing-2GB`
5152

5253
* Create directory bucket `<BUCKET_NAME>--use1-az4--x-s3` in us-east-1
53-
* Upload files:
54-
+ `pre-existing-10MB` 10MB file.
55-
+ with `--large_objects` enabled
56-
- `pre-existing-2GB`
54+
+ Add the lifecycle to automatic clean up the `upload/` and clean up incomplete multipart uploads after one day.
55+
+ Upload files:
56+
- `pre-existing-10MB` 10MB file.
57+
- with `--large_objects` enabled
58+
- `pre-existing-2GB`
5759

5860
### `clean` action
5961

tests/test_helper/test_helper.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@
2828
parser.add_argument(
2929
'bucket_name',
3030
nargs='?',
31-
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.')
31+
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. \
32+
Otherwise, a random name will be generated.')
3233
parser.add_argument(
3334
'--large_objects',
3435
action='store_true',
3536
help='enable helper to create pre-existing large objects.')
36-
37+
parser.add_argument(
38+
'--create_public_bucket',
39+
action='store_true',
40+
help='Allow script to create a public bucket. If not specified, the script will not attempt to create a public bucket. \
41+
Note: Some aws-c-s3 tests will fail without public bucket.')
3742

3843
args = parser.parse_args()
3944

@@ -256,7 +261,11 @@ def cleanup(bucket_name, availability_zone=None, client=s3_client):
256261
create_bucket_with_lifecycle("use1-az4", s3_client_east1, "us-east-1")
257262
create_bucket_with_lifecycle("usw2-az1")
258263
create_bucket_with_lifecycle()
259-
create_bucket_with_public_object()
264+
if args.create_public_bucket:
265+
create_bucket_with_public_object()
266+
else:
267+
print("Skipping public bucket, run with --create_public_bucket if you need these.")
268+
260269
if os.environ.get('CRT_S3_TEST_BUCKET_NAME') != BUCKET_NAME_BASE:
261270
print(
262271
f"*** Set the environment variable $CRT_S3_TEST_BUCKET_NAME to {BUCKET_NAME_BASE} before running the tests ***")

0 commit comments

Comments
 (0)