@@ -10,6 +10,7 @@ import (
1010 "testing"
1111
1212 "github.com/databricks/databricks-sdk-go/apierr"
13+ "github.com/databricks/databricks-sdk-go/service/clusters"
1314 "github.com/databricks/terraform-provider-databricks/common"
1415 "github.com/databricks/terraform-provider-databricks/qa"
1516 "github.com/stretchr/testify/assert"
@@ -52,30 +53,30 @@ func TestGetOrCreateRunningCluster_AzureAuth(t *testing.T) {
5253 Method : "GET" ,
5354 ReuseRequest : true ,
5455 Resource : "/api/2.0/clusters/list-node-types" ,
55- Response : NodeTypeList {
56- []NodeType {
56+ Response : clusters. ListNodeTypesResponse {
57+ []clusters. NodeType {
5758 {
58- NodeTypeID : "Standard_F4s" ,
59- InstanceTypeID : "Standard_F4s" ,
60- MemoryMB : 8192 ,
59+ NodeTypeId : "Standard_F4s" ,
60+ InstanceTypeId : "Standard_F4s" ,
61+ MemoryMb : 8192 ,
6162 NumCores : 4 ,
62- NodeInstanceType : & NodeInstanceType {
63+ NodeInstanceType : & clusters. NodeInstanceType {
6364 LocalDisks : 1 ,
64- InstanceTypeID : "Standard_F4s" ,
65- LocalDiskSizeGB : 16 ,
66- LocalNVMeDisks : 0 ,
65+ InstanceTypeId : "Standard_F4s" ,
66+ LocalDiskSizeGb : 16 ,
67+ LocalNvmeDisks : 0 ,
6768 },
6869 },
6970 {
70- NodeTypeID : "Standard_L80s_v2" ,
71- InstanceTypeID : "Standard_L80s_v2" ,
72- MemoryMB : 655360 ,
71+ NodeTypeId : "Standard_L80s_v2" ,
72+ InstanceTypeId : "Standard_L80s_v2" ,
73+ MemoryMb : 655360 ,
7374 NumCores : 80 ,
74- NodeInstanceType : & NodeInstanceType {
75+ NodeInstanceType : & clusters. NodeInstanceType {
7576 LocalDisks : 2 ,
76- InstanceTypeID : "Standard_L80s_v2" ,
77- LocalDiskSizeGB : 160 ,
78- LocalNVMeDisks : 1 ,
77+ InstanceTypeId : "Standard_L80s_v2" ,
78+ LocalDiskSizeGb : 160 ,
79+ LocalNvmeDisks : 1 ,
7980 },
8081 },
8182 },
@@ -1128,58 +1129,6 @@ func TestGetLatestSparkVersion(t *testing.T) {
11281129 require .Equal (t , true , strings .Contains (err .Error (), "query returned no results" ))
11291130}
11301131
1131- func TestListNodeTypes (t * testing.T ) {
1132- client , server , err := qa .HttpFixtureClient (t , []qa.HTTPFixture {
1133- {
1134- Method : "GET" ,
1135- ReuseRequest : true ,
1136- Resource : "/api/2.0/clusters/list-node-types" ,
1137- Response : NodeTypeList {
1138- []NodeType {
1139- {
1140- NodeTypeID : "Standard_F4s" ,
1141- InstanceTypeID : "Standard_F4s" ,
1142- MemoryMB : 8192 ,
1143- NumCores : 4 ,
1144- NodeInstanceType : & NodeInstanceType {
1145- LocalDisks : 1 ,
1146- InstanceTypeID : "Standard_F4s" ,
1147- LocalDiskSizeGB : 16 ,
1148- LocalNVMeDisks : 0 ,
1149- },
1150- },
1151- {
1152- NodeTypeID : "Standard_L80s_v2" ,
1153- InstanceTypeID : "Standard_L80s_v2" ,
1154- MemoryMB : 655360 ,
1155- NumCores : 80 ,
1156- NodeInstanceType : & NodeInstanceType {
1157- LocalDisks : 2 ,
1158- InstanceTypeID : "Standard_L80s_v2" ,
1159- LocalDiskSizeGB : 160 ,
1160- LocalNVMeDisks : 1 ,
1161- },
1162- },
1163- },
1164- },
1165- },
1166- })
1167- defer server .Close ()
1168- require .NoError (t , err )
1169-
1170- ctx := context .Background ()
1171- api := NewClustersAPI (ctx , client )
1172- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {SupportPortForwarding : true }), api .defaultSmallestNodeType ())
1173- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {PhotonWorkerCapable : true }), api .defaultSmallestNodeType ())
1174- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {PhotonDriverCapable : true }), api .defaultSmallestNodeType ())
1175- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {IsIOCacheEnabled : true }), api .defaultSmallestNodeType ())
1176- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {Category : "Storage Optimized" }), api .defaultSmallestNodeType ())
1177- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {MinMemoryGB : 100500 }), api .defaultSmallestNodeType ())
1178- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {GBPerCore : 100500 }), api .defaultSmallestNodeType ())
1179- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {MinCores : 100500 }), api .defaultSmallestNodeType ())
1180- assert .Equal (t , api .GetSmallestNodeType (NodeTypeRequest {LocalDisk : true }), "Standard_F4s" )
1181- }
1182-
11831132func TestClusterState_CanReach (t * testing.T ) {
11841133 tests := []struct {
11851134 from ClusterState
0 commit comments