Skip to content

Commit 2eae237

Browse files
committed
fix: moidfy test
1 parent e213ff2 commit 2eae237

4 files changed

+13
-11
lines changed

tencentcloud/services/monitor/service_tencentcloud_monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ func (me *MonitorService) DescribeMonitorTmpAlertRuleById(ctx context.Context, i
616616
}()
617617

618618
request.InstanceId = &instanceId
619-
request.RuleId = &tmpAlertRuleId
619+
// request.RuleId = &tmpAlertRuleId
620620

621621
ratelimit.Check(request.GetAction())
622622
response, err := me.client.UseMonitorClient().DescribeAlertRules(request)

tencentcloud/services/tmp/resource_tc_monitor_tmp_alert_group_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ resource "tencentcloud_monitor_tmp_alert_group" "tmp_alert_group" {
112112
"notice-om017kc2",
113113
]
114114
group_name = "tf-test"
115-
instance_id = tencentcloud_monitor_tmp_instance.basic.id
115+
instance_id = tencentcloud_monitor_tmp_instance.example.id
116116
repeat_interval = "5m"
117117
118118
custom_receiver {
@@ -145,7 +145,7 @@ resource "tencentcloud_monitor_tmp_alert_group" "tmp_alert_group" {
145145
"notice-om017kc2",
146146
]
147147
group_name = "tf-test-up"
148-
instance_id = tencentcloud_monitor_tmp_instance.basic.id
148+
instance_id = tencentcloud_monitor_tmp_instance.example.id
149149
repeat_interval = "1h"
150150
151151
custom_receiver {

tencentcloud/services/tmp/resource_tc_monitor_tmp_alert_rule_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func testAccCheckAlertRuleExists(r string) resource.TestCheckFunc {
125125

126126
const testAlertRule_basic = testInstance_basic + `
127127
resource "tencentcloud_monitor_tmp_alert_rule" "basic" {
128-
instance_id = tencentcloud_monitor_tmp_instance.basic.id
128+
instance_id = tencentcloud_monitor_tmp_instance.example.id
129129
rule_name = "test-rule_name"
130130
receivers = ["notice-tj75hgqj"]
131131
expr = "increase(mysql_global_status_slow_queries[1m]) > 0"
@@ -143,7 +143,7 @@ resource "tencentcloud_monitor_tmp_alert_rule" "basic" {
143143

144144
const testAlertRule_update = testInstance_basic + `
145145
resource "tencentcloud_monitor_tmp_alert_rule" "basic" {
146-
instance_id = tencentcloud_monitor_tmp_instance.basic.id
146+
instance_id = tencentcloud_monitor_tmp_instance.example.id
147147
rule_name = "test-rule_name_update"
148148
receivers = ["notice-tj75hgqj"]
149149
expr = "increase(mysql_global_status_slow_queries[1m]) > 1"

tencentcloud/services/tmp/resource_tc_monitor_tmp_tke_alert_policy.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,15 @@ func resourceTencentCloudTkeTmpAlertPolicyRead(d *schema.ResourceData, meta inte
491491
}
492492

493493
notify := tmpAlertPolicy.Notification
494-
alertManager := map[string]interface{}{
495-
"url": notify.AlertManager.Url,
496-
"cluster_type": notify.AlertManager.ClusterType,
497-
"cluster_id": notify.AlertManager.ClusterId,
498-
}
499494
var alertManagers []map[string]interface{}
500-
alertManagers = append(alertManagers, alertManager)
495+
if notify.AlertManager != nil {
496+
alertManager := map[string]interface{}{
497+
"url": notify.AlertManager.Url,
498+
"cluster_type": notify.AlertManager.ClusterType,
499+
"cluster_id": notify.AlertManager.ClusterId,
500+
}
501+
alertManagers = append(alertManagers, alertManager)
502+
}
501503

502504
var notifyWay []string
503505
if len(notify.NotifyWay) > 0 {

0 commit comments

Comments
 (0)