type Mock … type MockState … // DeepCopy takes a snapshot of all slices. It cannot do a deep copy of the items in those slices, // but typically those keys are immutable. func (m MockState[T]) DeepCopy() *MockState[T] { … } type MockDelayedItem … // SyncOne adds the item to the work queue and calls sync. // That sync function can pull one or more items from the work // queue until the queue is empty. Then it is told that the queue // is shutting down, which must cause it to return. // // The test can then retrieve the state of the queue to check the result. func (m *Mock[T]) SyncOne(item T, sync func(workqueue.TypedRateLimitingInterface[T])) { … } // State returns the current state of the queue. func (m *Mock[T]) State() MockState[T] { … } // Add implements [TypedInterface]. func (m *Mock[T]) Add(item T) { … } // Len implements [TypedInterface]. func (m *Mock[T]) Len() int { … } // Get implements [TypedInterface]. func (m *Mock[T]) Get() (item T, shutdown bool) { … } // Done implements [TypedInterface]. func (m *Mock[T]) Done(item T) { … } // ShutDown implements [TypedInterface]. func (m *Mock[T]) ShutDown() { … } // ShutDownWithDrain implements [TypedInterface]. func (m *Mock[T]) ShutDownWithDrain() { … } // ShuttingDown implements [TypedInterface]. func (m *Mock[T]) ShuttingDown() bool { … } // AddAfter implements [TypedDelayingInterface.AddAfter] func (m *Mock[T]) AddAfter(item T, duration time.Duration) { … } // AddRateLimited implements [TypedRateLimitingInterface.AddRateLimited]. func (m *Mock[T]) AddRateLimited(item T) { … } // Forget implements [TypedRateLimitingInterface.Forget]. func (m *Mock[T]) Forget(item T) { … } // NumRequeues implements [TypedRateLimitingInterface.NumRequeues]. func (m *Mock[T]) NumRequeues(item T) int { … }