Skip to content

Commit

Permalink
Update resource names
Browse files Browse the repository at this point in the history
  • Loading branch information
tbroden84 committed Apr 22, 2024
1 parent 8f4d87b commit 6f87990
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
34 changes: 17 additions & 17 deletions cloudamqp/resource_cloudamqp_alarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -27,7 +27,7 @@ func TestAccAlarm_Basic(t *testing.T) {
"RecipientType": "email",
"RecipientValue": "[email protected]",
"NoticeRecipients": fmt.Sprintf("%s, %s",
fmt.Sprintf("%s.id", defaultRecipientResourceName),
fmt.Sprintf("%s.id", dataSourceNotificationName),
fmt.Sprintf("%s.id", recipientResourceName),
),
"CPUAlarmEnabled": "true",
Expand All @@ -44,7 +44,7 @@ func TestAccAlarm_Basic(t *testing.T) {
"RecipientName": "test",
"RecipientType": "email",
"RecipientValue": "[email protected]",
"NoticeRecipients": fmt.Sprintf("%s.id", defaultRecipientResourceName),
"NoticeRecipients": fmt.Sprintf("%s.id", dataSourceNotificationName),
"CPUAlarmType": "cpu",
"CPUAlarmEnabled": "true",
"CPUAlarmTimeThreshold": "450",
Expand Down Expand Up @@ -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"),
),
},
},
Expand Down
18 changes: 9 additions & 9 deletions cloudamqp/resource_cloudamqp_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"),
),
},
{
Expand All @@ -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"),
),
},
{
Expand Down

0 comments on commit 6f87990

Please sign in to comment.