function OpenTelemetryPerformanceTest::testNodePageColdCache

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::testNodePageColdCache()

Logs node page tracing data with a cold cache.

1 call to OpenTelemetryPerformanceTest::testNodePageColdCache()
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 50

Class

OpenTelemetryPerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

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');
  $this->assertMetricsByName('umamiNodePageColdCache', $performance_data);
}

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