Skip to content

Commit 79d5c8a

Browse files
tongyimingmikatong
andauthored
hpc unit-test support change region (#1468)
* hpc unit-test support change region * remove needfix flag Co-authored-by: mikatong <mikatong@tencent.com>
1 parent 1bad7e1 commit 79d5c8a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tencentcloud/provider_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ func testAccStepPreConfigSetTempAKSK(t *testing.T, accountType string) {
8585
testAccPreCheckCommon(t, accountType)
8686
}
8787

88+
func testAccStepSetRegion(t *testing.T, region string) {
89+
os.Setenv(PROVIDER_REGION, region)
90+
}
91+
8892
func testAccPreCheckCommon(t *testing.T, accountType string) {
8993
if v := os.Getenv(PROVIDER_REGION); v == "" {
9094
log.Printf("[INFO] Testing: Using %s as test region", defaultRegion)

tencentcloud/resource_tc_cvm_hpc_cluster_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
77
)
88

9-
func TestAccTencentCloudNeedFixCvmHpcClusterResource_basic(t *testing.T) {
9+
func TestAccTencentCloudCvmHpcClusterResource_basic(t *testing.T) {
1010
t.Parallel()
1111
resource.Test(t, resource.TestCase{
1212
PreCheck: func() {
@@ -15,8 +15,13 @@ func TestAccTencentCloudNeedFixCvmHpcClusterResource_basic(t *testing.T) {
1515
Providers: testAccProviders,
1616
Steps: []resource.TestStep{
1717
{
18-
Config: testAccCvmHpcCluster,
19-
Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_cvm_hpc_cluster.hpc_cluster", "id")),
18+
Config: testAccCvmHpcCluster,
19+
PreConfig: func() { testAccStepSetRegion(t, "ap-beijing") },
20+
Check: resource.ComposeTestCheckFunc(
21+
resource.TestCheckResourceAttrSet("tencentcloud_cvm_hpc_cluster.hpc_cluster", "id"),
22+
resource.TestCheckResourceAttrSet("tencentcloud_cvm_hpc_cluster.hpc_cluster", "name"),
23+
resource.TestCheckResourceAttrSet("tencentcloud_cvm_hpc_cluster.hpc_cluster", "remark"),
24+
),
2025
},
2126
{
2227
ResourceName: "tencentcloud_cvm_hpc_cluster.hpc_cluster",

0 commit comments

Comments
 (0)