From 9d6ea69cd247783acf249ac1f0c212b1a39ead20 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 11 Dec 2018 17:06:42 +0100 Subject: test build for upstream patch --- 7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch (limited to '7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch') diff --git a/7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch b/7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch new file mode 100644 index 0000000..995b579 --- /dev/null +++ b/7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch @@ -0,0 +1,70 @@ +From 7b8b7b01a2b2af2e646ca89802910ac216c476dc Mon Sep 17 00:00:00 2001 +From: michael-grunder +Date: Sat, 8 Dec 2018 15:10:34 -0800 +Subject: [PATCH] Fix unit tests for Redis 5.0.2 + +Addresses issue #1472 +--- + tests/RedisTest.php | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/tests/RedisTest.php b/tests/RedisTest.php +index 5f23a76a..8c358b6e 100644 +--- a/tests/RedisTest.php ++++ b/tests/RedisTest.php +@@ -5392,7 +5392,7 @@ public function testXAck() { + + for ($n = 1; $n <= 3; $n++) { + $this->addStreamsAndGroups(Array('{s}'), 3, Array('g1' => 0)); +- $msg = $this->redis->xReadGroup('g1', 'c1', Array('{s}' => 0)); ++ $msg = $this->redis->xReadGroup('g1', 'c1', Array('{s}' => '>')); + + /* Extract IDs */ + $smsg = array_shift($msg); +@@ -5494,17 +5494,25 @@ public function testXReadGroup() { + + /* Create some streams and groups */ + $streams = Array('{s}-1', '{s}-2'); +- $qstreams = Array('{s}-1' => 0, '{s}-2' => 0); + $groups = Array('g1' => 0, 'g2' => 0); + +- $ids = $this->addStreamsAndGroups($streams, 3, $groups); ++ /* I'm not totally sure why Redis behaves this way, but we have to ++ * send '>' first and then send ID '0' for subsequent xReadGroup calls ++ * or Redis will not return any messages. This behavior changed from ++ * redis 5.0.1 and 5.0.2 but doing it this way works for both versions. */ ++ $qcount = 0; ++ $query1 = Array('{s}-1' => '>', '{s}-2' => '>'); ++ $query2 = Array('{s}-1' => '0', '{s}-2' => '0'); ++ ++ $ids = $this->addStreamsAndGroups($streams, 1, $groups); + + /* Test that we get get the IDs we should */ + foreach (Array('g1', 'g2') as $group) { + foreach ($ids as $stream => $messages) { + while ($ids[$stream]) { + /* Read more messages */ +- $resp = $this->redis->xReadGroup($group, 'consumer', $qstreams); ++ $query = !$qcount++ ? $query1 : $query2; ++ $resp = $this->redis->xReadGroup($group, 'consumer', $query); + + /* They should match with our local control array */ + $this->compareStreamIds($resp, $ids); +@@ -5519,7 +5527,7 @@ public function testXReadGroup() { + /* Test COUNT option */ + for ($c = 1; $c <= 3; $c++) { + $this->addStreamsAndGroups($streams, 3, $groups); +- $resp = $this->redis->xReadGroup('g1', 'consumer', $qstreams, $c); ++ $resp = $this->redis->xReadGroup('g1', 'consumer', $query1, $c); + + foreach ($resp as $stream => $smsg) { + $this->assertEquals(count($smsg), $c); +@@ -5624,7 +5632,7 @@ public function testXClaim() { + $fids = $fids['f']; + + /* Have consumer 'Mike' read the messages */ +- $oids = $this->redis->xReadGroup('group1', 'Mike', Array('s' => 0)); ++ $oids = $this->redis->xReadGroup('group1', 'Mike', Array('s' => '>')); + $oids = array_keys($oids['s']); /* We're only dealing with stream 's' */ + + /* Construct our options array */ -- cgit