Skip to content

Commit 8c7a2e2

Browse files
authored
fix: update tmp_config unit (#1333)
* fix: update tmp_config unit * fix: update tmp_config unit Co-authored-by: arunma <arunma@tencent.com>
1 parent 80ec2a0 commit 8c7a2e2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tencentcloud/resource_tc_monitor_tmp_tke_config_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ func TestAccTencentCloudMonitorTmpTkeConfig_basic(t *testing.T) {
7070
{
7171
Config: testAccTmpTkeConfig_update,
7272
Check: resource.ComposeTestCheckFunc(
73-
testAccCheckTmpTkeConfigExists("tencentcloud_monitor_tmp_tke_config.update"),
74-
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.update", "instance_id", defaultPrometheusId),
75-
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.update", "cluster_type", defaultTkeClusterType),
76-
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.update", "cluster_id", defaultTkeClusterId),
77-
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.update", "raw_jobs.0.config", "scrape_configs:\n- job_name: "+raw_job_name+"\n scrape_interval: 20s\n honor_labels: true\n"),
78-
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.update", "service_monitors.0.config", "apiVersion: monitoring.coreos.com/v1\nkind: ServiceMonitor\nmetadata:\n name: "+service_monitors_name+"\n namespace: kube-system\nspec:\n endpoints:\n - interval: 20s\n port: 8080-8080-tcp\n path: /metrics\n relabelings:\n - action: replace\n sourceLabels:\n - __meta_kubernetes_pod_label_app\n targetLabel: application\n namespaceSelector:\n matchNames:\n - test\n selector:\n matchLabels:\n app: test"),
79-
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.update", "pod_monitors.0.config", "apiVersion: monitoring.coreos.com/v1\nkind: PodMonitor\nmetadata:\n name: "+pod_monitors_name+"\n namespace: kube-system\nspec:\n podMetricsEndpoints:\n - interval: 20s\n port: metric-port\n path: /metrics\n relabelings:\n - action: replace\n sourceLabels:\n - instance\n regex: (.*)\n targetLabel: instance\n replacement: xxxxxx\n namespaceSelector:\n matchNames:\n - test\n selector:\n matchLabels:\n k8s-app: test"),
73+
testAccCheckTmpTkeConfigExists("tencentcloud_monitor_tmp_tke_config.basic"),
74+
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.basic", "instance_id", defaultPrometheusId),
75+
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.basic", "cluster_type", defaultTkeClusterType),
76+
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.basic", "cluster_id", defaultTkeClusterId),
77+
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.basic", "raw_jobs.0.config", "scrape_configs:\n- job_name: "+raw_job_name+"\n scrape_interval: 20s\n honor_labels: true\n"),
78+
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.basic", "service_monitors.0.config", "apiVersion: monitoring.coreos.com/v1\nkind: ServiceMonitor\nmetadata:\n name: "+service_monitors_name+"\n namespace: kube-system\nspec:\n endpoints:\n - interval: 20s\n port: 8080-8080-tcp\n path: /metrics\n relabelings:\n - action: replace\n sourceLabels:\n - __meta_kubernetes_pod_label_app\n targetLabel: application\n namespaceSelector:\n matchNames:\n - test\n selector:\n matchLabels:\n app: test"),
79+
resource.TestCheckResourceAttr("tencentcloud_monitor_tmp_tke_config.basic", "pod_monitors.0.config", "apiVersion: monitoring.coreos.com/v1\nkind: PodMonitor\nmetadata:\n name: "+pod_monitors_name+"\n namespace: kube-system\nspec:\n podMetricsEndpoints:\n - interval: 20s\n port: metric-port\n path: /metrics\n relabelings:\n - action: replace\n sourceLabels:\n - instance\n regex: (.*)\n targetLabel: instance\n replacement: xxxxxx\n namespaceSelector:\n matchNames:\n - test\n selector:\n matchLabels:\n k8s-app: test"),
8080
),
8181
},
8282
},
@@ -228,7 +228,7 @@ resource "tencentcloud_monitor_tmp_tke_config" "basic" {
228228
}`
229229

230230
const testAccTmpTkeConfig_update = testAccTmpTkeConfigVar + `
231-
resource "tencentcloud_monitor_tmp_tke_config" "update" {
231+
resource "tencentcloud_monitor_tmp_tke_config" "basic" {
232232
instance_id = var.prometheus_id
233233
cluster_type = var.tke_cluster_type
234234
cluster_id = var.tke_cluster_id

0 commit comments

Comments
 (0)