Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tencentcloud/acctest/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"os"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -251,3 +252,10 @@ func SharedClientForRegion(region string) (interface{}, error) {

return &tcClient, nil
}

func AccStepTimeSleepDuration(d time.Duration) resource.TestCheckFunc {
return func(s *terraform.State) error {
time.Sleep(d)
return nil
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cvm_test

import (
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
"testing"

tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"testing"
"time"

tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
Expand All @@ -14,8 +15,8 @@ import (
sdkErrors "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
)

// go test -i; go test -test.run TestAccTencentCloudNeedFixTdmqRocketmqVipInstanceResource_basic -v
func TestAccTencentCloudNeedFixTdmqRocketmqVipInstanceResource_basic(t *testing.T) {
// go test -i; go test -test.run TestAccTencentCloudTdmqRocketmqVipInstanceResource_basic -v -timeout=0
func TestAccTencentCloudTdmqRocketmqVipInstanceResource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
Expand All @@ -33,6 +34,7 @@ func TestAccTencentCloudNeedFixTdmqRocketmqVipInstanceResource_basic(t *testing.
resource.TestCheckResourceAttrSet("tencentcloud_tdmq_rocketmq_vip_instance.example", "spec"),
resource.TestCheckResourceAttrSet("tencentcloud_tdmq_rocketmq_vip_instance.example", "node_count"),
resource.TestCheckResourceAttrSet("tencentcloud_tdmq_rocketmq_vip_instance.example", "storage_size"),
tcacctest.AccStepTimeSleepDuration(1*time.Minute),
),
},
{
Expand All @@ -44,6 +46,7 @@ func TestAccTencentCloudNeedFixTdmqRocketmqVipInstanceResource_basic(t *testing.
resource.TestCheckResourceAttrSet("tencentcloud_tdmq_rocketmq_vip_instance.example", "spec"),
resource.TestCheckResourceAttrSet("tencentcloud_tdmq_rocketmq_vip_instance.example", "node_count"),
resource.TestCheckResourceAttrSet("tencentcloud_tdmq_rocketmq_vip_instance.example", "storage_size"),
tcacctest.AccStepTimeSleepDuration(1*time.Minute),
),
},
},
Expand Down Expand Up @@ -100,7 +103,7 @@ func testAccCheckTdmqRocketmqVipInstanceExists(r string) resource.TestCheckFunc
}
}

const testAccTdmqRocketmqVipInstance = tcacctest.DefaultVpcSubnets + `
const testAccTdmqRocketmqVipInstance = `
data "tencentcloud_availability_zones" "zones" {}

# create vpc
Expand Down