Skip to content

Commit cff44d1

Browse files
author
Matt Calhoun
authored
update random seed in example test (#7)
1 parent 3a6464e commit cff44d1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/src/examples_complete_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"math/rand"
55
"strconv"
66
"testing"
7+
"time"
78

89
"github.com/gruntwork-io/terratest/modules/terraform"
910
"github.com/stretchr/testify/assert"
@@ -13,8 +14,9 @@ import (
1314
func TestExamplesComplete(t *testing.T) {
1415
t.Parallel()
1516

16-
randId := strconv.Itoa(rand.Intn(100000))
17-
attributes := []string{randId}
17+
rand.Seed(time.Now().UnixNano())
18+
randID := strconv.Itoa(rand.Intn(100000))
19+
attributes := []string{randID}
1820

1921
exampleInput := "Hello, world!"
2022

@@ -46,7 +48,7 @@ func TestExamplesComplete(t *testing.T) {
4648
// Ensure we get a random number appended
4749
assert.Equal(t, exampleInput+" "+random, example)
4850
// Ensure we get the attribute included in the ID
49-
assert.Equal(t, "eg-ue2-test-example-"+randId, id)
51+
assert.Equal(t, "eg-ue2-test-example-"+randID, id)
5052

5153
// ************************************************************************
5254
// This steps below are unusual, not generally part of the testing

0 commit comments

Comments
 (0)