@@ -258,13 +258,13 @@ func TestAggregateLimits_EnforcedAtRuntime(t *testing.T) {
258258
259259 // Set small aggregate limits:
260260 // - MaxTotalVcpus: 2 (first VM gets 1, second wants 2 -> denied)
261- // - MaxTotalMemory: 2GB (first VM gets 1GB , second wants 1.5GB -> denied)
261+ // - MaxTotalMemory: 6GB (first VM gets 2.5GB , second wants 4GB -> denied)
262262 limits := ResourceLimits {
263263 MaxOverlaySize : 100 * 1024 * 1024 * 1024 , // 100GB
264264 MaxVcpusPerInstance : 4 , // per-instance limit (high)
265- MaxMemoryPerInstance : 4 * 1024 * 1024 * 1024 , // 4GB per-instance (high)
265+ MaxMemoryPerInstance : 8 * 1024 * 1024 * 1024 , // 8GB per-instance (high)
266266 MaxTotalVcpus : 2 , // aggregate: only 2 total
267- MaxTotalMemory : 2 * 1024 * 1024 * 1024 , // aggregate: only 2GB total
267+ MaxTotalMemory : 6 * 1024 * 1024 * 1024 , // aggregate: only 6GB total (allows first 2.5GB VM)
268268 }
269269
270270 mgr := NewManager (p , imageManager , systemManager , networkManager , deviceManager , volumeManager , limits , nil , nil ).(* manager )
@@ -306,14 +306,14 @@ func TestAggregateLimits_EnforcedAtRuntime(t *testing.T) {
306306 assert .Equal (t , 0 , usage .TotalVcpus , "Initial vCPUs should be 0" )
307307 assert .Equal (t , int64 (0 ), usage .TotalMemory , "Initial memory should be 0" )
308308
309- // Create first VM: 1 vCPU, 512MB + 512MB = 1GB memory
310- t .Log ("Creating first instance (1 vCPU, 1GB memory)..." )
309+ // Create first VM: 1 vCPU, 2GB + 512MB = 2.5GB memory
310+ t .Log ("Creating first instance (1 vCPU, 2.5GB memory)..." )
311311 inst1 , err := mgr .CreateInstance (ctx , CreateInstanceRequest {
312312 Name : "small-vm-1" ,
313313 Image : "docker.io/library/alpine:latest" ,
314314 Vcpus : 1 ,
315- Size : 512 * 1024 * 1024 , // 512MB
316- HotplugSize : 512 * 1024 * 1024 , // 512MB (total 1GB)
315+ Size : 2 * 1024 * 1024 * 1024 , // 2GB (needs extra room for initrd with NVIDIA libs)
316+ HotplugSize : 512 * 1024 * 1024 , // 512MB
317317 OverlaySize : 1 * 1024 * 1024 * 1024 ,
318318 NetworkEnabled : false ,
319319 })
@@ -325,7 +325,7 @@ func TestAggregateLimits_EnforcedAtRuntime(t *testing.T) {
325325 usage , err = mgr .calculateAggregateUsage (ctx )
326326 require .NoError (t , err )
327327 assert .Equal (t , 1 , usage .TotalVcpus , "Should have 1 vCPU in use" )
328- assert .Equal (t , int64 (1024 * 1024 * 1024 ), usage .TotalMemory , "Should have 1GB memory in use" )
328+ assert .Equal (t , int64 (2 * 1024 * 1024 * 1024 + 512 * 1024 * 1024 ), usage .TotalMemory , "Should have 2.5GB memory in use" )
329329 t .Logf ("Aggregate usage after first VM: %d vCPUs, %d bytes memory" , usage .TotalVcpus , usage .TotalMemory )
330330
331331 // Try to create second VM: 2 vCPUs (would exceed MaxTotalVcpus=2)
0 commit comments