[1.5.x] Fixed #21118 -- Isolated a test that uses the database.

Thanks rmboggs for the report.

Backport of 4f40b97d97 from master