diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-22 21:11:13 +0100 |
---|---|---|
committer | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-22 21:11:13 +0100 |
commit | f0b227bc633e3c382069982c940cd433d5dda247 (patch) | |
tree | 2c8d6db0b166a33dc56c4d20016462692350626f | |
parent | 31d934d19bf82efdfc320fa7008008242a65332a (diff) |
tests: update names
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
-rw-r--r-- | Makefile | 10 | ||||
-rwxr-xr-x | test.sh | 65 |
2 files changed, 34 insertions, 41 deletions
@@ -30,16 +30,16 @@ INSTALL_LIBRARY_PATH= $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH) INSTALL_PKGCONF_PATH= $(INSTALL_LIBRARY_PATH)/$(PKGCONF_PATH) # redict-server configuration used for testing -REDIS_PORT=56379 -REDIS_SERVER=redict-server -define REDIS_TEST_CONFIG +REDICT_PORT=56379 +REDICT_SERVER=redict-server +define REDICT_TEST_CONFIG daemonize yes pidfile /tmp/hiredict-test-redict.pid - port $(REDIS_PORT) + port $(REDICT_PORT) bind 127.0.0.1 unixsocket /tmp/hiredict-test-redict.sock endef -export REDIS_TEST_CONFIG +export REDICT_TEST_CONFIG # Fallback to gcc when $CC is not in $PATH. CC:=$(shell sh -c 'type $${CC%% *} >/dev/null 2>/dev/null && echo $(CC) || echo gcc') @@ -6,44 +6,37 @@ # SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: LGPL-3.0-or-later -REDIS_SERVER=${REDIS_SERVER:-redis-server} -REDIS_PORT=${REDIS_PORT:-56379} -REDIS_SSL_PORT=${REDIS_SSL_PORT:-56443} +REDICT_SERVER=${REDICT_SERVER:-redict-server} +REDICT_PORT=${REDICT_PORT:-56379} +REDICT_SSL_PORT=${REDICT_SSL_PORT:-56443} TEST_SSL=${TEST_SSL:-0} SKIPS_AS_FAILS=${SKIPS_AS_FAILS:-0} -ENABLE_DEBUG_CMD= SSL_TEST_ARGS= SKIPS_ARG=${SKIPS_ARG:-} -REDIS_DOCKER=${REDIS_DOCKER:-} - -# 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 +REDICT_DOCKER=${REDICT_DOCKER:-} tmpdir=$(mktemp -d) -PID_FILE=${tmpdir}/hiredis-test-redis.pid -SOCK_FILE=${tmpdir}/hiredis-test-redis.sock +PID_FILE=${tmpdir}/hiredict-test-redict.pid +SOCK_FILE=${tmpdir}/hiredict-test-redict.sock if [ "$TEST_SSL" = "1" ]; then SSL_CA_CERT=${tmpdir}/ca.crt SSL_CA_KEY=${tmpdir}/ca.key - SSL_CERT=${tmpdir}/redis.crt - SSL_KEY=${tmpdir}/redis.key + SSL_CERT=${tmpdir}/redict.crt + SSL_KEY=${tmpdir}/redict.key openssl genrsa -out ${tmpdir}/ca.key 4096 openssl req \ -x509 -new -nodes -sha256 \ -key ${SSL_CA_KEY} \ -days 3650 \ - -subj '/CN=Hiredis Test CA' \ + -subj '/CN=Hiredict Test CA' \ -out ${SSL_CA_CERT} openssl genrsa -out ${SSL_KEY} 2048 openssl req \ -new -sha256 \ -key ${SSL_KEY} \ - -subj '/CN=Hiredis Test Cert' | \ + -subj '/CN=Hiredict Test Cert' | \ openssl x509 \ -req -sha256 \ -CA ${SSL_CA_CERT} \ @@ -53,12 +46,12 @@ if [ "$TEST_SSL" = "1" ]; then -days 365 \ -out ${SSL_CERT} - SSL_TEST_ARGS="--ssl-host 127.0.0.1 --ssl-port ${REDIS_SSL_PORT} --ssl-ca-cert ${SSL_CA_CERT} --ssl-cert ${SSL_CERT} --ssl-key ${SSL_KEY}" + SSL_TEST_ARGS="--ssl-host 127.0.0.1 --ssl-port ${REDICT_SSL_PORT} --ssl-ca-cert ${SSL_CA_CERT} --ssl-cert ${SSL_CERT} --ssl-key ${SSL_KEY}" fi cleanup() { - if [ -n "${REDIS_DOCKER}" ] ; then - docker kill redis-test-server + if [ -n "${REDICT_DOCKER}" ] ; then + docker kill redict-test-server else set +e kill $(cat ${PID_FILE}) @@ -68,26 +61,26 @@ cleanup() { trap cleanup INT TERM EXIT # base config -cat > ${tmpdir}/redis.conf <<EOF +cat > ${tmpdir}/redict.conf <<EOF pidfile ${PID_FILE} -port ${REDIS_PORT} +port ${REDICT_PORT} unixsocket ${SOCK_FILE} unixsocketperm 777 EOF # if not running in docker add these: -if [ ! -n "${REDIS_DOCKER}" ]; then -cat >> ${tmpdir}/redis.conf <<EOF +if [ ! -n "${REDICT_DOCKER}" ]; then +cat >> ${tmpdir}/redict.conf <<EOF daemonize yes -${ENABLE_DEBUG_CMD} +enable-debug-command local bind 127.0.0.1 EOF fi # if doing ssl, add these if [ "$TEST_SSL" = "1" ]; then - cat >> ${tmpdir}/redis.conf <<EOF -tls-port ${REDIS_SSL_PORT} + cat >> ${tmpdir}/redict.conf <<EOF +tls-port ${REDICT_SSL_PORT} tls-ca-cert-file ${SSL_CA_CERT} tls-cert-file ${SSL_CERT} tls-key-file ${SSL_KEY} @@ -95,18 +88,18 @@ EOF fi echo ${tmpdir} -cat ${tmpdir}/redis.conf -if [ -n "${REDIS_DOCKER}" ] ; then +cat ${tmpdir}/redict.conf +if [ -n "${REDICT_DOCKER}" ] ; then chmod a+wx ${tmpdir} chmod a+r ${tmpdir}/* - docker run -d --rm --name redis-test-server \ - -p ${REDIS_PORT}:${REDIS_PORT} \ - -p ${REDIS_SSL_PORT}:${REDIS_SSL_PORT} \ + docker run -d --rm --name redict-test-server \ + -p ${REDICT_PORT}:${REDICT_PORT} \ + -p ${REDICT_SSL_PORT}:${REDICT_SSL_PORT} \ -v ${tmpdir}:${tmpdir} \ - ${REDIS_DOCKER} \ - redis-server ${tmpdir}/redis.conf + ${REDICT_DOCKER} \ + redict-server ${tmpdir}/redict.conf else - ${REDIS_SERVER} ${tmpdir}/redis.conf + ${REDICT_SERVER} ${tmpdir}/redict.conf fi # Wait until we detect the unix socket echo waiting for server @@ -115,4 +108,4 @@ while [ ! -S "${SOCK_FILE}" ]; do sleep 1; done # Treat skips as failures if directed [ "$SKIPS_AS_FAILS" = 1 ] && SKIPS_ARG="${SKIPS_ARG} --skips-as-fails" -${TEST_PREFIX:-} ./hiredis-test -h 127.0.0.1 -p ${REDIS_PORT} -s ${SOCK_FILE} ${SSL_TEST_ARGS} ${SKIPS_ARG} +${TEST_PREFIX:-} ./hiredict-test -h 127.0.0.1 -p ${REDICT_PORT} -s ${SOCK_FILE} ${SSL_TEST_ARGS} ${SKIPS_ARG} |