Finalize Rackspace acceptance tests and fix various things
diff --git a/acceptance/rackspace/db/v1/backup_test.go b/acceptance/rackspace/db/v1/backup_test.go
index 7c50e19..af60620 100644
--- a/acceptance/rackspace/db/v1/backup_test.go
+++ b/acceptance/rackspace/db/v1/backup_test.go
@@ -3,6 +3,7 @@
package v1
import (
+ "github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/acceptance/tools"
"github.com/rackspace/gophercloud/pagination"
@@ -10,7 +11,7 @@
"github.com/rackspace/gophercloud/rackspace/db/v1/instances"
)
-func (c context) createBackup() {
+func (c *context) createBackup() {
opts := backups.CreateOpts{
Name: tools.RandomString("backup_", 5),
InstanceID: c.instanceID,
@@ -21,16 +22,28 @@
c.Logf("Created backup %#v", backup)
c.AssertNoErr(err)
+ err = gophercloud.WaitFor(60, func() (bool, error) {
+ b, err := backups.Get(c.client, backup.ID).Extract()
+ if err != nil {
+ return false, err
+ }
+ if b.Status == "COMPLETED" {
+ return true, nil
+ }
+ return false, nil
+ })
+ c.AssertNoErr(err)
+
c.backupID = backup.ID
}
-func (c context) getBackup() {
+func (c *context) getBackup() {
backup, err := backups.Get(c.client, c.backupID).Extract()
c.AssertNoErr(err)
c.Logf("Getting backup %s", backup.ID)
}
-func (c context) listAllBackups() {
+func (c *context) listAllBackups() {
c.Logf("Listing backups")
err := backups.List(c.client, nil).EachPage(func(page pagination.Page) (bool, error) {
@@ -47,7 +60,7 @@
c.AssertNoErr(err)
}
-func (c context) listInstanceBackups() {
+func (c *context) listInstanceBackups() {
c.Logf("Listing backups for instance %s", c.instanceID)
err := instances.ListBackups(c.client, c.instanceID).EachPage(func(page pagination.Page) (bool, error) {
@@ -64,7 +77,7 @@
c.AssertNoErr(err)
}
-func (c context) deleteBackup() {
+func (c *context) deleteBackup() {
err := backups.Delete(c.client, c.backupID).ExtractErr()
c.AssertNoErr(err)
c.Logf("Deleted backup %s", c.backupID)