github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/acceptance/README.md (about) 1 # Golangsdk Acceptance tests 2 3 The purpose of these acceptance tests is to validate that SDK features meet 4 the requirements of a contract - to consumers, other parts of the library, and 5 to a remote API. 6 7 > **Note:** Because every test will be run against a real API endpoint, you 8 > may incur bandwidth and service charges for all the resource usage. These 9 > tests *should* remove their remote products automatically. However, there may 10 > be certain cases where this does not happen; always double-check to make sure 11 > you have no stragglers left behind. 12 13 ### Step 1. Set environment variables 14 15 Tests rely on environment variables for configuration, so you will need 16 to set them manually before running the suite. 17 18 #### Authentication 19 20 |Name|Description| 21 |---|---| 22 |`OS_USERNAME`|Your API username| 23 |`OS_PASSWORD`|Your API password| 24 |`OS_DOMAIN_NAME`|Your API account name| 25 |`OS_DOMAIN_ID`|Your API account ID| 26 |`OS_TENANT_NAME`|Your API project name| 27 |`OS_TENANT_ID`|Your API project ID| 28 |`OS_REGION_NAME`|The region you want your resources to reside in| 29 |`OS_AUTH_URL`|The identity URL you need to authenticate| 30 31 #### Compute 32 33 |Name|Description| 34 |---|---| 35 |`OS_IMAGE_ID`|The ID of the image your want your server to be based on| 36 |`OS_FLAVOR_ID`|The ID of the flavor you want your server to be based on| 37 |`OS_FLAVOR_ID_RESIZE`|The ID of the flavor you want your server to be resized to| 38 |`OS_POOL_NAME`|The Pool from where to obtain Floating IPs| 39 |`OS_NETWORK_NAME`|The internal/private network to launch instances on| 40 |`OS_EXTGW_ID`|The external/public network| 41 42 #### Shared file systems 43 |Name|Description| 44 |---|---| 45 |`OS_SHARE_NETWORK_ID`| The share network ID to use when creating shares| 46 47 ### 2. Run the test suite 48 49 From the root directory, run: 50 51 ``` 52 ./script/acceptancetest 53 ``` 54 55 Alternatively, add the following to your `.bashrc`: 56 57 ```bash 58 golangsdktest() { 59 if [[ -n $1 ]] && [[ -n $2 ]]; then 60 pushd $GOPATH/src/github.com/huaweicloud/golangsdk 61 go test -v github.com/huaweicloud/golangsdk/acceptance/openstack/$1 -run "$2" | tee ~/golangsdk.log 62 popd 63 fi 64 } 65 ``` 66 67 Then run either groups or individual tests by doing: 68 69 ```shell 70 $ golangsdktest networking/v1 TestVpcList 71 $ golangsdktest networking/v1 TestVpcsCRUD 72 ``` 73