From 6f879904cec3e02df06a8647545161e1bd2886db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Brod=C3=A9n?= Date: Mon, 22 Apr 2024 19:45:59 +0200 Subject: [PATCH] Update resource names --- cloudamqp/resource_cloudamqp_alarm_test.go | 34 +++++++++---------- cloudamqp/resource_cloudamqp_instance_test.go | 18 +++++----- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cloudamqp/resource_cloudamqp_alarm_test.go b/cloudamqp/resource_cloudamqp_alarm_test.go index c6bbee98..8babeb0d 100644 --- a/cloudamqp/resource_cloudamqp_alarm_test.go +++ b/cloudamqp/resource_cloudamqp_alarm_test.go @@ -12,13 +12,13 @@ import ( // TestAccAlarm_Basic: Create CPU alarm, import and change values. func TestAccAlarm_Basic(t *testing.T) { var ( - fileNames = []string{"instance", "notification", "data_source/notification_default", "alarm"} - instanceResourceName = "cloudamqp_instance.instance" - defaultRecipientResourceName = "data.cloudamqp_notification.default_recipient" - recipientResourceName = "cloudamqp_notification.recipient" - noticeAlarmResourceName = "cloudamqp_alarm.notice" - cpuAlarmResourceName = "cloudamqp_alarm.cpu" - dataCpuAlarmResourceName = "data.cloudamqp_alarm.cpu" + fileNames = []string{"instance", "notification", "data_source/notification_default", "alarm"} + instanceResourceName = "cloudamqp_instance.instance" + dataSourceNotificationName = "data.cloudamqp_notification.default_recipient" + recipientResourceName = "cloudamqp_notification.recipient" + noticeAlarmResourceName = "cloudamqp_alarm.notice" + cpuAlarmResourceName = "cloudamqp_alarm.cpu" + dataSourceCpuAlarmName = "data.cloudamqp_alarm.cpu" params = map[string]string{ "InstanceName": "TestAccAlarm_Basic", @@ -27,7 +27,7 @@ func TestAccAlarm_Basic(t *testing.T) { "RecipientType": "email", "RecipientValue": "test@example.com", "NoticeRecipients": fmt.Sprintf("%s, %s", - fmt.Sprintf("%s.id", defaultRecipientResourceName), + fmt.Sprintf("%s.id", dataSourceNotificationName), fmt.Sprintf("%s.id", recipientResourceName), ), "CPUAlarmEnabled": "true", @@ -44,7 +44,7 @@ func TestAccAlarm_Basic(t *testing.T) { "RecipientName": "test", "RecipientType": "email", "RecipientValue": "test@example.com", - "NoticeRecipients": fmt.Sprintf("%s.id", defaultRecipientResourceName), + "NoticeRecipients": fmt.Sprintf("%s.id", dataSourceNotificationName), "CPUAlarmType": "cpu", "CPUAlarmEnabled": "true", "CPUAlarmTimeThreshold": "450", @@ -93,14 +93,14 @@ func TestAccAlarm_Basic(t *testing.T) { resource.TestCheckResourceAttr(cpuAlarmResourceName, "reminder_interval", paramsUpdated["CPUAlarmReminderInterval"]), resource.TestCheckResourceAttr(cpuAlarmResourceName, "recipients.#", "1"), // validate data sources - resource.TestCheckResourceAttr(defaultRecipientResourceName, "name", "Default"), - resource.TestCheckResourceAttr(defaultRecipientResourceName, "type", "email"), - resource.TestCheckResourceAttr(dataCpuAlarmResourceName, "type", "cpu"), - resource.TestCheckResourceAttr(dataCpuAlarmResourceName, "enabled", params["CPUAlarmEnabled"]), - resource.TestCheckResourceAttr(dataCpuAlarmResourceName, "time_threshold", params["CPUAlarmTimeThreshold"]), - resource.TestCheckResourceAttr(dataCpuAlarmResourceName, "value_threshold", params["CPUAlarmValueThreshold"]), - resource.TestCheckResourceAttr(dataCpuAlarmResourceName, "reminder_interval", params["CPUAlarmReminderInterval"]), - resource.TestCheckResourceAttr(dataCpuAlarmResourceName, "recipients.#", "1"), + resource.TestCheckResourceAttr(dataSourceNotificationName, "name", "Default"), + resource.TestCheckResourceAttr(dataSourceNotificationName, "type", "email"), + resource.TestCheckResourceAttr(dataSourceCpuAlarmName, "type", "cpu"), + resource.TestCheckResourceAttr(dataSourceCpuAlarmName, "enabled", params["CPUAlarmEnabled"]), + resource.TestCheckResourceAttr(dataSourceCpuAlarmName, "time_threshold", params["CPUAlarmTimeThreshold"]), + resource.TestCheckResourceAttr(dataSourceCpuAlarmName, "value_threshold", params["CPUAlarmValueThreshold"]), + resource.TestCheckResourceAttr(dataSourceCpuAlarmName, "reminder_interval", params["CPUAlarmReminderInterval"]), + resource.TestCheckResourceAttr(dataSourceCpuAlarmName, "recipients.#", "1"), ), }, }, diff --git a/cloudamqp/resource_cloudamqp_instance_test.go b/cloudamqp/resource_cloudamqp_instance_test.go index c174d21a..c59d518a 100644 --- a/cloudamqp/resource_cloudamqp_instance_test.go +++ b/cloudamqp/resource_cloudamqp_instance_test.go @@ -13,9 +13,9 @@ import ( // nodes data source. func TestAccInstance_Basic(t *testing.T) { var ( - fileNames = []string{"instance", "data_source/nodes"} - instanceResourceName = "cloudamqp_instance.instance" - dataNodesResourceName = "data.cloudamqp_nodes.nodes" + fileNames = []string{"instance", "data_source/nodes"} + instanceResourceName = "cloudamqp_instance.instance" + dataSourceNodesName = "data.cloudamqp_nodes.nodes" params = map[string]string{ "InstanceName": "TestAccInstance_Basic-before", @@ -43,9 +43,9 @@ func TestAccInstance_Basic(t *testing.T) { resource.TestCheckResourceAttr(instanceResourceName, "tags.#", "1"), resource.TestCheckResourceAttr(instanceResourceName, "tags.0", "terraform"), resource.TestCheckResourceAttr(instanceResourceName, "nodes", "1"), - resource.TestCheckResourceAttr(dataNodesResourceName, "nodes.#", "1"), - resource.TestCheckResourceAttr(dataNodesResourceName, "nodes.0.configured", "true"), - resource.TestCheckResourceAttr(dataNodesResourceName, "nodes.0.running", "true"), + resource.TestCheckResourceAttr(dataSourceNodesName, "nodes.#", "1"), + resource.TestCheckResourceAttr(dataSourceNodesName, "nodes.0.configured", "true"), + resource.TestCheckResourceAttr(dataSourceNodesName, "nodes.0.running", "true"), ), }, { @@ -58,9 +58,9 @@ func TestAccInstance_Basic(t *testing.T) { resource.TestCheckResourceAttr(instanceResourceName, "tags.0", "terraform"), resource.TestCheckResourceAttr(instanceResourceName, "tags.1", "acceptance-test"), resource.TestCheckResourceAttr(instanceResourceName, "nodes", "1"), - resource.TestCheckResourceAttr(dataNodesResourceName, "nodes.#", "1"), - resource.TestCheckResourceAttr(dataNodesResourceName, "nodes.0.configured", "true"), - resource.TestCheckResourceAttr(dataNodesResourceName, "nodes.0.running", "true"), + resource.TestCheckResourceAttr(dataSourceNodesName, "nodes.#", "1"), + resource.TestCheckResourceAttr(dataSourceNodesName, "nodes.0.configured", "true"), + resource.TestCheckResourceAttr(dataSourceNodesName, "nodes.0.running", "true"), ), }, {