volumeattach_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // +build acceptance compute volumeattach
  2. package v2
  3. import (
  4. "testing"
  5. "devel.mephi.ru/iacherepanov/openstack-gophercloud/acceptance/clients"
  6. bs "devel.mephi.ru/iacherepanov/openstack-gophercloud/acceptance/openstack/blockstorage/v2"
  7. "devel.mephi.ru/iacherepanov/openstack-gophercloud/acceptance/tools"
  8. th "devel.mephi.ru/iacherepanov/openstack-gophercloud/testhelper"
  9. )
  10. func TestVolumeAttachAttachment(t *testing.T) {
  11. clients.RequireLong(t)
  12. client, err := clients.NewComputeV2Client()
  13. th.AssertNoErr(t, err)
  14. blockClient, err := clients.NewBlockStorageV2Client()
  15. th.AssertNoErr(t, err)
  16. server, err := CreateServer(t, client)
  17. th.AssertNoErr(t, err)
  18. defer DeleteServer(t, client, server)
  19. volume, err := bs.CreateVolume(t, blockClient)
  20. th.AssertNoErr(t, err)
  21. defer bs.DeleteVolume(t, blockClient, volume)
  22. volumeAttachment, err := CreateVolumeAttachment(t, client, blockClient, server, volume)
  23. th.AssertNoErr(t, err)
  24. defer DeleteVolumeAttachment(t, client, blockClient, server, volumeAttachment)
  25. tools.PrintResource(t, volumeAttachment)
  26. th.AssertEquals(t, volumeAttachment.ServerID, server.ID)
  27. }