Skip to content
Snippets Groups Projects
Verified Commit a3f1255f authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3410312 by catch: Flood database backend ::isAllowed() should call ::ensureTableExists()

parent 04900c3c
No related branches found
No related tags found
No related merge requests found
...@@ -140,7 +140,9 @@ public function isAllowed($name, $threshold, $window = 3600, $identifier = NULL) ...@@ -140,7 +140,9 @@ public function isAllowed($name, $threshold, $window = 3600, $identifier = NULL)
return ($number < $threshold); return ($number < $threshold);
} }
catch (\Exception $e) { catch (\Exception $e) {
$this->catchException($e); if (!$this->ensureTableExists()) {
throw $e;
}
return TRUE; return TRUE;
} }
} }
......
...@@ -60,7 +60,7 @@ public function testAnonymous() { ...@@ -60,7 +60,7 @@ public function testAnonymous() {
// the highest and lowest number of observed during test runs. // the highest and lowest number of observed during test runs.
// See https://www.drupal.org/project/drupal/issues/3402610 // See https://www.drupal.org/project/drupal/issues/3402610
$this->assertGreaterThanOrEqual(58, $performance_data->getQueryCount()); $this->assertGreaterThanOrEqual(58, $performance_data->getQueryCount());
$this->assertLessThanOrEqual(67, $performance_data->getQueryCount()); $this->assertLessThanOrEqual(68, $performance_data->getQueryCount());
$this->assertGreaterThanOrEqual(129, $performance_data->getCacheGetCount()); $this->assertGreaterThanOrEqual(129, $performance_data->getCacheGetCount());
$this->assertLessThanOrEqual(132, $performance_data->getCacheGetCount()); $this->assertLessThanOrEqual(132, $performance_data->getCacheGetCount());
$this->assertGreaterThanOrEqual(59, $performance_data->getCacheSetCount()); $this->assertGreaterThanOrEqual(59, $performance_data->getCacheSetCount());
...@@ -131,7 +131,7 @@ public function testLogin(): void { ...@@ -131,7 +131,7 @@ public function testLogin(): void {
// random test failures, assert greater than equal the highest and lowest // random test failures, assert greater than equal the highest and lowest
// number of queries observed during test runs. // number of queries observed during test runs.
// See https://www.drupal.org/project/drupal/issues/3402610 // See https://www.drupal.org/project/drupal/issues/3402610
$this->assertLessThanOrEqual(42, $performance_data->getQueryCount()); $this->assertLessThanOrEqual(39, $performance_data->getQueryCount());
$this->assertGreaterThanOrEqual(39, $performance_data->getQueryCount()); $this->assertGreaterThanOrEqual(39, $performance_data->getQueryCount());
$this->assertSame(28, $performance_data->getCacheGetCount()); $this->assertSame(28, $performance_data->getCacheGetCount());
$this->assertLessThanOrEqual(2, $performance_data->getCacheSetCount()); $this->assertLessThanOrEqual(2, $performance_data->getCacheSetCount());
...@@ -163,14 +163,15 @@ public function testLoginBlock(): void { ...@@ -163,14 +163,15 @@ public function testLoginBlock(): void {
$performance_data = $this->collectPerformanceData(function () use ($account) { $performance_data = $this->collectPerformanceData(function () use ($account) {
$this->submitLoginForm($account); $this->submitLoginForm($account);
}); });
$this->assertLessThanOrEqual(51, $performance_data->getQueryCount()); $this->assertLessThanOrEqual(50, $performance_data->getQueryCount());
$this->assertGreaterThanOrEqual(48, $performance_data->getQueryCount()); $this->assertGreaterThanOrEqual(48, $performance_data->getQueryCount());
$this->assertSame(30, $performance_data->getCacheGetCount()); // This test observes a variable number of cache operations, so to avoid random
// This test observes a variable number of cache sets, so to avoid random
// test failures, assert greater than equal the highest and lowest number // test failures, assert greater than equal the highest and lowest number
// observed during test runs. // observed during test runs.
// See https://www.drupal.org/project/drupal/issues/3402610 // See https://www.drupal.org/project/drupal/issues/3402610
$this->assertLessThanOrEqual(32, $performance_data->getCacheGetCount());
$this->assertGreaterThanOrEqual(30, $performance_data->getCacheGetCount());
$this->assertLessThanOrEqual(4, $performance_data->getCacheSetCount()); $this->assertLessThanOrEqual(4, $performance_data->getCacheSetCount());
$this->assertGreaterThanOrEqual(1, $performance_data->getCacheSetCount()); $this->assertGreaterThanOrEqual(1, $performance_data->getCacheSetCount());
$this->assertSame(1, $performance_data->getCacheDeleteCount()); $this->assertSame(1, $performance_data->getCacheDeleteCount());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment