8000 minor #29726 [Lock] Fix lock test random failure (jderusse) · Firehed/symfony@1fafdaf · GitHub
[go: up one dir, main page]

Skip to content

Commit 1fafdaf

Browse files
committed
minor symfony#29726 [Lock] Fix lock test random failure (jderusse)
This PR was merged into the 3.4 branch. Discussion ---------- [Lock] Fix lock test random failure | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | NA The expiration of some store (PDO and Memcached) have a precision of 1 second. The current test suite of the component tries to putof the expiration to time + 1 second then tries to check the value of the lock. This could generate test failure (see https://travis-ci.org/symfony/symfony/jobs/473530213#L3389) Commits ------- 8cff565 Fix random test failure on lock
2 parents 63ef2f5 + 8cff565 commit 1fafdaf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ public function testExpiration()
4747
$store = $this->getStore();
4848

4949
$store->save($key);
50-
$store->putOffExpiration($key, $clockDelay / 1000000);
50+
$store->putOffExpiration($key, 2 * $clockDelay / 1000000);
5151
$this->assertTrue($store->exists($key));
5252

53-
usleep(2 * $clockDelay);
53+
usleep(3 * $clockDelay);
5454
$this->assertFalse($store->exists($key));
5555
}
5656

@@ -86,10 +86,10 @@ public function testRefreshLock()
8686
$store = $this->getStore();
8787

8888
$store->save($key);
89-
$store->putOffExpiration($key, $clockDelay / 1000000);
89+
$store->putOffExpiration($key, 2 * $clockDelay / 1000000);
9090
$this->assertTrue($store->exists($key));
9191

92-
usleep(2 * $clockDelay);
92+
usleep(3 * $clockDelay);
9393
$this->assertFalse($store->exists($key));
9494
}
9595

0 commit comments

Comments
 (0)
0