Backpedal in the acceptance tests.
diff --git a/acceptance/tools/tools.go b/acceptance/tools/tools.go
index ffade12..b3f3ea7 100644
--- a/acceptance/tools/tools.go
+++ b/acceptance/tools/tools.go
@@ -5,12 +5,34 @@
import (
"crypto/rand"
"errors"
+ "os"
"time"
+
+ "github.com/rackspace/gophercloud"
)
// ErrTimeout is returned if WaitFor takes longer than 300 second to happen.
var ErrTimeout = errors.New("Timed out")
+// OnlyRS overrides the default Gophercloud behavior of using OS_-prefixed environment variables
+// if RS_ variables aren't present. Otherwise, they'll stomp over each other here in the acceptance
+// tests, where you need to have both defined.
+func OnlyRS(original gophercloud.AuthOptions) gophercloud.AuthOptions {
+ if os.Getenv("RS_AUTH_URL") == "" {
+ original.IdentityEndpoint = ""
+ }
+ if os.Getenv("RS_USERNAME") == "" {
+ original.Username = ""
+ }
+ if os.Getenv("RS_PASSWORD") == "" {
+ original.Password = ""
+ }
+ if os.Getenv("RS_API_KEY") == "" {
+ original.APIKey = ""
+ }
+ return original
+}
+
// WaitFor polls a predicate function once per second to wait for a certain state to arrive.
func WaitFor(predicate func() (bool, error)) error {
for i := 0; i < 300; i++ {