Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retry for mysql savepoint #125

Merged
merged 3 commits into from
May 18, 2018
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG-0.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Unreleased
### Fixed
* Allow multiple, comma-separated values with the `--testsuite` option, like with PHPUnit 6+ [#122](https://github.com/facile-it/paraunit/pull/122)
* Add a new exception about MySQL savepoint to the retryable ones [#125](https://github.com/facile-it/paraunit/pull/125)

## [0.12.1] - 2018-04-06
### Fixed
Expand Down
1 change: 1 addition & 0 deletions src/Paraunit/Parser/JSON/RetryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(TestResultHandlerInterface $testResultContainer, int
// MySQL
'Deadlock found',
'Lock wait timeout exceeded',
'SAVEPOINT \w+ does not exist',
// SQLite
'General error: 5 database is locked',
];
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/Command/ParallelCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testExecution()
$this->assertContains(MySQLDeadLockTestStub::class, $output);
$this->assertNotEquals(0, $exitCode);

$this->assertContains('Executed: 12 test classes (15 retried), 22 tests', $output);
$this->assertContains('Executed: 13 test classes (18 retried), 23 tests', $output);
}

public function testExecutionWithLogo()
Expand Down Expand Up @@ -125,11 +125,11 @@ public function testExecutionWithDebugEnabled()
$output = $commandTester->getDisplay();
$this->assertNotEquals(0, $exitCode);

$classExecuted = 12;
$processRetried = 15;
$classExecuted = 13;
$processRetried = 18;
$processesCount = $classExecuted + $processRetried;
$this->assertContains(
sprintf('Executed: %d test classes (%d retried), 22 tests', $classExecuted, $processRetried),
sprintf('Executed: %d test classes (%d retried), 23 tests', $classExecuted, $processRetried),
$output,
'Precondition failed'
);
Expand Down
22 changes: 22 additions & 0 deletions tests/Stub/MySQLSavePointMissingTestStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Tests\Stub;

/**
* Class MySQLSavePointMissingTestStub
* @package Tests\Stub
*/
class MySQLSavePointMissingTestStub extends BrokenTestBase implements BrokenTestInterface
{
const OUTPUT = 'SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist';

/**
* @throws \Exception
*/
public function testBrokenTest()
{
throw new \Exception(self::OUTPUT);
}
}
2 changes: 2 additions & 0 deletions tests/Unit/Parser/JSON/RetryParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Tests\Stub\EntityManagerClosedTestStub;
use Tests\Stub\MySQLDeadLockTestStub;
use Tests\Stub\MySQLLockTimeoutTestStub;
use Tests\Stub\MySQLSavePointMissingTestStub;
use Tests\Stub\PHPUnitJSONLogOutput\JSONLogStub;
use Tests\Stub\SQLiteDeadLockTestStub;
use Tests\Stub\StubbedParaunitProcess;
Expand Down Expand Up @@ -70,6 +71,7 @@ public function toBeRetriedTestsProvider(): array
[EntityManagerClosedTestStub::OUTPUT],
[MySQLDeadLockTestStub::OUTPUT],
[MySQLLockTimeoutTestStub::OUTPUT],
[MySQLSavePointMissingTestStub::OUTPUT],
[SQLiteDeadLockTestStub::OUTPUT],
];
}
Expand Down