Hello!

I am using H2 as an in-memory substitute for MySQL to run a portion of my 
application's test suite. The way I am using it currently looks something 
like this:

   1. Before test suite runs
      1. Start H2 server
      2. Run Liquibase migrations
   2. Before each test runs
      1. Seed database with data specific to test
   3. Run test
   4. After each test runs
      1. Remove test-specific seed data (to avoid unique constraint 
      violations, etc.)
   5. After test suite finishes running
      1. Shut down H2
   
Setting up and tearing down seed data is a bit of a hassle. I've thought 
that one way I might ease this burden is to eliminate the seed tear-down 
step. I've considered running the Liquibase migrations before each test 
runs, but that would be very time consuming. I've also thought of backing 
up the database after running the Liquibase migrations, and restoring the 
backup after each test. This would involve a lot of disk writes, and I 
imagine would be similarly time consuming.

One option I'm interested in exploring is using the snapshot feature of the 
underlying MVStore. My questions are:

   1. Is it currently possible to have my test suite run against the 
   in-memory TcpServer, and, before each test runs, access the underlying 
   MVStore to restore to a snapshot version?
   2. If it is currently possible..is it safe?

Thanks for reading, and for the fantastic tool!

Best,
Max 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to