@@ -209,6 +209,33 @@ func TestManager_UpdateConfiguration_ZeroValues(t *testing.T) {
209209 require .NoError (t , err )
210210}
211211
212+ func TestManager_Throttlers (t * testing.T ) {
213+ f := & managerTestFixture {}
214+ err := f .setUp ()
215+ require .NoError (t , err )
216+ defer f .tearDown ()
217+
218+ got := f .m .Throttlers ()
219+ want := []string {"t1" , "t2" }
220+ assert .Equal (t , want , got , "Throttlers() should return sorted names of all registered throttlers" )
221+ }
222+
223+ func TestManager_Log (t * testing.T ) {
224+ f := & managerTestFixture {}
225+ err := f .setUp ()
226+ require .NoError (t , err )
227+ defer f .tearDown ()
228+
229+ // log() on an existing throttler with no activity returns an empty (non-nil) slice.
230+ results , err := f .m .log ("t1" )
231+ require .NoError (t , err )
232+ assert .Empty (t , results , "freshly created throttler should have no log entries" )
233+
234+ // log() on an unknown throttler should return an error.
235+ _ , err = f .m .log ("unknown" )
236+ require .Error (t , err , "log() should return an error for an unregistered throttler" )
237+ }
238+
212239func checkConfig (m * managerImpl , throttlers []string , updatedThrottlers []string , targetLag int64 , ignoreNSlowestReplicas int32 ) error {
213240 // Sort list of throttler names because they came from a randomized Go map.
214241 sort .Strings (updatedThrottlers )
0 commit comments