From e4acfd1f8f971ec0734a310245c4fe402ff97400 Mon Sep 17 00:00:00 2001 From: Ryan McCormick Date: Tue, 20 Jun 2023 15:00:58 -0700 Subject: [PATCH 1/3] Add test for auth credentials via env vars --- qa/L0_response_cache/test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qa/L0_response_cache/test.sh b/qa/L0_response_cache/test.sh index 994dff13de..dad30b7bd3 100755 --- a/qa/L0_response_cache/test.sh +++ b/qa/L0_response_cache/test.sh @@ -241,12 +241,18 @@ SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${REDIS_CACHE_AUT run_server check_server_expected_failure "WRONGPASS" - # Test simple redis authentication fails with no credentials SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}" run_server check_server_expected_failure "NOAUTH Authentication required" +# Test simple redis authentication succeeds with correct credentials via env vars +TRITONCACHE_REDIS_USERNAME="" +TRITONCACHE_REDIS_PASSWORD="${REDIS_PW}" +SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}" +run_server +check_server_success_and_kill + # Clean up redis server before exiting test unset_redis_auth stop_redis From 617d08c0e01baaacbe480e75d433e02123cff086 Mon Sep 17 00:00:00 2001 From: Ryan McCormick Date: Tue, 20 Jun 2023 17:43:21 -0700 Subject: [PATCH 2/3] Make env vars visible to process, break into sections --- qa/L0_response_cache/test.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qa/L0_response_cache/test.sh b/qa/L0_response_cache/test.sh index dad30b7bd3..cd14af04f0 100755 --- a/qa/L0_response_cache/test.sh +++ b/qa/L0_response_cache/test.sh @@ -229,6 +229,8 @@ check_server_expected_failure "Must at a minimum specify" REDIS_PW="redis123!" set_redis_auth +### Credentials via command-line + # Test simple redis authentication succeeds with correct credentials REDIS_CACHE_AUTH="--cache-config redis,password=${REDIS_PW}" SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${REDIS_CACHE_AUTH} ${EXTRA_ARGS}" @@ -246,13 +248,23 @@ SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}" run_server check_server_expected_failure "NOAUTH Authentication required" +### Credentials via environment variables + # Test simple redis authentication succeeds with correct credentials via env vars -TRITONCACHE_REDIS_USERNAME="" -TRITONCACHE_REDIS_PASSWORD="${REDIS_PW}" +export TRITONCACHE_REDIS_USERNAME="default" +export TRITONCACHE_REDIS_PASSWORD="${REDIS_PW}" SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}" run_server check_server_success_and_kill +# Test simple redis authentication fails with wrong credentials via env vars +export TRITONCACHE_REDIS_PASSWORD="wrong" +SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}" +run_server +check_server_expected_failure "WRONGPASS" +unset TRITONCACHE_REDIS_USERNAME +unset TRITONCACHE_REDIS_PASSWORD + # Clean up redis server before exiting test unset_redis_auth stop_redis From 75dd79dc7113391f59757950de09f6d92c4af35f Mon Sep 17 00:00:00 2001 From: Ryan McCormick Date: Tue, 20 Jun 2023 17:49:32 -0700 Subject: [PATCH 3/3] Add env var test with only password set, no username --- qa/L0_response_cache/test.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qa/L0_response_cache/test.sh b/qa/L0_response_cache/test.sh index cd14af04f0..8ec610b065 100755 --- a/qa/L0_response_cache/test.sh +++ b/qa/L0_response_cache/test.sh @@ -250,7 +250,15 @@ check_server_expected_failure "NOAUTH Authentication required" ### Credentials via environment variables -# Test simple redis authentication succeeds with correct credentials via env vars +# Test simple redis authentication succeeds with password-only via env vars +# No username means use "default" as the username +unset TRITONCACHE_REDIS_USERNAME +export TRITONCACHE_REDIS_PASSWORD="${REDIS_PW}" +SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}" +run_server +check_server_success_and_kill + +# Test simple redis authentication succeeds with correct user and password via env vars export TRITONCACHE_REDIS_USERNAME="default" export TRITONCACHE_REDIS_PASSWORD="${REDIS_PW}" SERVER_ARGS="--model-repository=${MODEL_DIR} ${REDIS_ENDPOINT} ${EXTRA_ARGS}"