@@ -300,6 +300,10 @@ func TestCanAdmit_Update_GPUCeiling(t *testing.T) {
300300// resources are charged to the target tenant's quota, not a delta.
301301func TestCanAdmit_Update_CrossTenantMove (t * testing.T ) {
302302 t .Parallel ()
303+ const (
304+ oldTenant = "old-tenant"
305+ targetTenant = "target-tenant"
306+ )
303307 e := newTestEnforcer (t )
304308
305309 // Target tenant quota is already at capacity (no room for a delta).
@@ -308,11 +312,11 @@ func TestCanAdmit_Update_CrossTenantMove(t *testing.T) {
308312
309313 // Old spec was in a different tenant ("old-tenant").
310314 oldSpec := makeSpec (3 , "1" ) // 3 replicas, 1 GPU per replica = 3 GPUs total
311- oldSpec .TenantRef = "old-tenant"
315+ oldSpec .TenantRef = oldTenant
312316
313317 // New spec moves to "target-tenant" with same resources.
314318 newSpec := makeSpec (3 , "1" ) // same resources: 3 replicas, 3 GPUs
315- newSpec .TenantRef = "target-tenant"
319+ newSpec .TenantRef = targetTenant
316320
317321 // The target tenant is already at capacity. Since this is a cross-tenant
318322 // move, the full amount (1 agent, 3 GPUs, 3 replicas) should be charged
@@ -332,10 +336,10 @@ func TestCanAdmit_Update_CrossTenantMove(t *testing.T) {
332336 targetUsage2 := makeUsage (1 , 2 , 4 ) // current: 1 agent, 2 GPUs, 4 replicas
333337
334338 oldSpec2 := makeSpec (3 , "1" ) // 3 replicas, 3 GPUs
335- oldSpec2 .TenantRef = "old-tenant"
339+ oldSpec2 .TenantRef = oldTenant
336340
337341 newSpec2 := makeSpec (3 , "1" ) // same resources
338- newSpec2 .TenantRef = "target-tenant"
342+ newSpec2 .TenantRef = targetTenant
339343
340344 // Target can accommodate: 1+1=2 ≤ 3 agents, 2+3=5 ≤ 8 GPUs, 4+3=7 ≤ 10 replicas.
341345 ok2 , reason2 := e .CanAdmit ("ns/ad-move2" , targetQuota2 , targetUsage2 , newSpec2 , & oldSpec2 )
@@ -346,11 +350,11 @@ func TestCanAdmit_Update_CrossTenantMove(t *testing.T) {
346350 // Test case 3: Cross-tenant move with resource change (increase).
347351 // Old spec: different tenant, 2 replicas, 2 GPUs.
348352 oldSpec3 := makeSpec (2 , "1" )
349- oldSpec3 .TenantRef = "old-tenant"
353+ oldSpec3 .TenantRef = oldTenant
350354
351355 // New spec: target tenant, 4 replicas, 4 GPUs.
352356 newSpec3 := makeSpec (4 , "1" )
353- newSpec3 .TenantRef = "target-tenant"
357+ newSpec3 .TenantRef = targetTenant
354358
355359 targetQuota3 := makeQuota (3 , 5 , 8 , 5 )
356360 targetUsage3 := makeUsage (1 , 1 , 2 ) // 1 agent, 1 GPU, 2 replicas
@@ -367,10 +371,10 @@ func TestCanAdmit_Update_CrossTenantMove(t *testing.T) {
367371 targetUsage4 := makeUsage (1 , 1 , 2 )
368372
369373 oldSpec4 := makeSpec (2 , "1" )
370- oldSpec4 .TenantRef = "old-tenant"
374+ oldSpec4 .TenantRef = oldTenant
371375
372376 newSpec4 := makeSpec (4 , "1" ) // 4 GPUs needed
373- newSpec4 .TenantRef = "target-tenant"
377+ newSpec4 .TenantRef = targetTenant
374378
375379 // 1 + 4 = 5 GPUs > 4 → should be rejected.
376380 ok4 , reason4 := e .CanAdmit ("ns/ad-move4" , targetQuota4 , targetUsage4 , newSpec4 , & oldSpec4 )
0 commit comments