blob: 96eaf19382e1c97cb2ea8f66cfff22565b077f4e [file] [log] [blame]
Jamie Hannaford05d200d2015-02-20 14:49:05 +01001// +build acceptance db
2
3package v1
4
5import (
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
11func (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
31func (c context) detachReplica() {
32 err := instances.DetachReplica(c.client, c.replicaID).ExtractErr()
33 c.Logf("Detached replica %s", c.replicaID)
34}