function OpenTelemetryNodePagePerformanceTest::testNodePageColdCache
Same name and namespace in other branches
- 10 core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php \Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageColdCache()
- 11.x core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php \Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageColdCache()
Logs node page tracing data with a cold cache.
1 call to OpenTelemetryNodePagePerformanceTest::testNodePageColdCache()
- OpenTelemetryNodePagePerformanceTest::testNodePage in core/
profiles/ demo_umami/ tests/ src/ FunctionalJavascript/ OpenTelemetryNodePagePerformanceTest.php - Test canonical node page performance with various cache permutations.
File
-
core/
profiles/ demo_umami/ tests/ src/ FunctionalJavascript/ OpenTelemetryNodePagePerformanceTest.php, line 41
Class
- OpenTelemetryNodePagePerformanceTest
- Tests demo_umami profile performance.
Namespace
Drupal\Tests\demo_umami\FunctionalJavascriptCode
protected function testNodePageColdCache() : void {
// Request the node page twice then clear caches, this allows asset
// aggregate requests to complete so they are excluded from the performance
// test itself. Including the asset aggregates would lead to
// a non-deterministic test since they happen in parallel and therefore post
// response tasks run in different orders each time.
$this->drupalGet('node/1');
// Allow time for image style and aggregate requests to finish.
sleep(2);
$this->drupalGet('node/1');
$this->clearCaches();
$performance_data = $this->collectPerformanceData(function () {
$this->drupalGet('node/1');
}, 'umamiNodePageColdCache');
$this->assertSession()
->pageTextContains('quiche');
$expected = [
'QueryCount' => 224,
'CacheGetCount' => 241,
'CacheSetCount' => 238,
'CacheDeleteCount' => 0,
'CacheTagLookupQueryCount' => 24,
'CacheTagInvalidationCount' => 0,
'ScriptCount' => 1,
'ScriptBytes' => 12000,
'StylesheetCount' => 2,
'StylesheetBytes' => 40800,
];
$this->assertMetrics($expected, $performance_data);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.