Explicitly auth against v3 in v3 tests.
Skip v3 tests altogether if no USERID is set.
diff --git a/acceptance/openstack/identity/v3/endpoint_test.go b/acceptance/openstack/identity/v3/endpoint_test.go
index 8b302cc..5f166c4 100644
--- a/acceptance/openstack/identity/v3/endpoint_test.go
+++ b/acceptance/openstack/identity/v3/endpoint_test.go
@@ -13,6 +13,9 @@
func TestListEndpoints(t *testing.T) {
// Create a service client.
serviceClient := createAuthenticatedClient(t)
+ if serviceClient == nil {
+ return
+ }
// Use the service to list all available endpoints.
results, err := endpoints3.List(serviceClient, endpoints3.ListOpts{})
diff --git a/acceptance/openstack/identity/v3/identity_test.go b/acceptance/openstack/identity/v3/identity_test.go
index eea3737..ec184a0 100644
--- a/acceptance/openstack/identity/v3/identity_test.go
+++ b/acceptance/openstack/identity/v3/identity_test.go
@@ -18,12 +18,22 @@
// Trim out unused fields.
ao.Username, ao.TenantID, ao.TenantName = "", "", ""
- // Create an authenticated client.
- providerClient, err := openstack.AuthenticatedClient(ao)
+ if ao.UserID == "" {
+ t.Logf("Skipping identity v3 tests because no OS_USERID is present.")
+ return nil
+ }
+
+ // Create a client and manually authenticate against v3.
+ providerClient, err := openstack.NewClient(ao.IdentityEndpoint)
if err != nil {
t.Fatalf("Unable to instantiate client: %v", err)
}
+ err = openstack.AuthenticateV3(providerClient, ao)
+ if err != nil {
+ t.Fatalf("Unable to authenticate against identity v3: %v", err)
+ }
+
// Create a service client.
return openstack.NewIdentityV3(providerClient)
}
diff --git a/acceptance/openstack/identity/v3/service_test.go b/acceptance/openstack/identity/v3/service_test.go
index 0dd49d0..97e3408 100644
--- a/acceptance/openstack/identity/v3/service_test.go
+++ b/acceptance/openstack/identity/v3/service_test.go
@@ -12,6 +12,9 @@
func TestListServices(t *testing.T) {
// Create a service client.
serviceClient := createAuthenticatedClient(t)
+ if serviceClient == nil {
+ return
+ }
// Use the service to create a token.
results, err := services3.List(serviceClient, services3.ListOpts{})
diff --git a/acceptance/openstack/identity/v3/token_test.go b/acceptance/openstack/identity/v3/token_test.go
index eb65cea..d5f9ea6 100644
--- a/acceptance/openstack/identity/v3/token_test.go
+++ b/acceptance/openstack/identity/v3/token_test.go
@@ -17,8 +17,12 @@
t.Fatalf("Unable to acquire credentials: %v", err)
}
- // Trim out unused fields.
+ // Trim out unused fields. Skip if we don't have a UserID.
ao.Username, ao.TenantID, ao.TenantName = "", "", ""
+ if ao.UserID == "" {
+ t.Logf("Skipping identity v3 tests because no OS_USERID is present.")
+ return
+ }
// Create an unauthenticated client.
provider, err := openstack.NewClient(ao.IdentityEndpoint)