Skip to content

Commit 15b568b

Browse files
fix tests
1 parent 6ca7806 commit 15b568b

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

sumologic/resource_sumologic_cse_network_block_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package sumologic
22

33
import (
44
"fmt"
5+
"math/rand"
6+
"net"
57
"testing"
68

79
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
@@ -12,7 +14,7 @@ func TestAccSumologicSCENetworkBlock_create(t *testing.T) {
1214
SkipCseTest(t)
1315

1416
var networkBlock CSENetworkBlock
15-
nAddressBlock := "10.0.1.0/26"
17+
nAddressBlock := generateRandomCIDRBlock()
1618
nLabel := "network block test"
1719
nInternal := true
1820
nSuppressesSignals := false
@@ -112,3 +114,12 @@ func testCheckNetworkBlockValues(networkBlock *CSENetworkBlock, nAddressBlock st
112114
return nil
113115
}
114116
}
117+
118+
func generateRandomCIDRBlock() string {
119+
ip := make(net.IP, 4)
120+
for i := 0; i < 4; i++ {
121+
ip[i] = byte(rand.Intn(256))
122+
}
123+
124+
return ip.String() + "/26"
125+
}

sumologic/resource_sumologic_extraction_rule_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
func TestAccSumologicFieldExtractionRule_basic(t *testing.T) {
2626
var fieldextractionrule FieldExtractionRule
27-
testName := FieldsMap["FieldExtractionRule"]["name"+acctest.RandString(8)]
27+
testName := FieldsMap["FieldExtractionRule"]["name"] + acctest.RandString(8)
2828
testScope := FieldsMap["FieldExtractionRule"]["scope"]
2929
testParseExpression := FieldsMap["FieldExtractionRule"]["parseExpression"]
3030
testEnabled, _ := strconv.ParseBool(FieldsMap["FieldExtractionRule"]["enabled"])
@@ -48,7 +48,7 @@ func TestAccSumologicFieldExtractionRule_basic(t *testing.T) {
4848

4949
func TestAccSumologicFieldExtractionRule_create(t *testing.T) {
5050
var fieldextractionrule FieldExtractionRule
51-
testName := FieldsMap["FieldExtractionRule"]["name"+acctest.RandString(8)]
51+
testName := FieldsMap["FieldExtractionRule"]["name"] + acctest.RandString(8)
5252
testScope := FieldsMap["FieldExtractionRule"]["scope"]
5353
testParseExpression := FieldsMap["FieldExtractionRule"]["parseExpression"]
5454
testEnabled, _ := strconv.ParseBool(FieldsMap["FieldExtractionRule"]["enabled"])
@@ -116,12 +116,12 @@ func testAccCheckFieldExtractionRuleExists(name string, fieldextractionrule *Fie
116116
func TestAccSumologicFieldExtractionRule_update(t *testing.T) {
117117
var fieldextractionrule FieldExtractionRule
118118
randomSuffix := acctest.RandString(8)
119-
testName := FieldsMap["FieldExtractionRule"]["name"+randomSuffix]
119+
testName := FieldsMap["FieldExtractionRule"]["name"] + randomSuffix
120120
testScope := FieldsMap["FieldExtractionRule"]["scope"]
121121
testParseExpression := FieldsMap["FieldExtractionRule"]["parseExpression"]
122122
testEnabled, _ := strconv.ParseBool(FieldsMap["FieldExtractionRule"]["enabled"])
123123

124-
testUpdatedName := FieldsMap["FieldExtractionRule"]["updatedName"+randomSuffix]
124+
testUpdatedName := FieldsMap["FieldExtractionRule"]["updatedName"] + randomSuffix
125125
testUpdatedScope := FieldsMap["FieldExtractionRule"]["updatedScope"]
126126
testUpdatedParseExpression := FieldsMap["FieldExtractionRule"]["updatedParseExpression"]
127127
testUpdatedEnabled, _ := strconv.ParseBool(FieldsMap["FieldExtractionRule"]["updatedEnabled"])

0 commit comments

Comments
 (0)