Add create-server acceptance test and support code
This check-in is not complete; it will break acceptance tests. The
problem is that I cannot run the test in full-quiet mode yet; I need to
support listing of images and flavors before I can do that. That will
allow the acceptance test to choose a server flavor and OS image
appropriate for the acceptance test.
diff --git a/acceptance/libargs.go b/acceptance/libargs.go
index 7b50f46..0af62d4 100644
--- a/acceptance/libargs.go
+++ b/acceptance/libargs.go
@@ -3,6 +3,7 @@
import (
"fmt"
"os"
+ "crypto/rand"
)
// getCredentials will verify existence of needed credential information
@@ -23,3 +24,17 @@
return
}
+
+// randomString generates a string of given length, but random content.
+// All content will be within the ASCII graphic character set.
+// (Implementation from Even Shaw's contribution on
+// http://stackoverflow.com/questions/12771930/what-is-the-fastest-way-to-generate-a-long-random-string-in-go).
+func randomString(n int) string {
+ const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ var bytes = make([]byte, n)
+ rand.Read(bytes)
+ for i, b := range bytes {
+ bytes[i] = alphanum[b % byte(len(alphanum))]
+ }
+ return string(bytes)
+}
\ No newline at end of file