go test -v ./internal/provider/
Note: Acceptance tests may create real resources, and often cost money to run.
- Go: The most recent stable version.
- Terraform CLI: Version 0.12.26 or later.
You need to set API Key with environment before all the tests
export TIDBCLOUD_PUBLIC_KEY=${public_key}
export TIDBCLOUD_PRIVATE_KEY=${private_key}
The tests need project are put into the /internal/provide/testwithproject path.
some tests like cluster_resource_test may cause cost, make sure you have enough balance
Here are the steps to test them:
-
create a new project for test in tidb cloud (You can also use the default project, but it is not recommended)
-
set projectId with environment
export TIDBCLOUD_PROJECT_ID=${your_project_id}
- test
TF_ACC=1 go test -v ./internal/provider/testwithproject
Some tests may generate costs and will not be tested by default. To run them, you need to set the environment variable TIDBCLOUD_ENABLE_COST
to true
.
export TIDBCLOUD_ENABLE_COST=true
The tests need pre-created TiDB cluster are put into the /internal/provider/testwithcluster path
Here are the steps to test them:
-
Create a dedicated cluster and wait for it is ready. You can create it with tidb cloud or terraform
-
set projectId and clusterId with environment
export TIDBCLOUD_PROJECT_ID=${your_project_id}
export TIDBCLOUD_CLUSTER_ID=${your_cluster_id}
- test
TF_ACC=1 go test -v ./internal/provider/testwithcluster
The tests can't be tested directly are put into the /internal/provider/testmanually path
You need to test them manually following the code annotation in every test.