oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
+17
View File
@@ -9,6 +9,9 @@ use Laravel\Fortify\Features;
abstract class TestCase extends BaseTestCase
{
/** @var array<string, resource> Locks held until this test process exits. */
private static array $qaDatabaseLocks = [];
public function createApplication(): Application
{
$app = parent::createApplication();
@@ -28,6 +31,20 @@ abstract class TestCase extends BaseTestCase
|| ! in_array($url, [null, ''], true)) {
throw new \LogicException('PHPUnit PostgreSQL target rejected: configure an explicit loopback *_test database with no DB_URL.');
}
// Two test processes must not migrate/clean the same isolated database concurrently.
$lockKey = hash('sha256', $host.':'.($connection['port'] ?? '').':'.$database);
if (! isset(self::$qaDatabaseLocks[$lockKey])) {
$handle = fopen($app->storagePath('framework/qa-database-'.$lockKey.'.lock'), 'c');
if ($handle === false) {
throw new \LogicException('QA database execution lock unavailable.');
}
if (! flock($handle, LOCK_EX | LOCK_NB)) {
fclose($handle);
throw new \LogicException('Another test process owns this QA database; run suites sequentially or use separate *_test databases.');
}
self::$qaDatabaseLocks[$lockKey] = $handle;
}
}
// migrate:fresh only clears the connection's public search path. This module owns a separate schema.