Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2022-10-03 22:10:43 +0300
committerMichael Grunder <michael.grunder@gmail.com>2022-10-03 22:29:52 +0300
commitd35e2664bb65525b2ae347471094eb4fb1de18d8 (patch)
treead141df55114e442972af131217cd52bf98c41a7
parentf5b2a09b3402dda28dc5b23bd9fdce32284ab550 (diff)
Relax OBJECT idletime tests to avoid false failures.
Instead of testing that `OBJECT IDLETIME` returns exactly zero after updating a key in our tests, just make sure PhpRedis returns us some numeric value. We can't really test for a specific number of elapsed seconds in CI as the VMs may be randomly preempted at times beyond our control, causing the tests to "fail" even though there was no actual failure.
-rw-r--r--tests/RedisTest.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php
index 4d022a6e..f61e263a 100644
--- a/tests/RedisTest.php
+++ b/tests/RedisTest.php
@@ -3060,7 +3060,7 @@ class Redis_Test extends TestSuite
$this->redis->set('key', 'value');
$this->assertTrue($this->redis->object('encoding', 'key') === $str_small_encoding);
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
- $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+ $this->assertTrue(is_numeric($this->redis->object('idletime', 'key')));
$this->redis->del('key');
$this->redis->lpush('key', 'value');
@@ -3071,20 +3071,20 @@ class Redis_Test extends TestSuite
$this->assertTrue($str_encoding === "ziplist" || $str_encoding === 'quicklist');
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
- $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+ $this->assertTrue(is_numeric($this->redis->object('idletime', 'key')));
$this->redis->del('key');
$this->redis->sadd('key', 'value');
$this->assertTrue($this->redis->object('encoding', 'key') === "hashtable");
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
- $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+ $this->assertTrue(is_numeric($this->redis->object('idletime', 'key')));
$this->redis->del('key');
$this->redis->sadd('key', 42);
$this->redis->sadd('key', 1729);
$this->assertTrue($this->redis->object('encoding', 'key') === "intset");
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
- $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+ $this->assertTrue(is_numeric($this->redis->object('idletime', 'key')));
$this->redis->del('key');
$this->redis->lpush('key', str_repeat('A', pow(10,6))); // 1M elements, too big for a ziplist.
@@ -3093,7 +3093,7 @@ class Redis_Test extends TestSuite
$this->assertTrue($str_encoding === "linkedlist" || $str_encoding == "quicklist");
$this->assertTrue($this->redis->object('refcount', 'key') === 1);
- $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+ $this->assertTrue(is_numeric($this->redis->object('idletime', 'key')));
}
public function testMultiExec() {