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/floatingip_test.go b/acceptance/openstack/compute/v2/floatingip_test.go
index 001dc9f..26b7bfe 100644
--- a/acceptance/openstack/compute/v2/floatingip_test.go
+++ b/acceptance/openstack/compute/v2/floatingip_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
)
@@ -27,7 +28,7 @@
}
for _, floatingIP := range allFloatingIPs {
- PrintFloatingIP(t, &floatingIP)
+ tools.PrintResource(t, floatingIP)
}
}
@@ -37,18 +38,13 @@
t.Fatalf("Unable to create a compute client: %v", err)
}
- choices, err := clients.AcceptanceTestChoicesFromEnv()
- if err != nil {
- t.Fatal(err)
- }
-
- floatingIP, err := CreateFloatingIP(t, client, choices)
+ floatingIP, err := CreateFloatingIP(t, client)
if err != nil {
t.Fatalf("Unable to create floating IP: %v", err)
}
defer DeleteFloatingIP(t, client, floatingIP)
- PrintFloatingIP(t, floatingIP)
+ tools.PrintResource(t, floatingIP)
}
func TestFloatingIPsAssociate(t *testing.T) {
@@ -61,24 +57,19 @@
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.Fatalf("Unable to create server: %v", err)
}
defer DeleteServer(t, client, server)
- floatingIP, err := CreateFloatingIP(t, client, choices)
+ floatingIP, err := CreateFloatingIP(t, client)
if err != nil {
t.Fatalf("Unable to create floating IP: %v", err)
}
defer DeleteFloatingIP(t, client, floatingIP)
- PrintFloatingIP(t, floatingIP)
+ tools.PrintResource(t, floatingIP)
err = AssociateFloatingIP(t, client, floatingIP, server)
if err != nil {
@@ -93,7 +84,7 @@
t.Logf("Floating IP %s is associated with Fixed IP %s", floatingIP.IP, newFloatingIP.FixedIP)
- PrintFloatingIP(t, newFloatingIP)
+ tools.PrintResource(t, newFloatingIP)
}
func TestFloatingIPsFixedIPAssociate(t *testing.T) {
@@ -111,7 +102,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)
}
@@ -122,13 +113,13 @@
t.Fatalf("Unable to get server %s: %v", server.ID, err)
}
- floatingIP, err := CreateFloatingIP(t, client, choices)
+ floatingIP, err := CreateFloatingIP(t, client)
if err != nil {
t.Fatalf("Unable to create floating IP: %v", err)
}
defer DeleteFloatingIP(t, client, floatingIP)
- PrintFloatingIP(t, floatingIP)
+ tools.PrintResource(t, floatingIP)
var fixedIP string
for _, networkAddresses := range newServer.Addresses[choices.NetworkName].([]interface{}) {
@@ -153,5 +144,5 @@
t.Logf("Floating IP %s is associated with Fixed IP %s", floatingIP.IP, newFloatingIP.FixedIP)
- PrintFloatingIP(t, newFloatingIP)
+ tools.PrintResource(t, newFloatingIP)
}