Skip to content

Commit

Permalink
update random seed in example test (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalhoun committed Nov 18, 2020
1 parent 3a6464e commit cff44d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"math/rand"
"strconv"
"testing"
"time"

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

randId := strconv.Itoa(rand.Intn(100000))
attributes := []string{randId}
rand.Seed(time.Now().UnixNano())
randID := strconv.Itoa(rand.Intn(100000))
attributes := []string{randID}

exampleInput := "Hello, world!"

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

// ************************************************************************
// This steps below are unusual, not generally part of the testing
Expand Down

0 comments on commit cff44d1

Please sign in to comment.