Fix random unit test failures on the bots [#12493]