From 373a92e5d92eef764b65cf1ca5a8a0a5518fafee Mon Sep 17 00:00:00 2001 From: Joe Hu Date: Tue, 3 Dec 2024 12:11:55 -0500 Subject: [PATCH] Update integration test script (#13) Signed-off-by: Joe Hu Co-authored-by: Joe Hu --- README.md | 13 ++++++++++++- tst/integration/run.sh | 11 +++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d464963..25f7f98 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,16 @@ make -j unit make -j test ``` +#### To run one integration test: +```text +TEST_PATTERN= make -j test +``` +e.g., +```text +TEST_PATTERN=test_sanity make -j test +TEST_PATTERN=test_rdb.py make -j test +``` + ## Load the Module To test the module with a Valkey, you can load the module using any of the following ways: @@ -83,4 +93,5 @@ JSON.STRAPPEND JSON.STRLEN JSON.TOGGLE JSON.TYPE -``` \ No newline at end of file +``` + diff --git a/tst/integration/run.sh b/tst/integration/run.sh index 6d92e9b..358bdbd 100755 --- a/tst/integration/run.sh +++ b/tst/integration/run.sh @@ -8,12 +8,18 @@ pkill -9 -f "valkey-server.*:" || true pkill -9 -f Valgrind || true pkill -9 -f "valkey-benchmark" || true +# If environment variable SERVER_VERSION is not set, default to "unstable" +if [ -z "$SERVER_VERSION" ]; then + echo "WARNING: SERVER_VERSION environment variable is not set. Defaulting to \"unstable\"." + export SERVER_VERSION="unstable" +fi + # cd to the current directory of the script DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" cd "${DIR}" export MODULE_PATH=$2/build/src/libjson.so -echo "Running integration tests against Valkey version: $SERVER_VERSION" +echo "Running integration tests against Valkey version $SERVER_VERSION" if [[ ! -z "${TEST_PATTERN}" ]] ; then export TEST_PATTERN="-k ${TEST_PATTERN}" @@ -31,4 +37,5 @@ if [[ $1 == "test" ]] ; then else echo "Unknown target: $1" exit 1 -fi \ No newline at end of file +fi +