44 "fmt"
55 "testing"
66
7+ "github.com/google/uuid"
8+
79 "github.com/hashicorp/terraform-plugin-sdk/helper/resource"
810 "github.com/hashicorp/terraform-plugin-sdk/terraform"
911)
@@ -14,14 +16,14 @@ func TestAccSumologicSCEMatchList_createAndUpdate(t *testing.T) {
1416 var matchList CSEMatchListGet
1517 nDefaultTtl := 10800
1618 nDescription := "New Match List Description"
17- nName := "Match List Name"
19+ nName := fmt . Sprintf ( "Match List Name %s" , uuid . New ())
1820 nTargetColumn := "SrcIp"
1921 liDescription := "Match List Item Description"
2022 liValue := "value"
2123 liExpiration := "2122-02-27T04:00:00"
22- // uDefaultTtl := 3600
23- // uDescription := "Updated Match List Description"
24- // uliDescription := "Updated Match List item Description"
24+ uDefaultTtl := 3600
25+ uDescription := "Updated Match List Description"
26+ uliDescription := "Updated Match List item Description"
2527 resourceName := "sumologic_cse_match_list.match_list"
2628
2729 resource .Test (t , resource.TestCase {
@@ -30,26 +32,26 @@ func TestAccSumologicSCEMatchList_createAndUpdate(t *testing.T) {
3032 CheckDestroy : testAccCSEMatchListDestroy ,
3133 Steps : []resource.TestStep {
3234 {
33- Config : testCreateCSEMatchListConfig (nDefaultTtl , nDescription , nName , nTargetColumn , liDescription , liExpiration , liValue , 11 ),
35+ Config : testCreateCSEMatchListConfig (nDefaultTtl , nDescription , nName , nTargetColumn , liDescription , liExpiration , liValue , 51 ),
3436 Check : resource .ComposeTestCheckFunc (
3537 testCheckCSEMatchListExists (resourceName , & matchList ),
3638 testCheckMatchListValues (& matchList , nDefaultTtl , nDescription , nName , nTargetColumn ),
3739 resource .TestCheckResourceAttrSet (resourceName , "id" ),
3840 ),
3941 },
40- // {
41- // Config: testCreateCSEMatchListConfig(uDefaultTtl, uDescription, nName, nTargetColumn, uliDescription, liExpiration, liValue, 11 ),
42- // Check: resource.ComposeTestCheckFunc(
43- // testCheckCSEMatchListExists(resourceName, &matchList),
44- // testCheckMatchListValues(&matchList, uDefaultTtl, uDescription, nName, nTargetColumn),
45- // ),
46- // },
47- // {
48- // Config: testDeleteCSEMatchListItemConfig(uDefaultTtl, uDescription, nName, nTargetColumn),
49- // Check: resource.ComposeTestCheckFunc(
50- // testCheckMatchListItemsEmpty(resourceName),
51- // ),
52- // },
42+ {
43+ Config : testCreateCSEMatchListConfig (uDefaultTtl , uDescription , nName , nTargetColumn , uliDescription , liExpiration , liValue , 51 ),
44+ Check : resource .ComposeTestCheckFunc (
45+ testCheckCSEMatchListExists (resourceName , & matchList ),
46+ testCheckMatchListValues (& matchList , uDefaultTtl , uDescription , nName , nTargetColumn ),
47+ ),
48+ },
49+ {
50+ Config : testDeleteCSEMatchListItemConfig (uDefaultTtl , uDescription , nName , nTargetColumn ),
51+ Check : resource .ComposeTestCheckFunc (
52+ testCheckMatchListItemsEmpty (resourceName ),
53+ ),
54+ },
5355 },
5456 })
5557}
@@ -81,12 +83,14 @@ func testCreateCSEMatchListConfig(nDefaultTtl int, nDescription string, nName st
8183 var itemsStr = ""
8284
8385 for i := 0 ; i < numItems ; i ++ {
86+ id := uuid .New ()
87+
8488 itemsStr += fmt .Sprintf (`
8589 items {
8690 description = "%s %d"
8791 expiration = "%s"
88- value = "%s %d"
89- }` , liDescription , i , liExpiration , liValue , i )
92+ value = "%s %d %s "
93+ }` , liDescription , i , liExpiration , liValue , i , id )
9094 }
9195
9296 var str = fmt .Sprintf (`
0 commit comments