From 17caf02725d7b1134faf627406c591435aa378ce Mon Sep 17 00:00:00 2001 From: irisdingbj Date: Wed, 19 Jun 2024 04:14:25 +0800 Subject: [PATCH 1/4] add e2e for codegen Signed-off-by: irisdingbj --- .../config/samples/codegen.yaml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/microservices-connector/config/samples/codegen.yaml b/microservices-connector/config/samples/codegen.yaml index cc6432fa..ff750915 100644 --- a/microservices-connector/config/samples/codegen.yaml +++ b/microservices-connector/config/samples/codegen.yaml @@ -13,10 +13,6 @@ spec: routerConfig: name: router serviceName: router-service - config: - no_proxy: ".codegen.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" nodes: root: routerType: Sequence @@ -26,21 +22,11 @@ spec: internalService: serviceName: llm-service config: - no_proxy: ".codegen.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" - tgi_endpoint: http://tgi-service.codegen.svc.cluster.local:9009 - gmcTokenSecret: gmc-tokens endpoint: /v1/chat/completions - name: Tgi internalService: serviceName: tgi-service config: - no_proxy: ".codegen.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" - gmcTokenSecret: gmc-tokens - hostPath: /root/GMC/data/tgi - modelId: ise-uiuc/Magicoder-S-DS-6.7B + LLM_MODEL_ID: ise-uiuc/Magicoder-S-DS-6.7B endpoint: /generate isDownstreamService: true From 2e3f8b4be71e8b4e623b72629d6ea3c2f1aca72e Mon Sep 17 00:00:00 2001 From: irisdingbj Date: Wed, 19 Jun 2024 04:16:31 +0800 Subject: [PATCH 2/4] add gmc e2e for codegen Signed-off-by: irisdingbj --- .github/workflows/scripts/e2e/gmc_test.sh | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/scripts/e2e/gmc_test.sh b/.github/workflows/scripts/e2e/gmc_test.sh index 86a4aacb..db16704b 100755 --- a/.github/workflows/scripts/e2e/gmc_test.sh +++ b/.github/workflows/scripts/e2e/gmc_test.sh @@ -7,6 +7,7 @@ USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/charts-mnt IMAGE_REPO=${OPEA_IMAGE_REPO:-docker.io} +CODEGEN_NAMESPACE="${APP_NAMESPACE}_codegen" function install_gmc() { # Make sure you have to use image tag $VERSION for microservice-connector installation @@ -28,6 +29,8 @@ function install_gmc() { function validate_gmc() { echo "validate chat-qna" validate_chatqna + echo "validate codegen" + validate_codegen } @@ -94,6 +97,54 @@ function validate_chatqna() { fi } +function validate_codegen() { + + # todo select gaudi or xeon + kubectl create ns $CODEGEN_NAMESPACE + sed -i "s|namespace: codegen|namespace: $CODEGEN_NAMESPACE|g" $(pwd)/config/samples/codegen.yaml + kubectl apply -f $(pwd)/config/samples/codegen.yaml + + # Wait until the router service is ready + echo "Waiting for the codegen router service to be ready..." + wait_until_pod_ready "codegen router" $CODEGEN_NAMESPACE "router-service" + output=$(kubectl get pods -n $CODEGEN_NAMESPACE) + echo $output + + + # deploy client pod for testing + kubectl create deployment client-test -n $CODEGEN_NAMESPACE --image=python:3.8.13 -- sleep infinity + + # wait for client pod ready + wait_until_pod_ready "client-test" $CODEGEN_NAMESPACE "client-test" + # giving time to populating data + sleep 60 + + kubectl get pods -n $CODEGEN_NAMESPACE + # send request to codegen + export CLIENT_POD=$(kubectl get pod -n $CODEGEN_NAMESPACE -l app=client-test -o jsonpath={.items..metadata.name}) + echo "$CLIENT_POD" + accessUrl=$(kubectl get gmc -n $CODEGEN_NAMESPACE -o jsonpath="{.items[?(@.metadata.name=='chatqa')].status.accessUrl}") + kubectl exec "$CLIENT_POD" -n $CODEGEN_NAMESPACE -- curl $accessUrl -X POST -d '{"messages": "def print_hello_world():"}' -H 'Content-Type: application/json' > $LOG_PATH/gmc_codegen.log + exit_code=$? + if [ $exit_code -ne 0 ]; then + echo "chatqna failed, please check the logs in ${LOG_PATH}!" + exit 1 + fi + + echo "Checking response results, make sure the output is reasonable. " + local status=false + if [[ -f $LOG_PATH/gmc_codegen.log ]] && \ + [[ $(grep -c "print" $LOG_PATH/gmc_codegen.log) != 0 ]]; then + status=true + fi + if [ $status == false ]; then + echo "Response check failed, please check the logs in artifacts!" + exit 1 + else + echo "Response check succeed!" + fi +} + function init_gmc() { # Copy manifest into gmc mkdir -p $(pwd)/config/manifests From 1b20b93da12531d8d8eb33d76e066d8ea29a4634 Mon Sep 17 00:00:00 2001 From: irisdingbj Date: Wed, 19 Jun 2024 04:18:22 +0800 Subject: [PATCH 3/4] add cleanup for codegen Signed-off-by: irisdingbj --- .github/workflows/scripts/e2e/gmc_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scripts/e2e/gmc_test.sh b/.github/workflows/scripts/e2e/gmc_test.sh index db16704b..c0ed4d55 100755 --- a/.github/workflows/scripts/e2e/gmc_test.sh +++ b/.github/workflows/scripts/e2e/gmc_test.sh @@ -37,6 +37,7 @@ function validate_gmc() { function cleanup_gmc() { echo "clean up microservice-connector" kubectl delete ns $APP_NAMESPACE + kubectl delete ns $CODEGEN_NAMESPACE kubectl delete ns $SYSTEM_NAMESPACE kubectl delete crd gmconnectors.gmc.opea.io # clean up the images From d2c2c7cf8bd73b7e060d33f15a900a340f30b14c Mon Sep 17 00:00:00 2001 From: irisdingbj Date: Wed, 19 Jun 2024 04:24:34 +0800 Subject: [PATCH 4/4] fix namespace for codegen test Signed-off-by: irisdingbj --- .github/workflows/scripts/e2e/gmc_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/e2e/gmc_test.sh b/.github/workflows/scripts/e2e/gmc_test.sh index c0ed4d55..98c1665d 100755 --- a/.github/workflows/scripts/e2e/gmc_test.sh +++ b/.github/workflows/scripts/e2e/gmc_test.sh @@ -7,7 +7,7 @@ USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/charts-mnt IMAGE_REPO=${OPEA_IMAGE_REPO:-docker.io} -CODEGEN_NAMESPACE="${APP_NAMESPACE}_codegen" +CODEGEN_NAMESPACE="${APP_NAMESPACE}-codegen" function install_gmc() { # Make sure you have to use image tag $VERSION for microservice-connector installation