/Godeps/_workspace/src/github.com/rackspace/gophercloud/acceptance/rackspace/compute/v2/bootfromvolume_test.go
https://gitlab.com/JamesClonk/machine · Go · 46 lines · 35 code · 9 blank · 2 comment · 1 complexity · 68d4a5320cc6874bfaed8f342240212f MD5 · raw file
- // +build acceptance
- package v2
- import (
- "testing"
- "github.com/rackspace/gophercloud/acceptance/tools"
- osBFV "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
- "github.com/rackspace/gophercloud/rackspace/compute/v2/bootfromvolume"
- "github.com/rackspace/gophercloud/rackspace/compute/v2/servers"
- th "github.com/rackspace/gophercloud/testhelper"
- )
- func TestBootFromVolume(t *testing.T) {
- client, err := newClient()
- th.AssertNoErr(t, err)
- if testing.Short() {
- t.Skip("Skipping test that requires server creation in short mode.")
- }
- options, err := optionsFromEnv()
- th.AssertNoErr(t, err)
- name := tools.RandomString("Gophercloud-", 8)
- t.Logf("Creating server [%s].", name)
- bd := []osBFV.BlockDevice{
- osBFV.BlockDevice{
- UUID: options.imageID,
- SourceType: osBFV.Image,
- VolumeSize: 10,
- },
- }
- server, err := bootfromvolume.Create(client, servers.CreateOpts{
- Name: name,
- FlavorRef: "performance1-1",
- BlockDevice: bd,
- }).Extract()
- th.AssertNoErr(t, err)
- t.Logf("Created server: %+v\n", server)
- //defer deleteServer(t, client, server)
- t.Logf("Deleting server [%s]...", name)
- }