Fix 04-create-server test to use a common prefix.
We need servers to dispose of for the 07-delete-server acceptance test.
Creating a bunch of servers in that test only to turn around and delete
them again will be unnecessarily time-consuming. Instead, we'll use
ListServers() to discover a set of pre-existing servers to delete.
04-create-server already creates a batch, and will always execute before
07-delete-server (since 4 < 7). Altering 04-create-server to put a tag
in the name of the servers it creates will allow 07-delete-server to
find them and delete them again.
The only exception is if any intervening tests fail. You'll need to
clean up manually in that case.
diff --git a/acceptance/libargs.go b/acceptance/libargs.go
index 0af62d4..1802591 100644
--- a/acceptance/libargs.go
+++ b/acceptance/libargs.go
@@ -29,12 +29,12 @@
// 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 {
+func randomString(prefix string, 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)
+ return prefix + string(bytes)
}
\ No newline at end of file