MDL-56273 cache: Use cache initialise always.
purge_all() and purge_by_definition() look in the configuration for which caches are available and then creates them to purge them. The configuration stores the values used by initialise(), not initialise_unit_test_instance() and would therefore fail to purge all caches if they were not purged by another means. In the case of filestore, it's purged by unit tests, in the case of memcache(d), it purges the whole store when a single definition is requested. Therefore all configuration was moved into the configuration file during unit tests and does not have any special override codes in the unit test infrastructure.
This commit is contained in:
@@ -814,12 +814,13 @@ abstract class testing_util {
|
||||
make_temp_directory('');
|
||||
make_cache_directory('');
|
||||
make_localcache_directory('');
|
||||
// Purge all data from the caches. This is required for consistency between tests.
|
||||
// Any file caches that happened to be within the data root will have already been clearer (because we just deleted cache)
|
||||
// and now we will purge any other caches as well. This must be done before the cache_factory::reset() as that
|
||||
// removes all definitions of caches and purge does not have valid caches to operate on.
|
||||
cache_helper::purge_all();
|
||||
// Reset the cache API so that it recreates it's required directories as well.
|
||||
cache_factory::reset();
|
||||
// Purge all data from the caches. This is required for consistency.
|
||||
// Any file caches that happened to be within the data root will have already been clearer (because we just deleted cache)
|
||||
// and now we will purge any other caches as well.
|
||||
cache_helper::purge_all();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user