improve manifest chaqna test (#565)
Signed-off-by: Yingchun Guo <yingchun.guo@intel.com>
This commit is contained in:
@@ -27,6 +27,13 @@ function install_chatqna {
|
||||
sleep 60
|
||||
}
|
||||
|
||||
function get_end_point() {
|
||||
# $1 is service name, $2 is namespace
|
||||
ip_address=$(kubectl get svc $1 -n $2 -o jsonpath='{.spec.clusterIP}')
|
||||
port=$(kubectl get svc $1 -n $2 -o jsonpath='{.spec.ports[0].port}')
|
||||
echo "$ip_address:$port"
|
||||
}
|
||||
|
||||
function validate_chatqna() {
|
||||
max_retry=20
|
||||
# make sure microservice retriever-usvc is ready
|
||||
@@ -34,7 +41,8 @@ function validate_chatqna() {
|
||||
test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)")
|
||||
for ((i=1; i<=max_retry; i++))
|
||||
do
|
||||
curl http://chatqna-retriever-usvc.$NAMESPACE:7000/v1/retrieval -X POST \
|
||||
endpoint_url=$(get_end_point "chatqna-retriever-usvc" $NAMESPACE)
|
||||
curl http://$endpoint_url/v1/retrieval -X POST \
|
||||
-d "{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${test_embedding}}" \
|
||||
-H 'Content-Type: application/json' && break
|
||||
sleep 30
|
||||
@@ -47,7 +55,8 @@ function validate_chatqna() {
|
||||
# make sure microservice tgi-svc is ready
|
||||
for ((i=1; i<=max_retry; i++))
|
||||
do
|
||||
curl http://chatqna-tgi.$NAMESPACE:80/generate -X POST \
|
||||
endpoint_url=$(get_end_point "chatqna-tgi" $NAMESPACE)
|
||||
curl http://$endpoint_url/generate -X POST \
|
||||
-d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \
|
||||
-H 'Content-Type: application/json' && break
|
||||
sleep 10
|
||||
@@ -61,7 +70,8 @@ function validate_chatqna() {
|
||||
# check megaservice works
|
||||
# generate a random logfile name to avoid conflict among multiple runners
|
||||
LOGFILE=$LOG_PATH/curlmega_$NAMESPACE.log
|
||||
curl http://chatqna.$NAMESPACE:8888/v1/chatqna -H "Content-Type: application/json" -d '{"messages": "What is the revenue of Nike in 2023?"}' > $LOGFILE
|
||||
endpoint_url=$(get_end_point "chatqna" $NAMESPACE)
|
||||
curl http://$endpoint_url/v1/chatqna -H "Content-Type: application/json" -d '{"messages": "What is the revenue of Nike in 2023?"}' > $LOGFILE
|
||||
exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
echo "Megaservice failed, please check the logs in $LOGFILE!"
|
||||
|
||||
Reference in New Issue
Block a user