8000 Fix bug in random key cluster test · jrtkcoder/phpredis@4336df3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4336df3

Browse files
Fix bug in random key cluster test
1 parent 3b021ea commit 4336df3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/RedisClusterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ public function testPing() {
7373
}
7474

7575
public function testRandomKey() {
76+
/* Ensure some keys are present to test */
77+
for ($i = 0; $i < 1000; $i++) {
78+
if (rand(1, 2) == 1) {
79+
$this->redis->set("key:$i", "val:$i");
80+
}
81+
}
82+
7683
for ($i = 0; $i < 1000; $i++) {
7784
$k = $this->redis->randomKey("key:$i");
7885
$this->assertTrue($this->redis->exists($k));

0 commit comments

Comments
 (0)
0