Fixed #22237 -- Removed some warnings in the test suite

Thanks Aymeric Augustin for the report.