github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/dws/v1/cluster/testing/requests_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/chnsz/golangsdk/openstack/dws/v1/cluster"
     7  	th "github.com/chnsz/golangsdk/testhelper"
     8  	"github.com/chnsz/golangsdk/testhelper/client"
     9  )
    10  
    11  func TestList(t *testing.T) {
    12  	th.SetupHTTP()
    13  	defer th.TeardownHTTP()
    14  	handleList(t)
    15  	id := "7d85f602-a948-4a30-afd4-e84f47471c15"
    16  	listResult, err := cluster.List(client.ServiceClient(), cluster.ListOpts{})
    17  	th.AssertNoErr(t, err)
    18  	th.AssertEquals(t, listResult.Clusters[0].ID, id)
    19  	th.AssertEquals(t, listResult.Clusters[0].PublicIp.PublicBindType, cluster.PublicBindTypeAuto)
    20  }
    21  
    22  func TestGet(t *testing.T) {
    23  	th.SetupHTTP()
    24  	defer th.TeardownHTTP()
    25  
    26  	handleGet(t)
    27  	id := "7d85f602-a948-4a30-afd4-e84f47471c15"
    28  
    29  	clusterDetail, err := cluster.Get(client.ServiceClient(), id)
    30  
    31  	th.AssertNoErr(t, err)
    32  	th.AssertEquals(t, clusterDetail.ID, id)
    33  	th.AssertEquals(t, clusterDetail.ResizeInfo.OriginNodeNum, 3)
    34  }