Skip to content

Commit 2b7aff7

Browse files
author
Naman Goyal
committed
SUMO-178423: minor refactoring
1 parent da6fd10 commit 2b7aff7

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

sumologic/resource_sumologic_data_forwarding_destination_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@ import (
1111
)
1212

1313
func getTestParams() (string, string, string, string, string, string) {
14-
dataForwardingResourceName := "sumologic_data_forwarding_destination.test"
15-
destinationName, description := getRandomizedDataForwardingParams()
14+
dataForwardingDestinationResourceName := "sumologic_data_forwarding_destination.test"
15+
destinationName, description := getRandomizedDataForwardingDestinationParams()
1616
testAwsRoleArn := os.Getenv("SUMOLOGIC_TEST_ROLE_ARN")
1717
testAwsBucket := os.Getenv("SUMOLOGIC_TEST_BUCKET_NAME")
1818
testAwsRegion := os.Getenv("SUMOLOGIC_TEST_AWS_REGION")
1919
println("AWS Test Bucket: ", testAwsBucket)
2020
println("AWS Test ARN: ", testAwsRoleArn)
2121
println("AWS Test Region: ", testAwsRegion)
22-
return dataForwardingResourceName, destinationName, description, testAwsRegion, testAwsRoleArn, testAwsBucket
22+
return dataForwardingDestinationResourceName, destinationName, description, testAwsRegion, testAwsRoleArn, testAwsBucket
2323
}
2424

