diff options
author | michael-grunder <michael.grunder@gmail.com> | 2019-06-16 21:37:05 +0300 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2019-06-16 21:38:45 +0300 |
commit | 9a699e53087dc730212c86cfc7b44e8357f4fae3 (patch) | |
tree | 8bf463f8ab9bca1b453d2b8c006d9a655158dd5b /tests | |
parent | 17600dd131a1ad11af081d0345a4627613f83b9d (diff) |
Try to give the EXPIREAT test a bit more leeway to succeed.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/RedisTest.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php index d5aa89b6..8ec32467 100644 --- a/tests/RedisTest.php +++ b/tests/RedisTest.php @@ -466,14 +466,20 @@ class Redis_Test extends TestSuite $this->assertEquals(False, $this->redis->get('key')); } + /* This test is prone to failure in the Travis container, so attempt to mitigate this by running more than once */ public function testExpireAt() { - $this->redis->del('key'); - $this->redis->set('key', 'value'); - $now = time(); - $this->redis->expireAt('key', $now + 1); - $this->assertEquals('value', $this->redis->get('key')); - sleep(2); - $this->assertEquals(FALSE, $this->redis->get('key')); + $success = false; + + for ($i = 0; !$success && $i < 3; $i++) { + $this->redis->del('key'); + $time = $this->redis->time(); + $this->redis->set('key', 'value'); + $this->redis->expireAt('key', $time[0] + 1); + usleep(1500000); + $success = FALSE === $this->redis->get('key'); + } + + $this->assertTrue($success); } public function testSetEx() { |