A test database is disposable by definition, so writing it to disk is paying durability costs for data that is deleted at the end of the run.
services:
mysql-test:
image: mysql:8.0
tmpfs:
- /var/lib/mysql:rw,size=1g
command: >-
--innodb-flush-method=nosync
--innodb-doublewrite=0
--skip-innodb-adaptive-hash-index
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
The suite went from 4m10 to 1m50, most of which is the flush settings rather than the tmpfs — durability is what makes a write slow, and turning it off is only acceptable because losing the data is the intended outcome. The size limit is not optional: without it the tmpfs can grow until the host runs out of memory, and a runaway test that inserts a million rows will find that. This configuration must never be reachable from the production compose file, which is an argument for a separate file rather than an override.