From 7c7705f6375b3f48806bb71a12a62726d0ac8e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Sat, 18 Dec 2021 21:44:13 +0100 Subject: [PATCH] [TASK] Use database cache backend for specific tests With a recent change in typo3/testing-framework, various core caches in functional tests are set to NullBackend. This speeds up functional tests up to 10% since the table creation and insert load is higher in testing scenarios than actual cache hit benefits. Some functional tests however work on those tables, for instance the functional test of the database cache backend. The patch adapts these tests to according LocalConfiguration setup. > composer u typo3/testing-framework Resolves: #96387 Releases: main Change-Id: I9770c65d4cf80f98d2c4745024867acf6807e01e Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72706 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Simon Gilli <typo3@gilbertsoft.org> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Simon Gilli <typo3@gilbertsoft.org> Reviewed-by: Benni Mack <benni@typo3.org> --- composer.lock | 8 ++++---- .../Cache/Backend/Typo3DatabaseBackendTest.php | 17 +++++++++++++++++ .../Cache/Frontend/VariableFrontendTest.php | 16 ++++++++++++++++ .../Command/CacheFlushCommandTest.php | 16 ++++++++++++++++ 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 5abbb6b78af5..b4fc1d849c37 100644 --- a/composer.lock +++ b/composer.lock @@ -8239,12 +8239,12 @@ "source": { "type": "git", "url": "https://github.com/TYPO3/testing-framework.git", - "reference": "67d2e5c9434e52ed9efed750105884fa1bd089b7" + "reference": "e45ee97112096c5a902093cc9e2a4c07af1cb49e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/67d2e5c9434e52ed9efed750105884fa1bd089b7", - "reference": "67d2e5c9434e52ed9efed750105884fa1bd089b7", + "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/e45ee97112096c5a902093cc9e2a4c07af1cb49e", + "reference": "e45ee97112096c5a902093cc9e2a4c07af1cb49e", "shasum": "" }, "require": { @@ -8300,7 +8300,7 @@ "issues": "https://github.com/TYPO3/testing-framework/issues", "source": "https://github.com/TYPO3/testing-framework/tree/main" }, - "time": "2021-12-15T13:12:04+00:00" + "time": "2021-12-19T10:34:08+00:00" } ], "aliases": [], diff --git a/typo3/sysext/core/Tests/Functional/Cache/Backend/Typo3DatabaseBackendTest.php b/typo3/sysext/core/Tests/Functional/Cache/Backend/Typo3DatabaseBackendTest.php index 7c0b2d307656..df7889ba6162 100644 --- a/typo3/sysext/core/Tests/Functional/Cache/Backend/Typo3DatabaseBackendTest.php +++ b/typo3/sysext/core/Tests/Functional/Cache/Backend/Typo3DatabaseBackendTest.php @@ -29,6 +29,23 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; class Typo3DatabaseBackendTest extends FunctionalTestCase { use \Prophecy\PhpUnit\ProphecyTrait; + + /** + * @var array + */ + protected $configurationToUseInTestInstance = [ + 'SYS' => [ + 'caching' => [ + 'cacheConfigurations' => [ + // Set pages cache database backend, testing-framework sets this to NullBackend by default. + 'pages' => [ + 'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend', + ], + ], + ], + ], + ]; + /** * @test */ diff --git a/typo3/sysext/core/Tests/Functional/Cache/Frontend/VariableFrontendTest.php b/typo3/sysext/core/Tests/Functional/Cache/Frontend/VariableFrontendTest.php index 933fa5472378..7b6ecdbb8005 100644 --- a/typo3/sysext/core/Tests/Functional/Cache/Frontend/VariableFrontendTest.php +++ b/typo3/sysext/core/Tests/Functional/Cache/Frontend/VariableFrontendTest.php @@ -26,6 +26,22 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; */ class VariableFrontendTest extends FunctionalTestCase { + /** + * @var array + */ + protected $configurationToUseInTestInstance = [ + 'SYS' => [ + 'caching' => [ + 'cacheConfigurations' => [ + // Set pages cache database backend, testing-framework sets this to NullBackend by default. + 'pages' => [ + 'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend', + ], + ], + ], + ], + ]; + public function insertSerializedArrayIntoLobAndRetrieveItDataProvider(): array { $arrayToSerialize = [ diff --git a/typo3/sysext/core/Tests/Functional/Command/CacheFlushCommandTest.php b/typo3/sysext/core/Tests/Functional/Command/CacheFlushCommandTest.php index 9cd9586035cb..61b4c9ffd095 100644 --- a/typo3/sysext/core/Tests/Functional/Command/CacheFlushCommandTest.php +++ b/typo3/sysext/core/Tests/Functional/Command/CacheFlushCommandTest.php @@ -28,6 +28,22 @@ use TYPO3\CMS\Core\Package\PackageManager; */ class CacheFlushCommandTest extends AbstractCommandTest { + /** + * @var array + */ + protected $configurationToUseInTestInstance = [ + 'SYS' => [ + 'caching' => [ + 'cacheConfigurations' => [ + // Set pages cache database backend, testing-framework sets this to NullBackend by default. + 'pages' => [ + 'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend', + ], + ], + ], + ], + ]; + /** * @test */ -- GitLab