github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/migrate/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk/openstack/compute/v2/extensions/migrate"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  	"github.com/huaweicloud/golangsdk/testhelper/client"
     9  )
    10  
    11  const serverID = "b16ba811-199d-4ffd-8839-ba96c1185a67"
    12  
    13  func TestMigrate(t *testing.T) {
    14  	th.SetupHTTP()
    15  	defer th.TeardownHTTP()
    16  
    17  	mockMigrateResponse(t, serverID)
    18  
    19  	err := migrate.Migrate(client.ServiceClient(), serverID).ExtractErr()
    20  	th.AssertNoErr(t, err)
    21  }
    22  
    23  func TestLiveMigrate(t *testing.T) {
    24  	th.SetupHTTP()
    25  	defer th.TeardownHTTP()
    26  
    27  	mockLiveMigrateResponse(t, serverID)
    28  
    29  	host := "01c0cadef72d47e28a672a76060d492c"
    30  	blockMigration := false
    31  	diskOverCommit := true
    32  
    33  	migrationOpts := migrate.LiveMigrateOpts{
    34  		Host:           &host,
    35  		BlockMigration: &blockMigration,
    36  		DiskOverCommit: &diskOverCommit,
    37  	}
    38  
    39  	err := migrate.LiveMigrate(client.ServiceClient(), serverID, migrationOpts).ExtractErr()
    40  	th.AssertNoErr(t, err)
    41  }