Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Test/ElasticsearchTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@ abstract class ElasticsearchTestCase extends WebTestCase
*/
private $container;

/**
* {@inheritdoc}
*/
public function runTest()
{
if ($this->getNumberOfRetries() < 1) {
return parent::runTest();
}

foreach (range(1, $this->getNumberOfRetries()) as $try) {
try {
return parent::runTest();
} catch (\PHPUnit_Framework_SkippedTestError $e) {
throw $e;
} catch (\PHPUnit_Framework_IncompleteTestError $e) {
throw $e;
} catch (\Exception $e) {
// Try more.
}
}

throw $e;
}

/**
* {@inheritdoc}
*/
Expand All @@ -42,6 +66,16 @@ protected function setUp()
$this->getManager();
}

/**
* Returns number of retries tests should execute.
*
* @return int
*/
protected function getNumberOfRetries()
{
return 3;
}

/**
* Can be overwritten in child class to populate elasticsearch index with data.
*
Expand Down