blob: 1224aa99d3e7901251983e67cafdbcba8a76e7a1 [file] [log] [blame]
Jon Perrittd0399572014-09-22 18:03:02 -05001// +build acceptance
2
Jon Perrittb71a28a2014-09-17 18:16:32 -05003package v1
Jon Perrittd0399572014-09-22 18:03:02 -05004
5import (
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
14func waitForVolume(id string) {
15
16}
17
18var numSnapshots = 1
19
20func 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}