From 60030d89d13fc94ae28bcadea0d313930a0f2750 Mon Sep 17 00:00:00 2001 From: Matt Mercer Date: Wed, 1 Nov 2017 15:14:56 -0700 Subject: [PATCH] Use strings.Replace() instead of custom function --- client/driver/qemu_test.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/client/driver/qemu_test.go b/client/driver/qemu_test.go index f770734c71c..0a7e86af3df 100644 --- a/client/driver/qemu_test.go +++ b/client/driver/qemu_test.go @@ -16,14 +16,6 @@ import ( ctestutils "github.com/hashicorp/nomad/client/testutil" ) -func generateString(length int) string { - var newString string - for i := 0; i < length; i++ { - newString = newString + "x" - } - return string(newString) -} - // The fingerprinter test should always pass, even if QEMU is not installed. func TestQemuDriver_Fingerprint(t *testing.T) { if !testutil.IsTravis() { @@ -309,13 +301,13 @@ func TestQemuDriverUser(t *testing.T) { } func TestQemuDriverGetMonitorPath(t *testing.T) { - shortPath := generateString(10) + shortPath := strings.Repeat("x", 10) _, err := getMonitorPath(shortPath, "0") if err != nil { t.Fatal("Should not have returned an error") } - longPath := generateString(legacyMaxMonitorPathLen + 100) + longPath := strings.Repeat("x", legacyMaxMonitorPathLen+100) _, err = getMonitorPath(longPath, "0") if err == nil { t.Fatal("Should have returned an error") @@ -325,7 +317,7 @@ func TestQemuDriverGetMonitorPath(t *testing.T) { t.Fatal("Should not have returned an error") } - maxLengthPath := generateString(legacyMaxMonitorPathLen) + maxLengthPath := strings.Repeat("x", legacyMaxMonitorPathLen) _, err = getMonitorPath(maxLengthPath, "0") if err != nil { t.Fatal("Should not have returned an error")