Skip to content

Commit

Permalink
Modify validate result check. (#503)
Browse files Browse the repository at this point in the history
Signed-off-by: zepan <ze.pan@intel.com>
  • Loading branch information
ZePan110 authored Aug 16, 2024
1 parent b16b14a commit 8a6079d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_llms_text-generation_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

set -xe
set -x

WORKPATH=$(dirname "$PWD")
LOG_PATH="$WORKPATH/tests"
Expand All @@ -14,6 +14,12 @@ function build_docker_images() {
--build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \
-t opea/llm-native:comps \
-f comps/llms/text-generation/native/docker/Dockerfile .
if $? ; then
echo "opea/llm-native built fail"
exit 1
else
echo "opea/llm-native built successful"
fi
}

function start_service() {
Expand Down Expand Up @@ -47,18 +53,18 @@ function validate_microservice() {
RESPONSE_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
SERVICE_NAME="llm-native"

docker logs test-comps-llm-native-server >> ${LOG_PATH}/${SERVICE_NAME}.log

# check response status
if [ "$HTTP_STATUS" -ne "200" ]; then
echo "[ $SERVICE_NAME ] HTTP status is not 200. Received status was $HTTP_STATUS"
docker logs test-comps-llm-native-server >> ${LOG_PATH}/${SERVICE_NAME}.log
exit 1
else
echo "[ $SERVICE_NAME ] HTTP status is 200. Checking content..."
fi
# check response body
if [[ "$RESPONSE_BODY" != *'"text":"What'* ]]; then
echo "[ $SERVICE_NAME ] Content does not match the expected result: $RESPONSE_BODY"
docker logs test-comps-llm-native-server >> ${LOG_PATH}/${SERVICE_NAME}.log
exit 1
else
echo "[ $SERVICE_NAME ] Content is as expected."
Expand Down

0 comments on commit 8a6079d

Please sign in to comment.