dimanche 24 février 2019

Efficient H2 snaphots for integration tests

We use H2 in some integration tests and run multiple test steps with a specific state of the database.

We use SCRIPT to dump ("cache") the database state:

SCRIPT NOPASSWORDS NOSETTINGS TO '/path/to/dump.zip' CHARSET 'UTF-8'

and restore the dump with RUNSCRIPT before each test step:

RUNSCRIPT FROM '/path/to/dump.zip' COMPRESSION ZIP CHARSET 'UTF-8'

If the test steps are short, restoring the database snapshot can dominate the total test execution time.

Since there is no requirement to restore the snapshot with different versions of H2, I’m wondering if there is a more efficient way to snapshot/restore the database?

Maybe by accessing the underlying MVStore?

Aucun commentaire:

Enregistrer un commentaire