Jon Perritt | d9a4bf7 | 2014-10-23 23:44:04 -0500 | [diff] [blame^] | 1 | // +build acceptance |
| 2 | |
| 3 | package v2 |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume" |
| 9 | th "github.com/rackspace/gophercloud/testhelper" |
| 10 | "github.com/smashwilson/gophercloud/acceptance/tools" |
| 11 | ) |
| 12 | |
| 13 | func TestBootFromVolume(t *testing.T) { |
| 14 | client, err := newClient() |
| 15 | th.AssertNoErr(t, err) |
| 16 | |
| 17 | if testing.Short() { |
| 18 | t.Skip("Skipping test that requires server creation in short mode.") |
| 19 | } |
| 20 | |
| 21 | options, err := optionsFromEnv() |
| 22 | th.AssertNoErr(t, err) |
| 23 | |
| 24 | name := tools.RandomString("Gophercloud-", 8) |
| 25 | t.Logf("Creating server [%s].", name) |
| 26 | |
| 27 | bd := bootfromvolume.BlockDevice{ |
| 28 | UUID: options.imageID, |
| 29 | SourceType: "image", |
| 30 | } |
| 31 | |
| 32 | server, err := bootfromvolume.Create(client, bootfromvolume.CreateOptsExt{ |
| 33 | Name: name, |
| 34 | BlockDevice: bd, |
| 35 | }).Extract() |
| 36 | th.AssertNoErr(t, err) |
| 37 | //defer deleteServer(t, client, server) |
| 38 | } |