Skip to content

Commit afcb3a3

Browse files
zhlsunshinemkbhandadaisy-ycguo
authored
Add e2e test of chatqna for genai example (#334)
* add e2e test of chatqna for genai example. Signed-off-by: zhlsunshine <huailong.zhang@intel.com> Co-authored-by: mkbhanda <malini.bhandaru@intel.com> Co-authored-by: daisy-ycguo <yingchun.guo@intel.com>
1 parent 3ffe19e commit afcb3a3

File tree

5 files changed

+606
-0
lines changed

5 files changed

+606
-0
lines changed

.github/workflows/gmc-e2e.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: E2E test with GMC
5+
6+
on:
7+
pull_request:
8+
branches: [main]
9+
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
10+
paths:
11+
- "**/kubernetes/**"
12+
- "**/tests/test_gmc**"
13+
- "!**.md"
14+
- "!**.txt"
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
job1:
23+
uses: ./.github/workflows/reuse-get-test-matrix.yml
24+
with:
25+
diff_excluded_files: '.github|deprecated|docker|assets|*.md|*.txt'
26+
xeon_server_label: 'xeon'
27+
gaudi_server_label: 'gaudi'
28+
29+
gmc-test:
30+
needs: [job1]
31+
strategy:
32+
matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
33+
runs-on: "k8s-${{ matrix.hardware }}"
34+
continue-on-error: true
35+
steps:
36+
- name: E2e test gmc
37+
run: |
38+
echo "Matrix - gmc: ${{ matrix.example }}"
39+
40+
- name: Clean Up Working Directory
41+
run: sudo rm -rf ${{github.workspace}}/*
42+
43+
- name: Checkout out Repo
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Set variables
49+
run: |
50+
if [ ${{ matrix.hardware }} == "gaudi" ]; then IMAGE_REPO=${{ vars.IMAGE_REPO_GAUDI }}; else IMAGE_REPO=${{ vars.IMAGE_REPO_XEON }}; fi
51+
echo "IMAGE_REPO=$OPEA_IMAGE_REPO" >> $GITHUB_ENV
52+
lower_example=$(echo "${{ matrix.example }}" | tr '[:upper:]' '[:lower:]')
53+
echo "SYSTEM_NAMESPACE=opea-system-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
54+
echo "APP_NAMESPACE=$lower_example-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
55+
echo "ROLLOUT_TIMEOUT_SECONDS=1800s" >> $GITHUB_ENV
56+
echo "KUBECTL_TIMEOUT_SECONDS=60s" >> $GITHUB_ENV
57+
echo "continue_test=true" >> $GITHUB_ENV
58+
echo "should_cleanup=false" >> $GITHUB_ENV
59+
echo "skip_validate=true" >> $GITHUB_ENV
60+
echo "APP_NAMESPACE=$APP_NAMESPACE"
61+
62+
- name: Kubectl install
63+
id: install
64+
run: |
65+
if [[ ! -f ${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh ]]; then
66+
echo "No test script found, exist test!"
67+
exit 0
68+
else
69+
${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh init_${{ matrix.example }}
70+
echo "should_cleanup=true" >> $GITHUB_ENV
71+
${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh install_${{ matrix.example }}
72+
echo "Testing ${{ matrix.example }}, waiting for pod ready..."
73+
if kubectl rollout status deployment --namespace "$APP_NAMESPACE" --timeout "$ROLLOUT_TIMEOUT_SECONDS"; then
74+
echo "Testing gmc ${{ matrix.example }}, waiting for pod ready done!"
75+
echo "skip_validate=false" >> $GITHUB_ENV
76+
else
77+
echo "Timeout waiting for pods in namespace $APP_NAMESPACE to be ready!"
78+
exit 1
79+
fi
80+
sleep 60
81+
fi
82+
83+
- name: Validate e2e test
84+
if: always()
85+
run: |
86+
if $skip_validate; then
87+
echo "Skip validate"
88+
else
89+
${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh validate_${{ matrix.example }}
90+
fi
91+
92+
- name: Kubectl uninstall
93+
if: always()
94+
run: |
95+
if $should_cleanup; then
96+
if ! kubectl delete ns $APP_NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then
97+
kubectl delete pods --namespace $APP_NAMESPACE --force --grace-period=0 --all
98+
kubectl delete ns $APP_NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS
99+
fi
100+
if ! kubectl delete ns $SYSTEM_NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then
101+
kubectl delete pods --namespace $SYSTEM_NAMESPACE --force --grace-period=0 --all
102+
kubectl delete ns $SYSTEM_NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS
103+
fi
104+
fi

ChatQnA/kubernetes/chatQnA_gaudi.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: gmc.opea.io/v1alpha3
5+
kind: GMConnector
6+
metadata:
7+
labels:
8+
app.kubernetes.io/name: gmconnector
9+
app.kubernetes.io/managed-by: kustomize
10+
gmc/platform: gaudi
11+
name: chatqa
12+
namespace: chatqa
13+
spec:
14+
routerConfig:
15+
name: router
16+
serviceName: router-service
17+
nodes:
18+
root:
19+
routerType: Sequence
20+
steps:
21+
- name: Embedding
22+
internalService:
23+
serviceName: embedding-svc
24+
config:
25+
endpoint: /v1/embeddings
26+
- name: TeiEmbeddingGaudi
27+
internalService:
28+
serviceName: tei-embedding-gaudi-svc
29+
isDownstreamService: true
30+
- name: Retriever
31+
data: $response
32+
internalService:
33+
serviceName: retriever-svc
34+
config:
35+
endpoint: /v1/retrieval
36+
- name: VectorDB
37+
internalService:
38+
serviceName: redis-vector-db
39+
isDownstreamService: true
40+
- name: Reranking
41+
data: $response
42+
internalService:
43+
serviceName: reranking-svc
44+
config:
45+
endpoint: /v1/reranking
46+
- name: TeiReranking
47+
internalService:
48+
serviceName: tei-reranking-svc
49+
config:
50+
endpoint: /rerank
51+
isDownstreamService: true
52+
- name: Llm
53+
data: $response
54+
internalService:
55+
serviceName: llm-svc
56+
config:
57+
endpoint: /v1/chat/completions
58+
- name: TgiGaudi
59+
internalService:
60+
serviceName: tgi-gaudi-svc
61+
config:
62+
endpoint: /generate
63+
isDownstreamService: true

ChatQnA/kubernetes/chatQnA_xeon.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: gmc.opea.io/v1alpha3
5+
kind: GMConnector
6+
metadata:
7+
labels:
8+
app.kubernetes.io/name: gmconnector
9+
app.kubernetes.io/managed-by: kustomize
10+
gmc/platform: xeon
11+
name: chatqa
12+
namespace: chatqa
13+
spec:
14+
routerConfig:
15+
name: router
16+
serviceName: router-service
17+
nodes:
18+
root:
19+
routerType: Sequence
20+
steps:
21+
- name: Embedding
22+
internalService:
23+
serviceName: embedding-svc
24+
config:
25+
endpoint: /v1/embeddings
26+
- name: TeiEmbedding
27+
internalService:
28+
serviceName: tei-embedding-svc
29+
isDownstreamService: true
30+
- name: Retriever
31+
data: $response
32+
internalService:
33+
serviceName: retriever-svc
34+
config:
35+
endpoint: /v1/retrieval
36+
- name: VectorDB
37+
internalService:
38+
serviceName: redis-vector-db
39+
isDownstreamService: true
40+
- name: Reranking
41+
data: $response
42+
internalService:
43+
serviceName: reranking-svc
44+
config:
45+
endpoint: /v1/reranking
46+
- name: TeiReranking
47+
internalService:
48+
serviceName: tei-reranking-svc
49+
config:
50+
endpoint: /rerank
51+
isDownstreamService: true
52+
- name: Llm
53+
data: $response
54+
internalService:
55+
serviceName: llm-svc
56+
config:
57+
endpoint: /v1/chat/completions
58+
- name: Tgi
59+
internalService:
60+
serviceName: tgi-service-m
61+
config:
62+
endpoint: /generate
63+
isDownstreamService: true

0 commit comments

Comments
 (0)