Commit 0118feec authored by Joe Topjian's avatar Joe Topjian Committed by GitHub

Merge pull request #440 from jtopjian/computev2-suspend-acc-test

Compute v2: Add Suspend Acceptance Test
parents ec29b8a4 1935ca0d
......@@ -12,6 +12,7 @@ import (
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/attachinterfaces"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/availabilityzones"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/pauseunpause"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/suspendresume"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
th "github.com/gophercloud/gophercloud/testhelper"
)
......@@ -440,3 +441,39 @@ func TestServersActionPause(t *testing.T) {
t.Fatal(err)
}
}
func TestServersActionSuspend(t *testing.T) {
t.Parallel()
client, err := clients.NewComputeV2Client()
if err != nil {
t.Fatalf("Unable to create a compute client: %v", err)
}
server, err := CreateServer(t, client)
if err != nil {
t.Fatal(err)
}
defer DeleteServer(t, client, server)
t.Logf("Attempting to suspend server %s", server.ID)
err = suspendresume.Suspend(client, server.ID).ExtractErr()
if err != nil {
t.Fatal(err)
}
err = WaitForComputeStatus(client, server, "SUSPENDED")
if err != nil {
t.Fatal(err)
}
err = suspendresume.Resume(client, server.ID).ExtractErr()
if err != nil {
t.Fatal(err)
}
err = WaitForComputeStatus(client, server, "ACTIVE")
if err != nil {
t.Fatal(err)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment