|
1 | 1 | # Ali Storage CLI |
2 | 2 |
|
3 | 3 | The Ali Storage CLI is for uploading, fetching and deleting content to and from an Ali OSS. |
4 | | -It is highly inspired by the https://github.com/cloudfoundry/bosh-s3cli. |
| 4 | +It is highly inspired by the [storage-cli/s3](https://github.com/cloudfoundry/storage-cli/blob/6058f516e9b81471b64a50b01e228158a05731f0/s3) |
5 | 5 |
|
6 | 6 | ## Usage |
7 | 7 |
|
@@ -47,14 +47,32 @@ curl -X PUT -T path/to/file <signed url> |
47 | 47 | # Downloading a blob: |
48 | 48 | curl -X GET <signed url> |
49 | 49 | ``` |
50 | | -## Running integration tests |
51 | | - |
52 | | -To run the integration tests: |
53 | | -- Export the following variables into your environment: |
54 | | - ``` bash |
55 | | - export ACCESS_KEY_ID=<your Alibaba access key id> |
56 | | - export ACCESS_KEY_SECRET=<your Alibaba access key secret> |
57 | | - export ENDPOINT=<your Alibaba OSS endpoint> |
58 | | - export BUCKET_NAME=<your Alibaba OSS bucket> |
59 | | - ``` |
60 | | -- go build && go test ./integration/... |
| 50 | +## Running Tests |
| 51 | + |
| 52 | +### Unite Tests |
| 53 | +```bash |
| 54 | +go install github.com/onsi/ginkgo/v2/ginkgo |
| 55 | +ginkgo --skip-package=integration --randomize-all --cover -v -r ./alioss/... |
| 56 | +``` |
| 57 | +### Integration Tests |
| 58 | + |
| 59 | +- To run the integration tests with your existing bucket: |
| 60 | + 1. Export the following variables into your environment: |
| 61 | + ``` bash |
| 62 | + export ACCESS_KEY_ID=<your Alibaba access key id> |
| 63 | + export ACCESS_KEY_SECRET=<your Alibaba access key secret> |
| 64 | + export ENDPOINT=<your Alibaba OSS endpoint> |
| 65 | + export BUCKET_NAME=<your Alibaba OSS bucket> |
| 66 | + ``` |
| 67 | + 1. go build -o ./alioss ./alioss && go test ./alioss/integration/... |
| 68 | + |
| 69 | +- To run it from scratch; create a new bucket, run tests, delete the bucket |
| 70 | + 1. Create a user in your ali account and add policy `AliyunOSSFullAccess` or restrict the users with more granular policies like `oss:CreateBucket, oss:DeleteBucket` etc. |
| 71 | + 1. Create access key for the user. |
| 72 | + 1. Export `AccessKeyId` with command `export access_key_id=<AccessKeyId>`. |
| 73 | + 1. Export `AccessKeySecret` with command `export access_key_secret=<AccessKeyId>`. |
| 74 | + 1. Export `Profile` with command `export profile=<Profile>`. |
| 75 | + 1. Navigate to project's root folder. |
| 76 | + 1. Run environment setup script to create container `/.github/scripts/alioss/setup.sh`. |
| 77 | + 1. Run tests `/.github/scripts/alioss/run-int.sh`. |
| 78 | + 1. Run environment teardown script to delete test resources `/.github/scripts/alioss/teardown.sh`. |
0 commit comments