Skip to content

Commit

Permalink
[TASK] Configure frontend caches with NullBackend (#321)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sbuerk committed Jun 27, 2023
1 parent 2567404 commit ab9a614
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Classes/Core/Functional/FunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ab9a614

Please sign in to comment.