Unverified Commit 29178021 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3554646 by catch, smustgrave: Stabilize OpenTelemetryAuthenticatedPerformanceTest

(cherry picked from commit 050d15b0)
parent 920f7e1a
Loading
Loading
Loading
Loading
Loading
+35 −17
Original line number Diff line number Diff line
@@ -24,13 +24,6 @@ class OpenTelemetryAuthenticatedPerformanceTest extends PerformanceTestBase {
   */
  protected $profile = 'demo_umami';

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();
  }

  /**
   * Logs front page tracing data with an authenticated user and warm cache.
   */
@@ -82,14 +75,39 @@ public function testFrontPageAuthenticatedWarmCache(): void {
   * Logs node page performance with an administrator.
   */
  public function testNodePageAdministrator(): void {
    $user = $this->drupalCreateUser([], NULL, TRUE);

    // Create a user with most important admin permissions, but not access to
    // contextual links. This is because contextual module makes an AJAX request
    // dependent on the content of browser local storage, which can make
    // performance testing indeterminate.
    $user = $this->drupalCreateUser([
      'administer nodes',
      'bypass node access',
      'access administration pages',
      'administer site configuration',
      'administer modules',
      'administer themes',
      'administer users',
      'access toolbar',
      'administer shortcuts',
      'administer media',
      'access files overview',
      'administer blocks',
      'administer block content',
      'administer taxonomy',
      'access site reports',
      'administer menu',
      'access announcements',
    ]);
    $this->drupalLogin($user);
    sleep(2);
    // This is a very heavy request so allow extra time for asset, image
    // derivative requests and post response tasks to finish.
    sleep(5);

    $this->drupalGet('node/1');
    sleep(2);
    $this->drupalGet('node/1');
    sleep(2);
    sleep(1);

    $this->clearCaches();

@@ -98,27 +116,27 @@ public function testNodePageAdministrator(): void {
    }, 'administratorNodePage');

    $expected = [
      'QueryCount' => 525,
      'CacheGetCount' => 550,
      'QueryCount' => 524,
      'CacheGetCount' => 546,
      'CacheGetCountByBin' => [
        'config' => 201,
        'bootstrap' => 28,
        'discovery' => 112,
        'data' => 72,
        'data' => 70,
        'dynamic_page_cache' => 2,
        'default' => 45,
        'default' => 43,
        'entity' => 23,
        'render' => 39,
        'menu' => 28,
      ],
      'CacheSetCount' => 455,
      'CacheSetCount' => 454,
      'CacheDeleteCount' => 0,
      'CacheTagInvalidationCount' => 0,
      'CacheTagLookupQueryCount' => 47,
      'ScriptCount' => 3,
      'ScriptBytes' => 263500,
      'ScriptBytes' => 249750,
      'StylesheetCount' => 6,
      'StylesheetBytes' => 106000,
      'StylesheetBytes' => 101000,
    ];
    $this->assertMetrics($expected, $performance_data);
  }