Debian Codegraph @

crt/aws-c-s3/tests/test_helper/README.md

raw symbols SCIP
1 # Helper script to setup your S3 structure to run the tests for aws-c-s3
2
3 To use this script, you must have AWS credentials with permission to create and delete buckets.
4
5 To create the S3 buckets and objects that tests will use:
6
7 ```sh
8 pip3 install boto3
9 export CRT_S3_TEST_BUCKET_NAME=<bucket_name>
10 python3 test_helper.py init
11 # change directory to the build/tests
12 cd aws-c-s3/build/tests && ctest
13 ```
14
15 To clean up the S3 buckets created
16
17 ```sh
18 export CRT_S3_TEST_BUCKET_NAME=<bucket_name>
19 python3 test_helper.py clean
20 ```
21
22 ## Actions
23
24 ### `init` action
25
26 * Create `<BUCKET_NAME>` in us-west-2.
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-1MB-@`
35 - `pre-existing-empty`
36 - `pre-existing-error-xml`
37 - 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:
38 - `pre-existing-256MB`
39 - `pre-existing-256MB-@`
40 - `pre-existing-2GB`
41 - `pre-existing-2GB-@`
42
43 * with `--create_public_bucket` enabled, create `<BUCKET_NAME>-public` in us-west-2
44 + Upload files:
45 - `pre-existing-1MB` 1MB file with public read access.
46
47 * Create directory bucket `<BUCKET_NAME>--usw2-az1--x-s3` in us-west-2
48 + Add the lifecycle to automatic clean up the `upload/` and clean up incomplete multipart uploads after one day.
49 + Upload files:
50 - `pre-existing-10MB` 10MB file.
51 - `pre-existing-1MB` 1MB file.
52 - with `--large_objects` enabled
53 - `pre-existing-2GB`
54
55 * Create directory bucket `<BUCKET_NAME>--use1-az4--x-s3` in us-east-1
56 + Add the lifecycle to automatic clean up the `upload/` and clean up incomplete multipart uploads after one day.
57 + Upload files:
58 - `pre-existing-10MB` 10MB file.
59 - `pre-existing-1MB` 1MB file.
60 - with `--large_objects` enabled
61 - `pre-existing-2GB`
62
63 ### `clean` action
64
65 * Delete the buckets create by init action and every object inside them.
66
67 ## BUCKET_NAME
68
69 You can specify the bucket name to be created either by passing argument to the script or by setting an environment variable, the `bucket_name` passed in takes precedence. If neither of these options is chosen, the `init` action will create a random bucket name. In this case, you will need to set the `CRT_S3_TEST_BUCKET_NAME` environment variable to the printed-out bucket name before running the test.
70
71 ## Notes
72
73 * The MRAP tests are not included in this script, and it's disabled by default. To run those tests, you will need to create a MRAP access point with the buckets have `pre-existing-1MB` in it. Then update `g_test_mrap_endpoint` to the uri of the MRAP endpoint and build with `-DENABLE_MRAP_TESTS=true`.
74 * To run tests in tests/s3_mock_server_tests.c, initialize the mock S3 server first from [here](./../mock_s3_server/). And build your cmake project with `-DENABLE_MOCK_SERVER_TESTS=true`
75 * Note: If you are not at the aws-common-runtime AWS team account, you must set environment variable `CRT_S3_TEST_BUCKET_NAME` to the bucket created before running the test.
76 * When you see error with "Check your account level S3 settings, public access may be blocked.", Check https://docs.aws.amazon.com/AmazonS3/latest/userguide/configuring-block-public-access-account.html to set `BlockPublicAcls` to false, which enables public read of the object with `public-read` ACL in the bucket.
77
78 ## TODO
79
80 * Automatic the mrap creation
81 * Instead of hard-coded path and region, make it configurable and pick up from tests.