redisTestHook: enable debug and module commands
and migrate to config file for more extensive configuration options.
This commit is contained in:
committed by
Robert Schütz
parent
1160e07739
commit
52ccfdfbcc
@@ -3,6 +3,7 @@
|
||||
callPackage,
|
||||
makeSetupHook,
|
||||
valkey,
|
||||
python3Packages,
|
||||
}:
|
||||
|
||||
makeSetupHook {
|
||||
@@ -13,5 +14,6 @@ makeSetupHook {
|
||||
};
|
||||
passthru.tests = {
|
||||
simple = callPackage ./test.nix { };
|
||||
python3-valkey = python3Packages.valkey;
|
||||
};
|
||||
} ./redis-test-hook.sh
|
||||
|
||||
@@ -7,18 +7,30 @@ redisStart() {
|
||||
redisTestPort=6379
|
||||
fi
|
||||
|
||||
mkdir "$NIX_BUILD_TOP/run"
|
||||
|
||||
if [[ "${REDIS_SOCKET:-}" == "" ]]; then
|
||||
mkdir -p "$NIX_BUILD_TOP/run/"
|
||||
REDIS_SOCKET="$NIX_BUILD_TOP/run/redis.sock"
|
||||
fi
|
||||
export REDIS_SOCKET
|
||||
|
||||
REDIS_CONF="$NIX_BUILD_TOP/run/redis.conf"
|
||||
export REDIS_CONF
|
||||
|
||||
cat <<EOF > "$REDIS_CONF"
|
||||
unixsocket ${REDIS_SOCKET}
|
||||
port ${redisTestPort}
|
||||
protected-mode no
|
||||
enable-debug-command yes
|
||||
enable-module-command yes
|
||||
EOF
|
||||
|
||||
echo 'starting redis'
|
||||
|
||||
# Note about Darwin: unless the output is redirected, the parent process becomes launchd instead of bash.
|
||||
# This would leave the Redis process running in case of a test failure (the postCheckHook would not be executed),
|
||||
# hanging the Nix build forever.
|
||||
@server@ --unixsocket "$REDIS_SOCKET" --port "$redisTestPort" > /dev/null 2>&1 &
|
||||
@server@ "$REDIS_CONF" > /dev/null 2>&1 &
|
||||
REDIS_PID=$!
|
||||
|
||||
echo 'waiting for redis to be ready'
|
||||
|
||||
Reference in New Issue
Block a user