Fri, 26 Oct 2018 17:12:26 +0200 Make test database template creation concurrent
Philippe Pepiot <philippe.pepiot@logilab.fr> [Fri, 26 Oct 2018 17:12:26 +0200] rev 12357
Make test database template creation concurrent build_db_cache() is used in tests to create test database templates, i.e. DEFAULT_EMPTY_DB_ID (which is __default_empty_db__) and custom template database using CubicwebTC test_db_id/pre_setup_database API. When running tests in parallel using multiple processes, build_db_cache() may try to build the same database twice. Avoid this by adding synchronisation of process by using a file lock. So when two processes require the same template database, one build the database and others wait it to be created. Use filelock (https://github.com/benediktschmitt/py-filelock) library to have a portable (unix / windows) way for handling locks. Also filelock is packaged in debian: https://packages.debian.org/source/python-filelock
Fri, 26 Oct 2018 17:00:05 +0200 Make test database cache lookup concurrent
Philippe Pepiot <philippe.pepiot@logilab.fr> [Fri, 26 Oct 2018 17:00:05 +0200] rev 12356
Make test database cache lookup concurrent has_cache() is used to dertermine if the template database already exists or not. When running tests accross multiple process, has_cache() wasn't aware of databases created by other processes because it used a cache to generate the cache... Since the discovering discover_cached_db() time is quite reasonable (it's just about listing file in a directory), let re-generate the cache on cache miss.
(0) -10000 -3000 -1000 -300 -100 -30 -10 -2 +2 +10 +30 +100 +300 tip