From 0bdb30910e35616241e59cf5fa8bca257c40ab4a Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sun, 14 Apr 2024 08:02:51 +0100 Subject: [PATCH] Issue #3412641 by catch, alexpott: OpenTelemetryNodePagePerformanceTest::testNodePageHotCache() is not hot enough --- .../OpenTelemetryFrontPagePerformanceTest.php | 2 +- .../OpenTelemetryNodePagePerformanceTest.php | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php index f3ef2a416d86..c313f1cce5d3 100644 --- a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php +++ b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php @@ -80,7 +80,7 @@ public function testFrontPageCoolCache() { $this->drupalGet('<front>'); $this->rebuildAll(); // Now visit a different page to warm non-route-specific caches. - $this->drupalGet('/user/login'); + $this->drupalGet('user/login'); $this->collectPerformanceData(function () { $this->drupalGet('<front>'); }, 'umamiFrontPageCoolCache'); diff --git a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php index 2b9287336e6b..a378ae0081b5 100644 --- a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php +++ b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php @@ -29,7 +29,7 @@ public function testNodePageColdCache() { $this->drupalGet('user/login'); $this->rebuildAll(); $this->collectPerformanceData(function () { - $this->drupalGet('/node/1'); + $this->drupalGet('node/1'); }, 'umamiNodePageColdCache'); $this->assertSession()->pageTextContains('quiche'); } @@ -44,10 +44,17 @@ public function testNodePageHotCache() { // the browser cache. $this->drupalGet('node/1'); $this->drupalGet('node/1'); - $this->collectPerformanceData(function () { - $this->drupalGet('/node/1'); + + $performance_data = $this->collectPerformanceData(function () { + $this->drupalGet('node/1'); }, 'umamiNodePageHotCache'); $this->assertSession()->pageTextContains('quiche'); + $this->assertSame($performance_data->getQueryCount(), 0); + $this->assertSame($performance_data->getCacheGetCount(), 1); + $this->assertSame($performance_data->getCacheSetCount(), 0); + $this->assertSame($performance_data->getCacheDeleteCount(), 0); + $this->assertSame(0, $performance_data->getCacheTagChecksumCount()); + $this->assertSame(1, $performance_data->getCacheTagIsValidCount()); } /** @@ -61,9 +68,9 @@ public function testNodePageCoolCache() { $this->drupalGet('node/1'); $this->rebuildAll(); // Now visit a non-node page to warm non-route-specific caches. - $this->drupalGet('/user/login'); + $this->drupalGet('user/login'); $this->collectPerformanceData(function () { - $this->drupalGet('/node/1'); + $this->drupalGet('node/1'); }, 'umamiNodePageCoolCache'); $this->assertSession()->pageTextContains('quiche'); } @@ -79,9 +86,9 @@ public function testNodePageWarmCache() { $this->drupalGet('node/1'); $this->rebuildAll(); // Now visit a different node page to warm non-path-specific caches. - $this->drupalGet('/node/2'); + $this->drupalGet('node/2'); $this->collectPerformanceData(function () { - $this->drupalGet('/node/1'); + $this->drupalGet('node/1'); }, 'umamiNodePageWarmCache'); $this->assertSession()->pageTextContains('quiche'); } -- GitLab