@@ -23,6 +23,12 @@ func TestNodeType(t *testing.T) {
2323 MemoryMB : 0 ,
2424 NumCores : 0 ,
2525 },
26+ {
27+ NodeTypeID : "m-fleet.xlarge" ,
28+ InstanceTypeID : "m-fleet.xlarge" ,
29+ MemoryMB : 16384 ,
30+ NumCores : 4 ,
31+ },
2632 {
2733 NodeTypeID : "Random_05" ,
2834 InstanceTypeID : "Random_05" ,
@@ -183,7 +189,7 @@ func TestNodeTypeVCPU(t *testing.T) {
183189 NodeTypeID : "Random_05" ,
184190 InstanceTypeID : "Random_05" ,
185191 MemoryMB : 1024 ,
186- NumCores : 32 ,
192+ NumCores : 2 ,
187193 NodeInstanceType : & NodeInstanceType {
188194 LocalDisks : 3 ,
189195 LocalDiskSizeGB : 100 ,
@@ -193,7 +199,7 @@ func TestNodeTypeVCPU(t *testing.T) {
193199 NodeTypeID : "vcpu-worker" ,
194200 InstanceTypeID : "vcpu-worker" ,
195201 MemoryMB : 0 ,
196- NumCores : 0 ,
202+ NumCores : 4 ,
197203 },
198204 },
199205 },
@@ -223,6 +229,12 @@ func TestSmallestNodeTypeClouds(t *testing.T) {
223229 Host : "foo.gcp.databricks.com" ,
224230 },
225231 }.defaultSmallestNodeType ())
232+
233+ assert .Equal (t , "i3.xlarge" , ClustersAPI {
234+ client : & common.DatabricksClient {
235+ Host : "foo.cloud.databricks.com" ,
236+ },
237+ }.defaultSmallestNodeType ())
226238}
227239
228240func TestNodeTypeCategoryNotAvailable (t * testing.T ) {
@@ -304,3 +316,112 @@ func TestNodeTypeShouldBeSkipped(t *testing.T) {
304316 assert .Equal (t , true , toBeSkipped .shouldBeSkipped ())
305317 assert .Equal (t , false , NodeType {}.shouldBeSkipped ())
306318}
319+
320+ func TestNodeTypeFleet (t * testing.T ) {
321+ d , err := qa.ResourceFixture {
322+ Fixtures : []qa.HTTPFixture {
323+ {
324+ Method : "GET" ,
325+ ReuseRequest : true ,
326+ Resource : "/api/2.0/clusters/list-node-types" ,
327+ Response : NodeTypeList {
328+ []NodeType {
329+ {
330+ NodeTypeID : "Random_05" ,
331+ InstanceTypeID : "Random_05" ,
332+ MemoryMB : 1024 ,
333+ NumCores : 4 ,
334+ },
335+ {
336+ NodeTypeID : "m-fleet.xlarge" ,
337+ InstanceTypeID : "m-fleet.xlarge" ,
338+ MemoryMB : 16384 ,
339+ NumCores : 4 ,
340+ },
341+ {
342+ NodeTypeID : "m-fleet.2xlarge" ,
343+ InstanceTypeID : "m-fleet.2xlarge" ,
344+ MemoryMB : 32768 ,
345+ NumCores : 8 ,
346+ },
347+ },
348+ },
349+ },
350+ },
351+ Read : true ,
352+ Resource : DataSourceNodeType (),
353+ NonWritable : true ,
354+ State : map [string ]any {
355+ "fleet" : true ,
356+ "min_cores" : 8 ,
357+ },
358+ ID : "." ,
359+ }.Apply (t )
360+ assert .NoError (t , err )
361+ assert .Equal (t , "m-fleet.2xlarge" , d .Id ())
362+ }
363+
364+ func TestNodeTypeEmptyList (t * testing.T ) {
365+ d , err := qa.ResourceFixture {
366+ Fixtures : []qa.HTTPFixture {
367+ {
368+ Method : "GET" ,
369+ ReuseRequest : true ,
370+ Resource : "/api/2.0/clusters/list-node-types" ,
371+ Response : NodeTypeList {},
372+ },
373+ },
374+ Read : true ,
375+ Resource : DataSourceNodeType (),
376+ NonWritable : true ,
377+ Azure : true ,
378+ State : map [string ]any {},
379+ ID : "." ,
380+ }.Apply (t )
381+ assert .NoError (t , err )
382+ assert .Equal (t , "Standard_D3_v2" , d .Id ())
383+ }
384+
385+ func TestNodeTypeFleetEmptyList (t * testing.T ) {
386+ d , err := qa.ResourceFixture {
387+ Fixtures : []qa.HTTPFixture {
388+ {
389+ Method : "GET" ,
390+ ReuseRequest : true ,
391+ Resource : "/api/2.0/clusters/list-node-types" ,
392+ Response : NodeTypeList {},
393+ },
394+ },
395+ Read : true ,
396+ Resource : DataSourceNodeType (),
397+ NonWritable : true ,
398+ State : map [string ]any {
399+ "fleet" : true ,
400+ },
401+ ID : "." ,
402+ }.Apply (t )
403+ assert .NoError (t , err )
404+ assert .Equal (t , "md-fleet.xlarge" , d .Id ())
405+ }
406+
407+ func TestNodeTypeVCPUEmptyList (t * testing.T ) {
408+ d , err := qa.ResourceFixture {
409+ Fixtures : []qa.HTTPFixture {
410+ {
411+ Method : "GET" ,
412+ ReuseRequest : true ,
413+ Resource : "/api/2.0/clusters/list-node-types" ,
414+ Response : NodeTypeList {},
415+ },
416+ },
417+ Read : true ,
418+ Resource : DataSourceNodeType (),
419+ NonWritable : true ,
420+ State : map [string ]any {
421+ "vcpu" : true ,
422+ },
423+ ID : "." ,
424+ }.Apply (t )
425+ assert .NoError (t , err )
426+ assert .Equal (t , "vcpu-worker" , d .Id ())
427+ }
0 commit comments