Skip to content

Commit a072441

Browse files
authored
improve manifest chaqna test (#565)
Signed-off-by: Yingchun Guo <yingchun.guo@intel.com>
1 parent ed48371 commit a072441

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ChatQnA/tests/test_manifest_on_gaudi.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,22 @@ function install_chatqna {
2727
sleep 60
2828
}
2929

30+
function get_end_point() {
31+
# $1 is service name, $2 is namespace
32+
ip_address=$(kubectl get svc $1 -n $2 -o jsonpath='{.spec.clusterIP}')
33+
port=$(kubectl get svc $1 -n $2 -o jsonpath='{.spec.ports[0].port}')
34+
echo "$ip_address:$port"
35+
}
36+
3037
function validate_chatqna() {
3138
max_retry=20
3239
# make sure microservice retriever-usvc is ready
3340
# try to curl retriever-svc for max_retry times
3441
test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)")
3542
for ((i=1; i<=max_retry; i++))
3643
do
37-
curl http://chatqna-retriever-usvc.$NAMESPACE:7000/v1/retrieval -X POST \
44+
endpoint_url=$(get_end_point "chatqna-retriever-usvc" $NAMESPACE)
45+
curl http://$endpoint_url/v1/retrieval -X POST \
3846
-d "{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${test_embedding}}" \
3947
-H 'Content-Type: application/json' && break
4048
sleep 30
@@ -47,7 +55,8 @@ function validate_chatqna() {
4755
# make sure microservice tgi-svc is ready
4856
for ((i=1; i<=max_retry; i++))
4957
do
50-
curl http://chatqna-tgi.$NAMESPACE:80/generate -X POST \
58+
endpoint_url=$(get_end_point "chatqna-tgi" $NAMESPACE)
59+
curl http://$endpoint_url/generate -X POST \
5160
-d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \
5261
-H 'Content-Type: application/json' && break
5362
sleep 10
@@ -61,7 +70,8 @@ function validate_chatqna() {
6170
# check megaservice works
6271
# generate a random logfile name to avoid conflict among multiple runners
6372
LOGFILE=$LOG_PATH/curlmega_$NAMESPACE.log
64-
curl http://chatqna.$NAMESPACE:8888/v1/chatqna -H "Content-Type: application/json" -d '{"messages": "What is the revenue of Nike in 2023?"}' > $LOGFILE
73+
endpoint_url=$(get_end_point "chatqna" $NAMESPACE)
74+
curl http://$endpoint_url/v1/chatqna -H "Content-Type: application/json" -d '{"messages": "What is the revenue of Nike in 2023?"}' > $LOGFILE
6575
exit_code=$?
6676
if [ $exit_code -ne 0 ]; then
6777
echo "Megaservice failed, please check the logs in $LOGFILE!"

0 commit comments

Comments
 (0)