Jon Perritt | d039957 | 2014-09-22 18:03:02 -0500 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
Jon Perritt | b71a28a | 2014-09-17 18:16:32 -0500 | [diff] [blame] | 3 | package v1 |
Jon Perritt | d039957 | 2014-09-22 18:03:02 -0500 | [diff] [blame] | 4 | |
| 5 | import ( |
| 6 | "strconv" |
| 7 | "testing" |
| 8 | //"time" |
| 9 | |
| 10 | "github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots" |
| 11 | "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes" |
| 12 | ) |
| 13 | |
| 14 | func waitForVolume(id string) { |
| 15 | |
| 16 | } |
| 17 | |
| 18 | var numSnapshots = 1 |
| 19 | |
| 20 | func TestSnapshots(t *testing.T) { |
| 21 | client, err := newClient() |
| 22 | if err != nil { |
| 23 | t.Fatalf("Failed to create Block Storage v1 client: %v", err) |
| 24 | } |
| 25 | |
| 26 | cv, err := volumes.Create(client, volumes.CreateOpts{ |
| 27 | Size: 1, |
| 28 | Name: "gophercloud-test-volume", |
| 29 | }) |
| 30 | if err != nil { |
| 31 | t.Fatalf("Failed to create volume: %v", err) |
| 32 | } |
| 33 | |
| 34 | waitForVolume(cv.ID) |
| 35 | |
| 36 | var sss []*snapshots.Snapshot |
| 37 | for i := 0; i < numSnapshots; i++ { |
| 38 | css, err := snapshots.Create(client, snapshots.CreateOpts{ |
| 39 | Name: "gophercloud-test-snapshot-" + strconv.Itoa(i), |
| 40 | VolumeID: cv.ID, |
| 41 | }) |
| 42 | if err != nil { |
| 43 | t.Errorf("Failed to create snapshot: %v\n", err) |
| 44 | } |
| 45 | sss = append(sss, css) |
| 46 | } |
| 47 | |
| 48 | t.Logf("Created snapshots: %+v\n", sss) |
| 49 | } |