Skip to content

Commit ce0f87b

Browse files
authored
fix(ccn): [120224824] Update tencentcloud_ccn_route_table_input_policies unit test (#2915)
* add * add * add
1 parent 8d3833b commit ce0f87b

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

.changelog/2915.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
datasource/tencentcloud_ccn_route_table_input_policies: Update unit test
3+
```

tencentcloud/services/ccn/data_source_tc_ccn_route_table_input_policies_test.go

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
88
)
99

10+
// go test -i; go test -test.run TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic -v
1011
func TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic(t *testing.T) {
1112
t.Parallel()
1213
resource.Test(t, resource.TestCase{
@@ -20,14 +21,47 @@ func TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic(t *testing.T)
2021
tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_ccn_route_table_input_policies.example"),
2122
resource.TestCheckResourceAttrSet("data.tencentcloud_ccn_route_table_input_policies.example", "ccn_id"),
2223
resource.TestCheckResourceAttrSet("data.tencentcloud_ccn_route_table_input_policies.example", "route_table_id"),
24+
resource.TestCheckResourceAttr("data.tencentcloud_ccn_route_table_input_policies.example", "policy_set.#", "1"),
2325
),
2426
}},
2527
})
2628
}
2729

2830
const testAccCcnRouteTableInputPoliciesDataSource = `
31+
resource "tencentcloud_ccn" "example" {
32+
name = "tf-example"
33+
description = "description."
34+
qos = "AG"
35+
charge_type = "PREPAID"
36+
bandwidth_limit_type = "INTER_REGION_LIMIT"
37+
tags = {
38+
createBy = "terraform"
39+
}
40+
}
41+
42+
resource "tencentcloud_ccn_route_table" "example" {
43+
ccn_id = tencentcloud_ccn.example.id
44+
name = "tf-example"
45+
description = "desc."
46+
}
47+
48+
resource "tencentcloud_ccn_route_table_input_policies" "example" {
49+
ccn_id = tencentcloud_ccn.example.id
50+
route_table_id = tencentcloud_ccn_route_table.example.id
51+
policies {
52+
action = "accept"
53+
description = "desc."
54+
route_conditions {
55+
name = "instance-region"
56+
values = ["ap-guangzhou"]
57+
match_pattern = 1
58+
}
59+
}
60+
}
61+
2962
data "tencentcloud_ccn_route_table_input_policies" "example" {
30-
ccn_id = "ccn-06jek8tf"
31-
route_table_id = "ccnrtb-4jv5ltb9"
63+
depends_on = [ tencentcloud_ccn_route_table_input_policies.example ]
64+
ccn_id = tencentcloud_ccn.example.id
65+
route_table_id = tencentcloud_ccn_route_table.example.id
3266
}
3367
`

0 commit comments

Comments
 (0)