diff --git a/tests/mutex/MutexConcurrencyTest.php b/tests/mutex/MutexConcurrencyTest.php index ad5c6f05..381e2d86 100644 --- a/tests/mutex/MutexConcurrencyTest.php +++ b/tests/mutex/MutexConcurrencyTest.php @@ -89,7 +89,7 @@ private function fork(int $concurrency, \Closure $code): void public function testHighContention(\Closure $code, \Closure $mutexFactory): void { $concurrency = 10; - $iterations = 1000 / $concurrency; + $iterations = 30 / $concurrency; $timeout = $concurrency * 20; $this->fork($concurrency, static function () use ($mutexFactory, $timeout, $iterations, $code): void { @@ -110,6 +110,8 @@ public function testHighContention(\Closure $code, \Closure $mutexFactory): void */ public static function provideHighContentionCases(): iterable { + $uris = explode(',', getenv('REDIS_URIS')); + $cases = array_map(static function (array $mutexFactory): array { $filename = tempnam(sys_get_temp_dir(), 'php-lock-high-contention'); @@ -128,9 +130,18 @@ static function (int $increment) use ($filename): int { }, $mutexFactory[0], ]; - }, static::provideExecutionIsSerializedWhenLockedCases()); + }, [ + 'PredisMutex' => [static function ($timeout) use ($uris): Mutex { + $clients = array_map( + static fn ($uri) => new Client($uri), + $uris + ); - $addPDO = static function (string $dsn, string $user, string $password, string $vendor) use (&$cases) { + return new PredisMutex($clients, 'test', $timeout); + }], + ]); + + /* $addPDO = static function (string $dsn, string $user, string $password, string $vendor) use (&$cases) { $pdo = self::getPDO($dsn, $user, $password); $options = ['mysql' => 'engine=InnoDB']; @@ -184,7 +195,7 @@ static function ($timeout) use ($dsn, $user, $password) { $user = getenv('PGSQL_USER'); $password = getenv('PGSQL_PASSWORD'); $addPDO($dsn, $user, $password, 'postgres'); - } + } */ return $cases; }