@@ -122,7 +122,7 @@ type testHarness struct {
122122 // The harness's mutex protects the single source of truth for all mock state.
123123 mu sync.Mutex
124124 queues map [types.FlowKey ]* mocks.MockManagedQueue
125- priorityFlows map [uint ][]types.FlowKey // Key: `priority`
125+ priorityFlows map [int ][]types.FlowKey // Key: `priority`
126126
127127 // Customizable policy logic for tests to override.
128128 interFlowPolicySelectQueue func (band framework.PriorityBandAccessor ) (framework.FlowQueueAccessor , error )
@@ -139,7 +139,7 @@ func newTestHarness(t *testing.T, expiryCleanupInterval time.Duration) *testHarn
139139 logger : logr .Discard (),
140140 startSignal : make (chan struct {}),
141141 queues : make (map [types.FlowKey ]* mocks.MockManagedQueue ),
142- priorityFlows : make (map [uint ][]types.FlowKey ),
142+ priorityFlows : make (map [int ][]types.FlowKey ),
143143 }
144144
145145 // Wire up the harness to provide the mock implementations for the shard's dependencies.
@@ -153,7 +153,7 @@ func newTestHarness(t *testing.T, expiryCleanupInterval time.Duration) *testHarn
153153 h .StatsFunc = func () contracts.ShardStats {
154154 return contracts.ShardStats {
155155 TotalCapacityBytes : 1e9 ,
156- PerPriorityBandStats : map [uint ]contracts.PriorityBandStats {
156+ PerPriorityBandStats : map [int ]contracts.PriorityBandStats {
157157 testFlow .Priority : {CapacityBytes : 1e9 },
158158 },
159159 }
@@ -249,10 +249,10 @@ func (h *testHarness) managedQueue(key types.FlowKey) (contracts.ManagedQueue, e
249249}
250250
251251// allOrderedPriorityLevels provides the mock implementation for the `RegistryShard` interface.
252- func (h * testHarness ) allOrderedPriorityLevels () []uint {
252+ func (h * testHarness ) allOrderedPriorityLevels () []int {
253253 h .mu .Lock ()
254254 defer h .mu .Unlock ()
255- prios := make ([]uint , 0 , len (h .priorityFlows ))
255+ prios := make ([]int , 0 , len (h .priorityFlows ))
256256 for p := range h .priorityFlows {
257257 prios = append (prios , p )
258258 }
@@ -262,7 +262,7 @@ func (h *testHarness) allOrderedPriorityLevels() []uint {
262262
263263// priorityBandAccessor provides the mock implementation for the `RegistryShard` interface. It acts as a factory for a
264264// fully-configured, stateless mock that is safe for concurrent use.
265- func (h * testHarness ) priorityBandAccessor (p uint ) (framework.PriorityBandAccessor , error ) {
265+ func (h * testHarness ) priorityBandAccessor (p int ) (framework.PriorityBandAccessor , error ) {
266266 band := & frameworkmocks.MockPriorityBandAccessor {PriorityV : p }
267267
268268 // Safely get a snapshot of the flow IDs under a lock.
@@ -288,7 +288,7 @@ func (h *testHarness) priorityBandAccessor(p uint) (framework.PriorityBandAccess
288288}
289289
290290// interFlowDispatchPolicy provides the mock implementation for the `contracts.RegistryShard` interface.
291- func (h * testHarness ) interFlowDispatchPolicy (p uint ) (framework.InterFlowDispatchPolicy , error ) {
291+ func (h * testHarness ) interFlowDispatchPolicy (p int ) (framework.InterFlowDispatchPolicy , error ) {
292292 policy := & frameworkmocks.MockInterFlowDispatchPolicy {}
293293 // If the test provided a custom implementation, use it.
294294 if h .interFlowPolicySelectQueue != nil {
@@ -362,7 +362,7 @@ func TestShardProcessor(t *testing.T) {
362362 item := h .newTestItem ("req-capacity-reject" , testFlow , testTTL )
363363 h .addQueue (testFlow )
364364 h .StatsFunc = func () contracts.ShardStats {
365- return contracts.ShardStats {PerPriorityBandStats : map [uint ]contracts.PriorityBandStats {
365+ return contracts.ShardStats {PerPriorityBandStats : map [int ]contracts.PriorityBandStats {
366366 testFlow .Priority : {CapacityBytes : 50 }, // 50 is less than item size of 100
367367 }}
368368 }
@@ -685,7 +685,7 @@ func TestShardProcessor(t *testing.T) {
685685 name : "should reject item on registry priority band lookup failure" ,
686686 setupHarness : func (h * testHarness ) {
687687 h .addQueue (testFlow )
688- h .PriorityBandAccessorFunc = func (uint ) (framework.PriorityBandAccessor , error ) { return nil , testErr }
688+ h .PriorityBandAccessorFunc = func (int ) (framework.PriorityBandAccessor , error ) { return nil , testErr }
689689 },
690690 assert : func (t * testing.T , h * testHarness , item * flowItem ) {
691691 outcome , err := item .FinalState ()
@@ -776,7 +776,7 @@ func TestShardProcessor(t *testing.T) {
776776 itemByteSize : 1 ,
777777 stats : contracts.ShardStats {
778778 TotalCapacityBytes : 200 , TotalByteSize : 100 ,
779- PerPriorityBandStats : map [uint ]contracts.PriorityBandStats {
779+ PerPriorityBandStats : map [int ]contracts.PriorityBandStats {
780780 testFlow .Priority : {ByteSize : 50 , CapacityBytes : 50 },
781781 },
782782 },
@@ -787,7 +787,7 @@ func TestShardProcessor(t *testing.T) {
787787 itemByteSize : 1 ,
788788 stats : contracts.ShardStats {
789789 TotalCapacityBytes : 200 , TotalByteSize : 100 ,
790- PerPriorityBandStats : map [uint ]contracts.PriorityBandStats {}, // Missing stats for priority 10
790+ PerPriorityBandStats : map [int ]contracts.PriorityBandStats {}, // Missing stats for priority 10
791791 },
792792 expectHasCap : false ,
793793 },
@@ -796,7 +796,7 @@ func TestShardProcessor(t *testing.T) {
796796 itemByteSize : 10 ,
797797 stats : contracts.ShardStats {
798798 TotalCapacityBytes : 200 , TotalByteSize : 100 ,
799- PerPriorityBandStats : map [uint ]contracts.PriorityBandStats {
799+ PerPriorityBandStats : map [int ]contracts.PriorityBandStats {
800800 testFlow .Priority : {ByteSize : 50 , CapacityBytes : 100 },
801801 },
802802 },
@@ -854,7 +854,7 @@ func TestShardProcessor(t *testing.T) {
854854 {
855855 name : "should skip band on priority band accessor error" ,
856856 setupHarness : func (h * testHarness ) {
857- h .PriorityBandAccessorFunc = func (uint ) (framework.PriorityBandAccessor , error ) {
857+ h .PriorityBandAccessorFunc = func (int ) (framework.PriorityBandAccessor , error ) {
858858 return nil , registryErr
859859 }
860860 },
@@ -1196,8 +1196,8 @@ func TestShardProcessor(t *testing.T) {
11961196 t .Parallel ()
11971197 // --- ARRANGE ---
11981198 h := newTestHarness (t , testCleanupTick )
1199- h .AllOrderedPriorityLevelsFunc = func () []uint { return []uint {testFlow .Priority } }
1200- h .PriorityBandAccessorFunc = func (p uint ) (framework.PriorityBandAccessor , error ) {
1199+ h .AllOrderedPriorityLevelsFunc = func () []int { return []int {testFlow .Priority } }
1200+ h .PriorityBandAccessorFunc = func (p int ) (framework.PriorityBandAccessor , error ) {
12011201 return nil , errors .New ("registry error" )
12021202 }
12031203
0 commit comments