Some tests execute the statement
to test scenarios where a default database is not available.
This may not be safe, depending on which tests have been run previously on the same server. In particular, starting with
MDEV-25506 in 10.6, if InnoDB had been killed in the middle of a DDL operation, some affected files may not be removed immediately on the subsequent startup, but later when the purge of history runs. There is no wait for purge in the implementation of DROP DATABASE.
The test main.view is the most frequent example of this, but others exist too:
I think that we should simply avoid dropping the "test" database in tests, and use a pattern like
to achieve a similar effect.