Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b59660c

Browse filesBrowse files
committed
minor #22119 [Lock] Adjust lock delay to avoid false error tests (jderusse)
This PR was merged into the 3.3-dev branch. Discussion ---------- [Lock] Adjust lock delay to avoid false error tests | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Adjust the clockDelay to fix tests This test is here to: T0. * Fork A, B, C T1. * A acquire Lock then start sleeping for 3*clockDelay * B start sleeping for 1*clockDelay * C start sleeping for 1*clockDelay T2 * B wakeup AND try to acquire lock in wait mode * C wakeup AND try to acquire lock in non wait mode (lock should be till acquired by A) T4 * A release Lock * B acquire lock and release it At the end, this tests assert than: * A acquire and delete the lock * B acquire and delete the lock * C failed to acquire the lock The point is, this test is time sensitive, and if the fork is too slow, A, B and C are not synchronized and C is able to acquire Lock. This PR adjuste clock delay to reduce false failures Commits ------- 33f2a9a Adjust lock delay to avoid false error tests
2 parents ba4d6bc + 33f2a9a commit b59660c
Copy full SHA for b59660c

File tree

2 files changed

+4
-4
lines changed
Filter options

2 files changed

+4
-4
lines changed

‎src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract protected function getStore();
3434
public function testBlockingLocks()
3535
{
3636
// Amount a microsecond used to order async actions
37-
$clockDelay = 30000;
37+
$clockDelay = 50000;
3838

3939
if (PHP_VERSION_ID < 50600 || defined('HHVM_VERSION_ID')) {
4040
$this->markTestSkipped('The PHP engine does not keep resource in child forks');
@@ -57,7 +57,7 @@ public function testBlockingLocks()
5757
$this->assertSame(0, pcntl_wexitstatus($status2));
5858
$this->assertSame(3, pcntl_wexitstatus($status3));
5959
} else {
60-
usleep(2 * $clockDelay);
60+
usleep(1 * $clockDelay);
6161

6262
try {
6363
// This call should failed given the lock should already by acquired by the child #1

‎src/Symfony/Component/Lock/phpunit.xml.dist

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/phpunit.xml.dist
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
>
99
<php>
1010
<ini name="error_reporting" value="-1" />
11-
<env name="REDIS_HOST" value="redis.docker" />
12-
<env name="MEMCACHED_HOST" value="memcached.docker" />
11+
<env name="REDIS_HOST" value="localhost" />
12+
<env name="MEMCACHED_HOST" value="localhost" />
1313
</php>
1414

1515
<testsuites>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.