multi-line error check -> th.AssertNoErr
diff --git a/acceptance/openstack/blockstorage/v1/snapshots_test.go b/acceptance/openstack/blockstorage/v1/snapshots_test.go
index beba96c..9132ee5 100644
--- a/acceptance/openstack/blockstorage/v1/snapshots_test.go
+++ b/acceptance/openstack/blockstorage/v1/snapshots_test.go
@@ -8,27 +8,22 @@
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots"
"github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
+ th "github.com/rackspace/gophercloud/testhelper"
)
func TestSnapshots(t *testing.T) {
client, err := newClient()
- if err != nil {
- t.Fatalf("Failed to create Block Storage v1 client: %v", err)
- }
-
+ th.AssertNoErr(t, err)
+
v, err := volumes.Create(client, &volumes.CreateOpts{
Name: "gophercloud-test-volume",
Size: 1,
}).Extract()
- if err != nil {
- t.Fatalf("Failed to create volume: %v\n", err)
- }
+ th.AssertNoErr(t, err)
err = volumes.WaitForStatus(client, v.ID, "available", 120)
- if err != nil {
- t.Fatalf("Failed to create volume: %v\n", err)
- }
+ th.AssertNoErr(t, err)
t.Logf("Created volume: %v\n", v)
@@ -36,21 +31,15 @@
Name: "gophercloud-test-snapshot",
VolumeID: v.ID,
}).Extract()
- if err != nil {
- t.Fatalf("Failed to create snapshot: %v\n", err)
- }
+ th.AssertNoErr(t, err)
err = snapshots.WaitForStatus(client, ss.ID, "available", 120)
- if err != nil {
- t.Fatalf("Failed to create snapshot: %v\n", err)
- }
+ th.AssertNoErr(t, err)
t.Logf("Created snapshot: %+v\n", ss)
err = snapshots.Delete(client, ss.ID).ExtractErr()
- if err != nil {
- t.Fatalf("Failed to delete snapshot: %v", err)
- }
+ th.AssertNoErr(t, err)
err = gophercloud.WaitFor(120, func() (bool, error) {
_, err := snapshots.Get(client, ss.ID).Extract()
@@ -60,16 +49,12 @@
return false, nil
})
- if err != nil {
- t.Fatalf("Failed to delete snapshot: %v", err)
- }
+ th.AssertNoErr(t, err)
t.Log("Deleted snapshot\n")
err = volumes.Delete(client, v.ID).ExtractErr()
- if err != nil {
- t.Errorf("Failed to delete volume: %v", err)
- }
+ th.AssertNoErr(t, err)
err = gophercloud.WaitFor(120, func() (bool, error) {
_, err := volumes.Get(client, v.ID).Extract()
@@ -79,9 +64,7 @@
return false, nil
})
- if err != nil {
- t.Errorf("Failed to delete volume: %v", err)
- }
+ th.AssertNoErr(t, err)
t.Log("Deleted volume\n")
}