function OpenTelemetryNodePagePerformanceTest::testNodePageHotCache

Same name in other branches
  1. 10 core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php \Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryNodePagePerformanceTest::testNodePageHotCache()

Logs node page tracing data with a hot cache.

Hot here means that all possible caches are warmed.

1 call to OpenTelemetryNodePagePerformanceTest::testNodePageHotCache()
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 54

Class

OpenTelemetryNodePagePerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

protected function testNodePageHotCache() : void {
    // Request the page twice so that asset aggregates are definitely cached in
    // the browser cache.
    $this->drupalGet('node/1');
    $this->drupalGet('node/1');
    $performance_data = $this->collectPerformanceData(function () {
        $this->drupalGet('node/1');
    }, 'umamiNodePageHotCache');
    $this->assertSession()
        ->pageTextContains('quiche');
    $expected_queries = [];
    $recorded_queries = $performance_data->getQueries();
    $this->assertSame($expected_queries, $recorded_queries);
    $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());
    $this->assertSame(0, $performance_data->getCacheTagInvalidationCount());
    $this->assertSame(1, $performance_data->getScriptCount());
    $this->assertCountBetween(7000, 8000, $performance_data->getScriptBytes());
    $this->assertSame(2, $performance_data->getStylesheetCount());
    $this->assertCountBetween(41500, 42500, $performance_data->getStylesheetBytes());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.