Fix flaky scheduler factory test.