From a4f26a7bcc9b018b6f7311e2896da4cbd3559cb4 Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Fri, 10 Jan 2025 20:15:58 +0000 Subject: [PATCH] Issue #3477191 by goz, pavel.bulat, benjifisher, catch: Add PerformanceTestTrait::assertMetrics() so it is easier to write performance tests --- core/tests/Drupal/Tests/PerformanceTestTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tests/Drupal/Tests/PerformanceTestTrait.php b/core/tests/Drupal/Tests/PerformanceTestTrait.php index ac6f589caa4e..d7b780f3aa50 100644 --- a/core/tests/Drupal/Tests/PerformanceTestTrait.php +++ b/core/tests/Drupal/Tests/PerformanceTestTrait.php @@ -640,7 +640,7 @@ protected function assertMetrics( array $expected, PerformanceData $performance_data, ): void { - // Allow those metrics to have a range of +/- 50 bytes, so small changes + // Allow those metrics to have a range of +/- 500 bytes, so small changes // are not significant enough to break tests. $assertRange = [ 'ScriptBytes', @@ -648,7 +648,7 @@ protected function assertMetrics( ]; foreach ($expected as $name => $metric) { if (in_array($name, $assertRange)) { - $this->assertCountBetween($metric - 50, $metric + 50, $performance_data->{"get$name"}(), "Asserting $name"); + $this->assertCountBetween($metric - 500, $metric + 500, $performance_data->{"get$name"}(), "Asserting $name"); } else { $this->assertSame($metric, $performance_data->{"get$name"}(), "Asserting $name"); -- GitLab