storyboard/.stestr.conf
Adam Coldrick 6cdc6f4bfb Use one database per test class rather than per test
When running the test suite using MySQL, a lot of time is spent
creating the database, running the migrations, and then dropping
the database when the test finishes. Obviously we need a clean
database at the start of each test, but that doesn't mean we need
to run the migrations every single time.

Setting parallel_class to True in .stestr.conf makes all the tests
in a given class run in the same subprocess, whilst retaining
parallelisation when there is more than one test class discovered.

This commit moves the setup and cleanup of the database to the class
level rather than the test level, so that the slow migration step only
runs once per test class, rather than once per test. Cleaning the
database between tests is done by deleting everything from the tables
(excepting the tables that are populated by the migrations themselves),
and resetting any autoincrement counters.

This reduces the runtime of the individual tests by an order of
magnitude locally, from about 10 seconds per test to about 1 second per
test with this patch applied. There is still some overhead for each
class, but I can now run the test suite in about 15 minutes with MySQL
on my machine, as opposed to over an hour previously.

Change-Id: I1f38a3c4bf88cba8abfaa3f7d39d1403be6952b7
2019-03-18 15:24:05 +00:00

3 lines
58 B
Plaintext

[DEFAULT]
test_path=./storyboard/tests
parallel_class=True