@@ -34,6 +34,12 @@ class GoogleBatchMachineTypeSelectorTest extends Specification {
3434 new MachineType (type : ' m2-type08' , family : ' m2' , ' spotPrice' : 0.036 , ' onDemandPrice' : 0.35 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
3535 new MachineType (type : ' n2-type09' , family : ' n2' , ' spotPrice' : 0.040 , ' onDemandPrice' : 0.40 , ' cpusPerVm' : 10 , ' memPerVm' : 10 ),
3636 new MachineType (type : ' c2-type10' , family : ' c2' , ' spotPrice' : 0.045 , ' onDemandPrice' : 0.45 , ' cpusPerVm' : 10 , ' memPerVm' : 10 ),
37+ new MachineType (type : ' c4-type11' , family : ' c4' , ' spotPrice' : 0.040 , ' onDemandPrice' : 0.40 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
38+ new MachineType (type : ' c4a-type12' , family : ' c4a' , ' spotPrice' : 0.038 , ' onDemandPrice' : 0.38 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
39+ new MachineType (type : ' c4d-type13' , family : ' c4d' , ' spotPrice' : 0.039 , ' onDemandPrice' : 0.39 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
40+ new MachineType (type : ' n4-type14' , family : ' n4' , ' spotPrice' : 0.035 , ' onDemandPrice' : 0.35 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
41+ new MachineType (type : ' n4a-type15' , family : ' n4a' , ' spotPrice' : 0.033 , ' onDemandPrice' : 0.33 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
42+ new MachineType (type : ' n4d-type16' , family : ' n4d' , ' spotPrice' : 0.034 , ' onDemandPrice' : 0.34 , ' cpusPerVm' : 8 , ' memPerVm' : 8 ),
3743 ]
3844
3945 def ' should select best machine type' () {
@@ -57,6 +63,12 @@ class GoogleBatchMachineTypeSelectorTest extends Specification {
5763 8 | 8000 | ' reg' | true | false | null | ' m1-type07'
5864 8 | 8000 | ' reg' | false | false | [' m?-*' , ' c2-*' ] | ' m2-type08'
5965 8 | 8000 | ' reg' | false | false | [' m1-type07' , ' m2-type66' ] | ' m1-type07'
66+ 8 | 8000 | ' reg' | true | false | [' c4-*' ] | ' c4-type11'
67+ 8 | 8000 | ' reg' | true | false | [' c4a-*' ] | ' c4a-type12'
68+ 8 | 8000 | ' reg' | true | false | [' c4d-*' ] | ' c4d-type13'
69+ 8 | 8000 | ' reg' | true | false | [' n4-*' ] | ' n4-type14'
70+ 8 | 8000 | ' reg' | true | false | [' n4a-*' ] | ' n4a-type15'
71+ 8 | 8000 | ' reg' | true | false | [' n4d-*' ] | ' n4d-type16'
6072
6173
6274 }
@@ -113,6 +125,27 @@ class GoogleBatchMachineTypeSelectorTest extends Specification {
113125 ' 200 GB' | ' c2-standard-4' | ' c2' | 4 | ' 375 GB'
114126 ' 50 GB' | ' c2d-highmem-56' | ' c2d' | 56 | ' 1500 GB'
115127 ' 750 GB' | ' m3-megamem-64' | ' m3' | 64 | ' 1500 GB'
128+ ' 100 GB' | ' c4-standard-8-lssd' | ' c4' | 8 | ' 0'
129+ ' 100 GB' | ' c4a-standard-8-lssd' | ' c4a' | 8 | ' 0'
130+ ' 100 GB' | ' c4d-standard-8-lssd' | ' c4d' | 8 | ' 0'
131+ }
132+
133+ def ' should know when hyperdisk is required' () {
134+ expect :
135+ GoogleBatchMachineTypeSelector . INSTANCE . isHyperdiskOnly(TYPE ) == EXPECTED
136+
137+ where :
138+ TYPE | EXPECTED
139+ ' c4-standard-8' | true
140+ ' c4a-standard-8' | true
141+ ' c4d-standard-8' | true
142+ ' n4-standard-8' | true
143+ ' n4a-standard-8' | true
144+ ' n4d-standard-8' | true
145+ ' n1-standard-8' | false
146+ ' n2-standard-8' | false
147+ ' e2-standard-8' | false
148+ ' c2-standard-8' | false
116149 }
117150
118151 def ' should know when to install GPU drivers' () {
@@ -128,4 +161,34 @@ class GoogleBatchMachineTypeSelectorTest extends Specification {
128161 ' a3-highgpu-1g' | 0 | true
129162 ' g2-standard-4' | 0 | true
130163 }
164+
165+ def ' should detect non-configurable local SSD' () {
166+ expect :
167+ final machineType = new MachineType (type : TYPE , family : FAMILY )
168+ GoogleBatchMachineTypeSelector . INSTANCE . notConfigurableLocalSSD(machineType) == EXPECTED
169+
170+ where :
171+ TYPE | FAMILY | EXPECTED
172+ // c3/c3d with -lssd suffix → true
173+ ' c3-standard-8-lssd' | ' c3' | true
174+ ' c3d-standard-8-lssd' | ' c3d' | true
175+ // c4/c4a/c4d with -lssd suffix → true
176+ ' c4-standard-8-lssd' | ' c4' | true
177+ ' c4a-standard-8-lssd' | ' c4a' | true
178+ ' c4d-standard-8-lssd' | ' c4d' | true
179+ // a3 family → always true regardless of type
180+ ' a3-highgpu-8g' | ' a3' | true
181+ ' a3-megagpu-64g' | ' a3' | true
182+ // a2-ultragpu- prefix → true regardless of family
183+ ' a2-ultragpu-1g' | ' a2' | true
184+ ' a2-ultragpu-8g' | ' a2' | true
185+ // c3/c4 without -lssd suffix → false
186+ ' c3-standard-8' | ' c3' | false
187+ ' c4-standard-8' | ' c4' | false
188+ // a2 non-ultragpu → false
189+ ' a2-highgpu-1g' | ' a2' | false
190+ // unrelated families → false
191+ ' n2-standard-4' | ' n2' | false
192+ ' e2-standard-8' | ' e2' | false
193+ }
131194}
0 commit comments