summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2022-06-26 12:18:54 -0700
committerGitHub <noreply@github.com>2022-06-26 12:18:54 -0700
commit5d68ad2f48e908ff7fe2debe22f71182c2150547 (patch)
tree72ed376154e65ec4e8adec42ca18be52448acc13
parent95a0c1283a7277f684388edcbdf5b73d0d76104f (diff)
parentf4b6ed28989ba0f6c59c64d015a8b0c830b3f1ca (diff)
Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
Fix tests so they work for Redis 7.0
-rw-r--r--.github/workflows/build.yml3
-rwxr-xr-xtest.sh9
2 files changed, 11 insertions, 1 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a071628..7859ff4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -152,7 +152,8 @@ jobs:
- name: Install dependencies
run: |
- brew install openssl redis
+ brew install openssl redis@6.2
+ brew link redis@6.2 --force
- name: Build hiredis
run: USE_SSL=1 make
diff --git a/test.sh b/test.sh
index c72bcb0..a518db7 100755
--- a/test.sh
+++ b/test.sh
@@ -5,9 +5,16 @@ REDIS_PORT=${REDIS_PORT:-56379}
REDIS_SSL_PORT=${REDIS_SSL_PORT:-56443}
TEST_SSL=${TEST_SSL:-0}
SKIPS_AS_FAILS=${SKIPS_AS_FAILS-:0}
+ENABLE_DEBUG_CMD=
SSL_TEST_ARGS=
SKIPS_ARG=
+# We need to enable the DEBUG command for redis-server >= 7.0.0
+REDIS_MAJOR_VERSION="$(redis-server --version|awk -F'[^0-9]+' '{ print $2 }')"
+if [ "$REDIS_MAJOR_VERSION" -gt "6" ]; then
+ ENABLE_DEBUG_CMD="enable-debug-command local"
+fi
+
tmpdir=$(mktemp -d)
PID_FILE=${tmpdir}/hiredis-test-redis.pid
SOCK_FILE=${tmpdir}/hiredis-test-redis.sock
@@ -49,8 +56,10 @@ cleanup() {
}
trap cleanup INT TERM EXIT
+
cat > ${tmpdir}/redis.conf <<EOF
daemonize yes
+${ENABLE_DEBUG_CMD}
pidfile ${PID_FILE}
port ${REDIS_PORT}
bind 127.0.0.1