Skip to content

Commit

Permalink
chore: make testing appid configurable through env-var
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagashino committed Sep 15, 2021
1 parent e44dc0c commit 2babe69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,24 @@ log.Println("[DEBUG] the message and some import values: %v", importantValues)
### Test

The quicker way for development and debug is writing test cases.
How to trigger running the test cases, please refer the `test.sh` script.
How to write test cases, check the `xxx_test.go` files.

Config environment variables:
```
export TF_ACC=true
```

Config your appid for COS bucket testing
```
export TENCENTCLOUD_APPID=1234567890
```

This example show how to test single test function:
```
cd tencentcloud
go test -i; go test -test.run TestAccTencentCloudNatGateway_basic -v
```

To write test cases, check the `xxx_test.go` files for more reference.

### Avoid ``terrafrom init``

Expand Down
3 changes: 2 additions & 1 deletion tencentcloud/basic_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package tencentcloud

import "os"
/*
---------------------------------------------------
If you want to run through the test cases,
the following must be changed to your resource id.
---------------------------------------------------
*/

const appid string = "1259649581"
var appid string = os.Getenv("TENCENTCLOUD_APPID")

const (
defaultRegion = "ap-guangzhou"
Expand Down

0 comments on commit 2babe69

Please sign in to comment.