25-
func getRandomizedDataForwardingParams() (string, string) {
25+
func getRandomizedDataForwardingDestinationParams() (string, string) {
2626
destinationName := acctest.RandomWithPrefix("tf-acc-test")
2727
description := acctest.RandomWithPrefix("tf-acc-test")
2828
return destinationName, description
2929
}
3030

3131
func TestAccSumologicDataForwarding_create(t *testing.T) {
32-
dataForwardingResourceName, destinationName, description, testAwsRegion, testAwsRoleArn, testAwsBucket := getTestParams()
32+
dataForwardingDestinationResourceName, destinationName, description, testAwsRegion, testAwsRoleArn, testAwsBucket := getTestParams()
3333
resource.Test(t, resource.TestCase{
3434
PreCheck: func() { testAccPreCheckWithAWS(t) },
3535
Providers: testAccProviders,
36-
CheckDestroy: testAccCheckDataForwardingDestroy(),
36+
CheckDestroy: testAccCheckDataForwardingDestinationDestroy(),
3737
Steps: []resource.TestStep{
3838
{
3939
Config: testAccSumologicDataForwardingCreateConfig(destinationName, description, testAwsBucket, testAwsRoleArn, testAwsRegion),
4040
Check: resource.ComposeTestCheckFunc(
41-
testAccCheckDataForwardingExists(),
42-
resource.TestCheckResourceAttr(dataForwardingResourceName, "destination_name", destinationName),
43-
resource.TestCheckResourceAttr(dataForwardingResourceName, "description", description),
44-
resource.TestCheckResourceAttr(dataForwardingResourceName, "s3_region", testAwsRegion),
45-
resource.TestCheckResourceAttr(dataForwardingResourceName, "s3_server_side_encryption", "false"),
41+
testAccCheckDataForwardingDestinationExists(),
42+
resource.TestCheckResourceAttr(dataForwardingDestinationResourceName, "destination_name", destinationName),
43+
resource.TestCheckResourceAttr(dataForwardingDestinationResourceName, "description", description),
44+
resource.TestCheckResourceAttr(dataForwardingDestinationResourceName, "s3_region", testAwsRegion),
45+
resource.TestCheckResourceAttr(dataForwardingDestinationResourceName, "s3_server_side_encryption", "false"),
4646
),
4747
},
4848
},
@@ -54,12 +54,12 @@ func TestAccSumologicDataForwarding_read(t *testing.T) {
5454
resource.Test(t, resource.TestCase{
5555
PreCheck: func() { testAccPreCheckWithAWS(t) },
5656
Providers: testAccProviders,
57-
CheckDestroy: testAccCheckDataForwardingDestroy(),
57+
CheckDestroy: testAccCheckDataForwardingDestinationDestroy(),
5858
Steps: []resource.TestStep{
5959
{
6060
Config: testAccSumologicDataForwardingCreateConfig(destinationName, description, testAwsBucket, testAwsRoleArn, testAwsRegion),
6161
Check: resource.ComposeTestCheckFunc(
62-
testAccCheckDataForwardingExists(),
62+
testAccCheckDataForwardingDestinationExists(),
6363
resource.TestCheckResourceAttr(dataForwardingResourceName, "destination_name", destinationName),
6464
resource.TestCheckResourceAttr(dataForwardingResourceName, "description", description),
6565
resource.TestCheckResourceAttr(dataForwardingResourceName, "bucket_name", testAwsBucket),
@@ -80,12 +80,12 @@ func TestAccSumologicDataForwarding_update(t *testing.T) {
8080
resource.Test(t, resource.TestCase{
8181
PreCheck: func() { testAccPreCheckWithAWS(t) },
8282
Providers: testAccProviders,
83-
CheckDestroy: testAccCheckDataForwardingDestroy(),
83+
CheckDestroy: testAccCheckDataForwardingDestinationDestroy(),
8484
Steps: []resource.TestStep{
8585
{
8686
Config: testAccSumologicDataForwardingCreateConfig(destinationName, description, testAwsBucket, testAwsRoleArn, testAwsRegion),
8787
Check: resource.ComposeTestCheckFunc(
88-
testAccCheckDataForwardingExists(),
88+
testAccCheckDataForwardingDestinationExists(),
8989
resource.TestCheckResourceAttr(dataForwardingResourceName, "destination_name", destinationName),
9090
resource.TestCheckResourceAttr(dataForwardingResourceName, "description", description),
9191
resource.TestCheckResourceAttr(dataForwardingResourceName, "s3_region", testAwsRegion),
@@ -94,7 +94,7 @@ func TestAccSumologicDataForwarding_update(t *testing.T) {
9494
}, {
9595
Config: testAccSumologicDataForwardingUpdateConfig(destinationName, description, testAwsBucket, testAwsRoleArn, testAwsRegion),
9696
Check: resource.ComposeTestCheckFunc(
97-
testAccCheckDataForwardingExists(),
97+
testAccCheckDataForwardingDestinationExists(),
9898
resource.TestCheckResourceAttr(dataForwardingResourceName, "destination_name", destinationName),
9999
resource.TestCheckResourceAttr(dataForwardingResourceName, "description", description),
100100
resource.TestCheckResourceAttr(dataForwardingResourceName, "s3_region", testAwsRegion),
@@ -111,39 +111,39 @@ func TestAccSumologicDataForwarding_delete(t *testing.T) {
111111
resource.Test(t, resource.TestCase{
112112
PreCheck: func() { testAccPreCheckWithAWS(t) },
113113
Providers: testAccProviders,
114-
CheckDestroy: testAccCheckDataForwardingDestroy(),
114+
CheckDestroy: testAccCheckDataForwardingDestinationDestroy(),
115115
Steps: []resource.TestStep{
116116
{
117117
Config: testAccSumologicDataForwardingCreateConfig(destinationName, description, testAwsBucket, testAwsRoleArn, testAwsRegion),
118118
Check: resource.ComposeTestCheckFunc(
119-
testAccCheckDataForwardingExists(),
119+
testAccCheckDataForwardingDestinationExists(),
120120
resource.TestCheckResourceAttr(dataForwardingResourceName, "destination_name", destinationName),
121121
resource.TestCheckResourceAttr(dataForwardingResourceName, "description", description),
122122
resource.TestCheckResourceAttr(dataForwardingResourceName, "s3_region", testAwsRegion),
123123
resource.TestCheckResourceAttr(dataForwardingResourceName, "s3_server_side_encryption", "false"),
124124
),
125125
}, {
126126
Config: testAccSumologicDataForwardingDeleteConfig(),
127-
Check: resource.ComposeTestCheckFunc(testAccCheckDataForwardingDestroy()),
127+
Check: resource.ComposeTestCheckFunc(testAccCheckDataForwardingDestinationDestroy()),
128128
},
129129
},
130130
})
131131
}
132132

133-
func testAccCheckDataForwardingExists() resource.TestCheckFunc {
133+
func testAccCheckDataForwardingDestinationExists() resource.TestCheckFunc {
134134
return func(s *terraform.State) error {
135135
client := testAccProvider.Meta().(*Client)
136136
for _, r := range s.RootModule().Resources {
137137
id := r.Primary.ID
138138
if _, err := client.getDataForwardingDestination(id); err != nil {
139-
return fmt.Errorf("Received an error retrieving data forwarding %s", err)
139+
return fmt.Errorf("Received an error retrieving data forwarding destination %s", err)
140140
}
141141
}
142142
return nil
143143
}
144144
}
145145

146-
func testAccCheckDataForwardingDestroy() resource.TestCheckFunc {
146+
func testAccCheckDataForwardingDestinationDestroy() resource.TestCheckFunc {
147147
return func(s *terraform.State) error {
148148
client := testAccProvider.Meta().(*Client)
149149
for _, r := range s.RootModule().Resources {
@@ -159,7 +159,7 @@ func testAccCheckDataForwardingDestroy() resource.TestCheckFunc {
159159
}
160160

161161
if p != nil {
162-
return fmt.Errorf("Data Forwarding still exists!")
162+
return fmt.Errorf("Data Forwarding Destination still exists!")
163163
}
164164
}
165165
return nil

0 commit comments

Comments
 (0)