Jamie Hannaford | 05d200d | 2015-02-20 14:49:05 +0100 | [diff] [blame^] | 1 | // +build acceptance db |
| 2 | |
| 3 | package v1 |
| 4 | |
| 5 | import ( |
| 6 | "github.com/rackspace/gophercloud/acceptance/tools" |
| 7 | "github.com/rackspace/gophercloud/rackspace/db/v1/instances" |
| 8 | th "github.com/rackspace/gophercloud/testhelper" |
| 9 | ) |
| 10 | |
| 11 | func (c context) createReplica() { |
| 12 | repl, err := instances.Create(c.client, opts).Extract() |
| 13 | |
| 14 | opts := instances.CreateOpts{ |
| 15 | FlavorRef: "1", |
| 16 | Size: 1, |
| 17 | Name: tools.RandomString("gopher_db", 5), |
| 18 | ReplicaOf: c.instanceID, |
| 19 | } |
| 20 | |
| 21 | instance, err := instances.Create(c.client, opts).Extract() |
| 22 | th.AssertNoErr(c.test, err) |
| 23 | |
| 24 | c.Logf("Creating replica of %s. Waiting...", c.instanceID) |
| 25 | c.WaitUntilActive(id) |
| 26 | c.Logf("Created replica %#v", repl) |
| 27 | |
| 28 | c.replicaID = repl.ID |
| 29 | } |
| 30 | |
| 31 | func (c context) detachReplica() { |
| 32 | err := instances.DetachReplica(c.client, c.replicaID).ExtractErr() |
| 33 | c.Logf("Detached replica %s", c.replicaID) |
| 34 | } |