From 1ba0ae6e8530d3dab55ad1333c0d392eefa2d401 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 19 Oct 2019 17:48:34 +0200 Subject: [ticket/16078] Try using retries for timeout issue The timeout only seems to occur on the first test so let's see what a retry can do to help with this issue. PHPBB3-16078 --- tests/test_framework/phpbb_ui_test_case.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index 4d88d7d9cb..e7c9bd4d0b 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -158,7 +158,23 @@ class phpbb_ui_test_case extends phpbb_test_case public function visit($path) { - $this->getDriver()->get(self::$root_url . $path); + // Retry three times on curl issues, e.g. timeout + try + { + $this->getDriver()->get(self::$root_url . $path); + } + catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception) + { + try + { + $this->getDriver()->get(self::$root_url . $path); + } + catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception) + { + // Last try, throw exception after this one fails + $this->getDriver()->get(self::$root_url . $path); + } + } } static protected function recreate_database($config) -- cgit v1.2.1 From 8b6776eed22edc33b3f35946fba6b5de4bfe73a1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 20 Oct 2019 15:51:47 +0200 Subject: [ticket/16078] Use while loop for visit retries PHPBB3-16078 --- tests/test_framework/phpbb_ui_test_case.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests/test_framework/phpbb_ui_test_case.php') diff --git a/tests/test_framework/phpbb_ui_test_case.php b/tests/test_framework/phpbb_ui_test_case.php index e7c9bd4d0b..48e510abe3 100644 --- a/tests/test_framework/phpbb_ui_test_case.php +++ b/tests/test_framework/phpbb_ui_test_case.php @@ -159,20 +159,23 @@ class phpbb_ui_test_case extends phpbb_test_case public function visit($path) { // Retry three times on curl issues, e.g. timeout - try - { - $this->getDriver()->get(self::$root_url . $path); - } - catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception) + $attempts = 0; + $retries = 3; + + while (true) { + $attempts++; try { $this->getDriver()->get(self::$root_url . $path); + break; } catch (Facebook\WebDriver\Exception\WebDriverCurlException $exception) { - // Last try, throw exception after this one fails - $this->getDriver()->get(self::$root_url . $path); + if ($attempts >= $retries) + { + throw $exception; + } } } } -- cgit v1.2.1