The root cause of the race is that the throttler uses a global configuration instance, and the different tests all read/write to that same configuration instance. While 1st test still maintains some open timers (soon to be terminated by cancelled context), 2nd test already begins.
While it will be nice for 1st test's throttler's timers to terminate earlier, something we will look into, it's more important to isolate the throttler's configuration.
Reported by @harshit-gangal , for example in https://github.com/vitessio/vitess/actions/runs/7299836104/job/19894003119?pr=14851, we see a race condition in the table throttler's unit tests, while iterating the configured MySQL clusters.
The root cause of the race is that the throttler uses a global configuration instance, and the different tests all read/write to that same configuration instance. While 1st test still maintains some open timers (soon to be terminated by cancelled context), 2nd test already begins.
While it will be nice for 1st test's throttler's timers to terminate earlier, something we will look into, it's more important to isolate the throttler's configuration.