[1.7.x] Fixed test failures introduced by refs #22881.

Backport of 908160f692 from master