function OpenTelemetryPerformanceTest::testNodePageWarmCache

Same name and namespace in other branches
  1. 11.x core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryPerformanceTest.php \Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryPerformanceTest::testNodePageWarmCache()

Log node/1 tracing data with a warm cache.

Warm here means that 'global' site caches and route-specific caches are warm but caches specific to this particular node/path are not.

1 call to OpenTelemetryPerformanceTest::testNodePageWarmCache()
OpenTelemetryPerformanceTest::testUmamiPerformance in core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryPerformanceTest.php
Test performance of various with various cache permutations.

File

core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryPerformanceTest.php, line 114

Class

OpenTelemetryPerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

protected function testNodePageWarmCache() : void {
  // First of all visit the node page to ensure the image style exists.
  $this->drupalGet('node/1');
  // Allow time for the image style and asset aggregate requests to finish.
  sleep(1);
  $this->clearCaches();
  // Now visit a different node page to warm non-path-specific caches.
  $this->drupalGet('node/2');
  sleep(1);
  $performance_data = $this->collectPerformanceData(function () {
    $this->drupalGet('node/1');
  }, 'umamiNodePageWarmCache');
  $this->assertSession()
    ->pageTextContains('quiche');
  // Check the actual queries so that if a change simultaneously adds and
  // removes a query the change is detected.
  $this->assertQueriesByName('umamiNodePageWarmCache', $performance_data->getQueries());
  $this->assertMetricsByName('umamiNodePageWarmCache', $performance_data);
}

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