From d25ba245f4ce3cf85dda439ffb8c81a4df4f2625 Mon Sep 17 00:00:00 2001 From: Christopher Gerber Date: Thu, 4 Feb 2016 16:05:49 -0600 Subject: [PATCH] Fixes bytes to string issues in Windows build. --- builder/amazon/common/cli_config_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/builder/amazon/common/cli_config_test.go b/builder/amazon/common/cli_config_test.go index 1b1ec27c6..def93bbb8 100644 --- a/builder/amazon/common/cli_config_test.go +++ b/builder/amazon/common/cli_config_test.go @@ -1,11 +1,11 @@ package common import ( - "crypto/rand" "io/ioutil" - math "math/rand" + "math/rand" "os" "path" + "strconv" "testing" "time" @@ -71,15 +71,10 @@ func TestAssumeRole(t *testing.T) { } func mockConfig(t *testing.T) string { - b := make([]byte, 10) - math.Seed(time.Now().UnixNano()) - c, err := rand.Read(b) - if err != nil { - t.Error(err) - } - s := string(b[:c]) - - dir, err := ioutil.TempDir("", s) + time := rand.NewSource(time.Now().UnixNano()) + r := rand.New(time) + v := r.Intn(9999999999) + dir, err := ioutil.TempDir("", strconv.Itoa(v)) if err != nil { t.Error(err) }