summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch70
-rw-r--r--php-pecl-redis4.spec11
2 files changed, 79 insertions, 2 deletions
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 <michael.grunder@gmail.com>
+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 */
diff --git a/php-pecl-redis4.spec b/php-pecl-redis4.spec
index 33fbbcc..0d433bc 100644
--- a/php-pecl-redis4.spec
+++ b/php-pecl-redis4.spec
@@ -34,11 +34,13 @@
Summary: Extension for communicating with the Redis key-value store
Name: %{?sub_prefix}php-pecl-redis4
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
License: PHP
URL: http://pecl.php.net/package/redis
+Patch0: https://github.com/phpredis/phpredis/commit/7b8b7b01a2b2af2e646ca89802910ac216c476dc.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
@@ -127,6 +129,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1
+
# Use system library
rm -r liblzf
@@ -272,7 +276,7 @@ port=$(%{__php} -r 'echo 9000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + P
# https://github.com/phpredis/phpredis/issues/1472
-sed -e 's/testXClaim/skipXClaim/;s/testXAck/skipXAck/;s/testXReadGroup/skipXReadGroup/' -i RedisTest.php
+#sed -e 's/testXClaim/skipXClaim/;s/testXAck/skipXAck/;s/testXReadGroup/skipXReadGroup/' -i RedisTest.php
: Run the test Suite
sed -e "s/6379/$port/" -i *.php
@@ -333,6 +337,9 @@ fi
%changelog
+* Tue Dec 11 2018 Remi Collet <remi@remirepo.net> - 4.2.0-3
+- test build for upstream patch
+
* Tue Dec 4 2018 Remi Collet <remi@remirepo.net> - 4.2.0-2
- open https://github.com/phpredis/phpredis/issues/1472
tests failing with redis 5.0.2