From ab9a6141aa810b9bad26e67d95139acf52888ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Sun, 19 Dec 2021 11:34:08 +0100 Subject: [PATCH] [TASK] Configure frontend caches with NullBackend (#321) The patch configures frontend related caches to ese the NullBackend in functional tests. This avoids creating corresponding tables and reduces SELECT and INSERT database statements. This results in a performance increase running frontend functional tests, with core, this is around 5-10% when using postgres DMBS. `extbase_object` cache has been removed with TYPO3 v10, therefore no longer set it to a `NullBackend`. The extbase caches has been mergend. Setting the cache to NullBackend does not have a benefit for core testing. If a extension would benefit from it, they can provide it by themself as a configuration override. --- Classes/Core/Functional/FunctionalTestCase.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/Core/Functional/FunctionalTestCase.php b/Classes/Core/Functional/FunctionalTestCase.php index c2d604da..92ede6c2 100644 --- a/Classes/Core/Functional/FunctionalTestCase.php +++ b/Classes/Core/Functional/FunctionalTestCase.php @@ -27,7 +27,6 @@ use Psr\Container\ContainerInterface; use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Cache\Backend\NullBackend; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\UserAspect; use TYPO3\CMS\Core\Core\Bootstrap; @@ -386,8 +385,15 @@ protected function setUp(): void $localConfiguration['SYS']['trustedHostsPattern'] = '.*'; $localConfiguration['SYS']['encryptionKey'] = 'i-am-not-a-secure-encryption-key'; - $localConfiguration['SYS']['caching']['cacheConfigurations']['extbase_object']['backend'] = NullBackend::class; $localConfiguration['GFX']['processor'] = 'GraphicsMagick'; + // Set cache backends to null backend instead of database backend let us save time for creating + // database schema for it and reduces selects/inserts to the database for cache operations, which + // are generally not really needed for functional tests. Specific tests may restore this in if needed. + $localConfiguration['SYS']['caching']['cacheConfigurations']['hash']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend'; + $localConfiguration['SYS']['caching']['cacheConfigurations']['imagesizes']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend'; + $localConfiguration['SYS']['caching']['cacheConfigurations']['pages']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend'; + $localConfiguration['SYS']['caching']['cacheConfigurations']['pagesection']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend'; + $localConfiguration['SYS']['caching']['cacheConfigurations']['rootline']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend'; $testbase->setUpLocalConfiguration($this->instancePath, $localConfiguration, $this->configurationToUseInTestInstance); $testbase->setUpPackageStates( $this->instancePath,