@@ -224,3 +224,83 @@ func TestSmallestNodeTypeClouds(t *testing.T) {
224224 },
225225 }.defaultSmallestNodeType ())
226226}
227+
228+ func TestNodeTypeCategoryNotAvailable (t * testing.T ) {
229+ d , err := qa.ResourceFixture {
230+ Fixtures : []qa.HTTPFixture {
231+ {
232+ Method : "GET" ,
233+ ReuseRequest : true ,
234+ Resource : "/api/2.0/clusters/list-node-types" ,
235+ Response : NodeTypeList {
236+ []NodeType {
237+ {
238+ NodeTypeID : "Random_05" ,
239+ InstanceTypeID : "Random_05" ,
240+ MemoryMB : 1024 ,
241+ NumCores : 32 ,
242+ NodeInstanceType : & NodeInstanceType {
243+ LocalDisks : 3 ,
244+ LocalDiskSizeGB : 100 ,
245+ },
246+ },
247+ {
248+ NodeTypeID : "Random_01" ,
249+ InstanceTypeID : "Random_01" ,
250+ MemoryMB : 8192 ,
251+ NumCores : 8 ,
252+ NodeInstanceType : & NodeInstanceType {
253+ InstanceTypeID : "_" ,
254+ },
255+ Category : "Memory Optimized" ,
256+ },
257+ {
258+ NodeTypeID : "Random_02" ,
259+ InstanceTypeID : "Random_02" ,
260+ MemoryMB : 8192 ,
261+ NumCores : 8 ,
262+ NumGPUs : 2 ,
263+ Category : "Storage Optimized" ,
264+ NodeInfo : & ClusterCloudProviderNodeInfo {
265+ Status : []string {CloudProviderNodeStatusNotAvailableInRegion , CloudProviderNodeStatusNotEnabled },
266+ },
267+ },
268+ {
269+ NodeTypeID : "Random_03" ,
270+ InstanceTypeID : "Random_03" ,
271+ MemoryMB : 8192 ,
272+ NumCores : 8 ,
273+ NumGPUs : 2 ,
274+ Category : "Storage Optimized" ,
275+ },
276+ },
277+ },
278+ },
279+ },
280+ Read : true ,
281+ Resource : DataSourceNodeType (),
282+ NonWritable : true ,
283+ State : map [string ]any {
284+ "category" : "Storage optimized" ,
285+ },
286+ ID : "." ,
287+ }.Apply (t )
288+ assert .NoError (t , err )
289+ assert .Equal (t , "Random_03" , d .Id ())
290+ }
291+
292+ func TestNodeTypeShouldBeSkipped (t * testing.T ) {
293+ toBeSkipped := NodeType {
294+ NodeTypeID : "Random_02" ,
295+ InstanceTypeID : "Random_02" ,
296+ MemoryMB : 8192 ,
297+ NumCores : 8 ,
298+ NumGPUs : 2 ,
299+ Category : "Storage Optimized" ,
300+ NodeInfo : & ClusterCloudProviderNodeInfo {
301+ Status : []string {CloudProviderNodeStatusNotAvailableInRegion , CloudProviderNodeStatusNotEnabled },
302+ },
303+ }
304+ assert .Equal (t , true , toBeSkipped .shouldBeSkipped ())
305+ assert .Equal (t , false , NodeType {}.shouldBeSkipped ())
306+ }
0 commit comments