Oct 30, 2023
0
Level 6
DatabaseTransactions Test fails on CI many times. Using Paratest for the suite
class TestWorkingProperlyTest extends TestCase
{
use DatabaseTransactions, WithFaker;
public function test_step_1()
{
$user = (new UserFactory())->create();
$user->email = '[email protected]';
$user->save();
$this->assertModelExists($user);
}
public function test_step_2()
{
$user = User::query()
->whereEmail('[email protected]')
->first();
$this->assertNull($user);
}
}
Hello guys, give me your lights please.
I have this POC test on our tests that fails at random times on the CI (github actions & jenkins, has happened to both of them).
Since using DatabaseTransactions trait, this should never fail, but it looks like something goes wrong at random times.
We run the suite using Paratest & Laravel version is 10. (phpunit)
vendor/bin/paratest --coverage-clover coverage.xml --log-junit test-report.xml
Shouldn't Paratest handle these things creating individual database per process? Also we have some random deadlocks some times, I am pretty sure it's because of Paratest but don't know why.
Anyone has any idea on that?
Please or to participate in this conversation.