tests: improve sometimes-failing test