Acceptance Test Updates (#218)
* compute: don't pass choices
* blockstorage: don't pass choices
* DumpResource Function
This function prints a resource in JSON format but retains the actual
field name rather than using the name specified in the JSON tag.
* New DumpResource
This version just converts the resource into JSON. The original is
being left in git history for posterity.
* Renaming DumpResource to PrintResource
* Removing all print functions in favor of PrintResource
* Rebase reconcilliation
diff --git a/acceptance/openstack/compute/v2/servers_test.go b/acceptance/openstack/compute/v2/servers_test.go
index fa6603d..22b6580 100644
--- a/acceptance/openstack/compute/v2/servers_test.go
+++ b/acceptance/openstack/compute/v2/servers_test.go
@@ -30,7 +30,7 @@
}
for _, server := range allServers {
- PrintServer(t, &server)
+ tools.PrintResource(t, server)
}
}
@@ -45,7 +45,7 @@
t.Fatal(err)
}
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatalf("Unable to create server: %v", err)
}
@@ -56,7 +56,7 @@
if err != nil {
t.Errorf("Unable to retrieve server: %v", err)
}
- PrintServer(t, newServer)
+ tools.PrintResource(t, newServer)
allAddressPages, err := servers.ListAddresses(client, server.ID).AllPages()
if err != nil {
@@ -94,12 +94,7 @@
t.Fatalf("Unable to create a compute client: %v", err)
}
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
- server, err := CreateServerWithoutImageRef(t, client, choices)
+ server, err := CreateServerWithoutImageRef(t, client)
if err != nil {
if err400, ok := err.(*gophercloud.ErrUnexpectedResponseCode); ok {
if !strings.Contains("Missing imageRef attribute", string(err400.Body)) {
@@ -115,12 +110,7 @@
t.Fatalf("Unable to create a compute client: %v", err)
}
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
@@ -159,17 +149,12 @@
func TestServersMetadata(t *testing.T) {
t.Parallel()
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
client, err := clients.NewComputeV2Client()
if err != nil {
t.Fatalf("Unable to create a compute client: %v", err)
}
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
@@ -226,12 +211,7 @@
t.Fatalf("Unable to create a compute client: %v", err)
}
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
@@ -260,12 +240,7 @@
t.Fatalf("Unable to create a compute client: %v", err)
}
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
@@ -303,7 +278,7 @@
t.Fatal(err)
}
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
@@ -338,24 +313,19 @@
func TestServersActionResizeConfirm(t *testing.T) {
t.Parallel()
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
client, err := clients.NewComputeV2Client()
if err != nil {
t.Fatalf("Unable to create a compute client: %v", err)
}
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
defer DeleteServer(t, client, server)
t.Logf("Attempting to resize server %s", server.ID)
- ResizeServer(t, client, server, choices)
+ ResizeServer(t, client, server)
t.Logf("Attempting to confirm resize for server %s", server.ID)
if res := servers.ConfirmResize(client, server.ID); res.Err != nil {
@@ -370,24 +340,19 @@
func TestServersActionResizeRevert(t *testing.T) {
t.Parallel()
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
client, err := clients.NewComputeV2Client()
if err != nil {
t.Fatalf("Unable to create a compute client: %v", err)
}
- server, err := CreateServer(t, client, choices)
+ server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
defer DeleteServer(t, client, server)
t.Logf("Attempting to resize server %s", server.ID)
- ResizeServer(t, client, server, choices)
+ ResizeServer(t, client, server)
t.Logf("Attempting to revert resize for server %s", server.ID)
if res := servers.RevertResize(client, server.ID); res.Err != nil {