@@ -149,7 +149,9 @@ func node2k() *Node {
149149 },
150150 ReservedResources : & NodeReservedResources {
151151 Cpu : NodeReservedCpuResources {
152- CpuShares : 3000 , // set by fingerprinting callback
152+ // set by fingerprinting callback, topology of 1000 MHz * 4 cores (4000 MHz), of which 2 cores are reserved
153+ // plus 1000 MHz of reserved amount of CPU, effectively a total of 3000 MHz of reserved CPU
154+ CpuShares : 3000 ,
153155 ReservedCpuCores : []uint16 {2 , 3 },
154156 },
155157 Memory : NodeReservedMemoryResources {
@@ -214,9 +216,10 @@ func TestAllocsFit(t *testing.T) {
214216 must .Eq (t , 1024 , used .Flattened .Memory .MemoryMB )
215217
216218 // Should not fit second allocation
217- fit , _ , used , err = AllocsFit (n , []* Allocation {a1 , a1 }, nil , false )
219+ fit , dim , used , err = AllocsFit (n , []* Allocation {a1 , a1 }, nil , false )
218220 must .NoError (t , err )
219221 must .False (t , fit )
222+ must .Eq (t , "cpu" , dim )
220223 must .Eq (t , 2000 , used .Flattened .Cpu .CpuShares )
221224 must .Eq (t , 2048 , used .Flattened .Memory .MemoryMB )
222225
@@ -261,38 +264,6 @@ func TestAllocsFit(t *testing.T) {
261264 must .Eq (t , 1000 , used .Flattened .Cpu .CpuShares )
262265 must .Eq (t , []uint16 {0 }, used .Flattened .Cpu .ReservedCores )
263266 must .Eq (t , 1024 , used .Flattened .Memory .MemoryMB )
264-
265- a3 := & Allocation {
266- AllocatedResources : & AllocatedResources {
267- Tasks : map [string ]* AllocatedTaskResources {
268- "web" : {
269- Cpu : AllocatedCpuResources {
270- CpuShares : 1000 ,
271- },
272- Memory : AllocatedMemoryResources {
273- MemoryMB : 512 ,
274- },
275- },
276- },
277- },
278- }
279-
280- // Should fit one allocation
281- fit , dim , used , err = AllocsFit (n , []* Allocation {a3 }, nil , false )
282- must .NoError (t , err )
283- must .True (t , fit , must .Sprintf ("failed for dimension %q" , dim ))
284- must .Eq (t , 1000 , used .Flattened .Cpu .CpuShares )
285- must .Eq (t , []uint16 {}, used .Flattened .Cpu .ReservedCores )
286- must .Eq (t , 512 , used .Flattened .Memory .MemoryMB )
287-
288- // Should not fit second allocation
289- fit , dim , used , err = AllocsFit (n , []* Allocation {a3 , a3 }, nil , false )
290- must .NoError (t , err )
291- must .False (t , fit )
292- must .Eq (t , "cpu" , dim )
293- must .Eq (t , 2000 , used .Flattened .Cpu .CpuShares )
294- must .Eq (t , []uint16 {}, used .Flattened .Cpu .ReservedCores )
295- must .Eq (t , 1024 , used .Flattened .Memory .MemoryMB )
296267}
297268
298269func TestAllocsFit_Cores (t * testing.T ) {
@@ -721,7 +692,9 @@ func TestScoreFitBinPack(t *testing.T) {
721692 node .NodeResources .Compatibility ()
722693 node .ReservedResources = & NodeReservedResources {
723694 Cpu : NodeReservedCpuResources {
724- CpuShares : 6144 , // set by fingerprinting callback
695+ // set by fingerprinting callback, topology of 2048 MHz * 4 cores (8192 MHz), of which 2 cores are reserved
696+ // plus 2048 MHz of reserved amount of CPU, effectively a total of 6144 MHz of reserved CPU
697+ CpuShares : 6144 ,
725698 ReservedCpuCores : []uint16 {2 , 3 },
726699 },
727700 Memory : NodeReservedMemoryResources {
0 commit comments