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/blockstorage/v1/blockstorage.go b/acceptance/openstack/blockstorage/v1/blockstorage.go
index 3d4c9f1..41f24e1 100644
--- a/acceptance/openstack/blockstorage/v1/blockstorage.go
+++ b/acceptance/openstack/blockstorage/v1/blockstorage.go
@@ -140,44 +140,3 @@
t.Logf("Deleted volume type: %s", volumeType.ID)
}
-
-// PrintVolume will print a volume and all of its attributes.
-func PrintVolume(t *testing.T, volume *volumes.Volume) {
- t.Logf("ID: %s", volume.ID)
- t.Logf("Status: %s", volume.Status)
- t.Logf("Name: %s", volume.Name)
- t.Logf("AvailabilityZone: %s", volume.AvailabilityZone)
- t.Logf("Bootable: %s", volume.Bootable)
- t.Logf("CreatedAt: %v", volume.CreatedAt)
- t.Logf("Description: %s", volume.Description)
- t.Logf("VolumeType: %s", volume.VolumeType)
- t.Logf("SnapshotID: %s", volume.SnapshotID)
- t.Logf("SourceVolID: %s", volume.SourceVolID)
- t.Logf("Size: %d", volume.Size)
- t.Logf("Metadata: %#v", volume.Metadata)
- t.Logf("Attachments: %#v", volume.Attachments)
-}
-
-// PrintVolumeType will print a volume type and all of its attributes.
-func PrintVolumeType(t *testing.T, volumeType *volumetypes.VolumeType) {
- t.Logf("ID: %s", volumeType.ID)
- t.Logf("Name: %s", volumeType.Name)
- t.Logf("ExtraSpecs: %#v", volumeType.ExtraSpecs)
-}
-
-// PrintSnapshot will print a snapshot and all of its attributes.
-func PrintSnapshot(t *testing.T, snapshot *snapshots.Snapshot) {
- t.Logf("ID: %s", snapshot.ID)
- t.Logf("Status: %s", snapshot.Status)
- t.Logf("Name: %s", snapshot.Name)
- t.Logf("AvailabilityZone: %s", snapshot.AvailabilityZone)
- t.Logf("Bootable: %s", snapshot.Bootable)
- t.Logf("CreatedAt: %v", snapshot.CreatedAt)
- t.Logf("Description: %s", snapshot.Description)
- t.Logf("VolumeType: %s", snapshot.VolumeType)
- t.Logf("SnapshotID: %s", snapshot.SnapshotID)
- t.Logf("VolumeID: %s", snapshot.VolumeID)
- t.Logf("Size: %d", snapshot.Size)
- t.Logf("Metadata: %#v", snapshot.Metadata)
- t.Logf("Attachments: %#v", snapshot.Attachments)
-}
diff --git a/acceptance/openstack/blockstorage/v1/snapshots_test.go b/acceptance/openstack/blockstorage/v1/snapshots_test.go
index 2dc58db..3545371 100644
--- a/acceptance/openstack/blockstorage/v1/snapshots_test.go
+++ b/acceptance/openstack/blockstorage/v1/snapshots_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/snapshots"
)
@@ -26,7 +27,7 @@
}
for _, snapshot := range allSnapshots {
- PrintSnapshot(t, &snapshot)
+ tools.PrintResource(t, snapshot)
}
}
@@ -53,5 +54,5 @@
t.Errorf("Unable to retrieve snapshot: %v", err)
}
- PrintSnapshot(t, newSnapshot)
+ tools.PrintResource(t, newSnapshot)
}
diff --git a/acceptance/openstack/blockstorage/v1/volumes_test.go b/acceptance/openstack/blockstorage/v1/volumes_test.go
index e375c59..9a55500 100644
--- a/acceptance/openstack/blockstorage/v1/volumes_test.go
+++ b/acceptance/openstack/blockstorage/v1/volumes_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes"
)
@@ -26,7 +27,7 @@
}
for _, volume := range allVolumes {
- PrintVolume(t, &volume)
+ tools.PrintResource(t, volume)
}
}
@@ -47,5 +48,5 @@
t.Errorf("Unable to retrieve volume: %v", err)
}
- PrintVolume(t, newVolume)
+ tools.PrintResource(t, newVolume)
}
diff --git a/acceptance/openstack/blockstorage/v1/volumetypes_test.go b/acceptance/openstack/blockstorage/v1/volumetypes_test.go
index 843ea21..ace09bc 100644
--- a/acceptance/openstack/blockstorage/v1/volumetypes_test.go
+++ b/acceptance/openstack/blockstorage/v1/volumetypes_test.go
@@ -6,6 +6,7 @@
"testing"
"github.com/gophercloud/gophercloud/acceptance/clients"
+ "github.com/gophercloud/gophercloud/acceptance/tools"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumetypes"
)
@@ -26,7 +27,7 @@
}
for _, volumeType := range allVolumeTypes {
- PrintVolumeType(t, &volumeType)
+ tools.PrintResource(t, volumeType)
}
}
@@ -42,5 +43,5 @@
}
defer DeleteVolumeType(t, client, volumeType)
- PrintVolumeType(t, volumeType)
+ tools.PrintResource(t, volumeType)
}