Skip to content

Commit cbe75b8

Browse files
committed
test: modify tencentcloud_cvm_reboot_instance test
1 parent c4543be commit cbe75b8

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

tencentcloud/services/cvm/resource_tc_cvm_reboot_instance_test.go

+31-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,42 @@ func TestAccTencentCloudCvmRebootInstanceResource_basic(t *testing.T) {
1818
Steps: []resource.TestStep{
1919
{
2020
Config: testAccCvmRebootInstance,
21-
Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_cvm_reboot_instance.reboot_instance", "id")),
21+
Check: resource.ComposeTestCheckFunc(
22+
resource.TestCheckResourceAttrSet("tencentcloud_cvm_reboot_instance.reboot", "id"),
23+
),
2224
},
2325
},
2426
})
2527
}
2628

27-
const testAccCvmRebootInstance = tcacctest.DefaultRebootCvmVariable + `
29+
const testAccCvmRebootInstance = `
30+
data "tencentcloud_images" "default" {
31+
image_type = ["PUBLIC_IMAGE"]
32+
image_name_regex = "Final"
33+
}
34+
data "tencentcloud_instance_types" "default" {
35+
memory_size = 2
36+
exclude_sold_out = true
37+
filter {
38+
name = "instance-family"
39+
values = ["SA2","SA3","SA4","SA5","S2","S3"]
40+
}
41+
filter {
42+
name = "zone"
43+
values = ["ap-guangzhou-7"]
44+
}
45+
cpu_core_count = 2
46+
}
47+
resource "tencentcloud_instance" "test_cvm" {
48+
image_id = data.tencentcloud_images.default.images.0.image_id
49+
availability_zone = "ap-guangzhou-7"
50+
instance_type = "SA2.MEDIUM2"
51+
orderly_security_groups = ["sg-5275dorp"]
52+
instance_charge_type = "POSTPAID_BY_HOUR"
53+
}
2854
29-
resource "tencentcloud_cvm_reboot_instance" "reboot_instance" {
30-
instance_id = var.cvm_id
31-
stop_type = "SOFT_FIRST"
55+
resource tencentcloud_cvm_reboot_instance reboot {
56+
instance_id = tencentcloud_instance.test_cvm.id
57+
stop_type = "SOFT"
3258
}
3359
`

0 commit comments

Comments
 (0)