@@ -6,132 +6,93 @@ set -e
66
77WORKPATH=$( dirname " $PWD " )
88LOG_PATH=" $WORKPATH /tests"
9- NAMESPACE=" ${NAMESPACE:- opea} "
109
1110function setup_gmc() {
1211 echo " Setting up GMC..."
13- kubectl apply -f https://github.com/opea-project/GenAIInfra/releases/download/v1.0/gmc.yaml || true
12+ kubectl apply -f https://github.com/opea-project/GenAIInfra/releases/download/v1.0/gmc.yaml
1413
1514 # Wait for GMC to be ready
16- kubectl wait --for=condition=Ready pod -l app=gmc-controller -n gmc-system --timeout=300s || true
15+ kubectl wait --for=condition=Ready pod -l app=gmc-controller -n gmc-system --timeout=300s
1716}
1817
19- function deploy_cogniwareims () {
20- echo " Deploying CogniwareIMS with GMC..."
18+ function deploy_inventoryms () {
19+ echo " Deploying InventoryMS with GMC..."
2120
2221 # Create namespace
23- kubectl create namespace ${NAMESPACE} 2> /dev/null || echo " Namespace ${NAMESPACE} already exists"
24-
25- # Deploy with Helm
26- helm install cogniwareims $WORKPATH /kubernetes/helm \
27- --namespace ${NAMESPACE} \
28- --set global.HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN:- " " } \
29- --wait --timeout 10m || {
30- echo " Warning: Deployment may not be fully ready"
31- kubectl get pods -n ${NAMESPACE}
32- }
33-
34- # Wait for pods
22+ kubectl create namespace opea || true
23+
24+ # Deploy microservices
25+ kubectl apply -f $WORKPATH /kubernetes/gmc/inventoryms.yaml -n opea
26+
27+ # Wait for deployment
3528 sleep 60
36- kubectl wait --for=condition=Ready pod -l app=cogniwareims-backend -n ${NAMESPACE} --timeout=600s || {
37- echo " Warning: Backend pod may not be ready"
38- kubectl get pods -n ${NAMESPACE}
39- }
29+ kubectl wait --for=condition=Ready pod -l app=inventoryms -n opea --timeout=600s
4030}
4131
4232function validate_deployment() {
43- echo " Validating deployment..."
33+ echo " Validating GMC deployment..."
34+
35+ # Check GMConnector status
36+ kubectl get gmconnector inventoryms -n opea
4437
4538 # Check pods
46- kubectl get pods -n ${NAMESPACE}
47- kubectl get svc -n ${NAMESPACE}
48-
49- # Get backend pod
50- BACKEND_POD=$( kubectl get pod -n ${NAMESPACE} -l app=cogniwareims-backend -o jsonpath=' {.items[0].metadata.name}' 2> /dev/null) || {
51- echo " Backend pod not found, skipping health checks"
52- return 0
53- }
54-
55- if [ -z " $BACKEND_POD " ]; then
56- echo " No backend pod found, skipping validation"
57- return 0
58- fi
39+ kubectl get pods -n opea
5940
60- echo " Testing backend pod: $BACKEND_POD "
41+ # Get service endpoint
42+ BACKEND_POD=$( kubectl get pod -n opea -l app=inventoryms-backend -o jsonpath=' {.items[0].metadata.name}' )
6143
6244 # Port forward for testing
63- kubectl port-forward -n ${NAMESPACE} pod/$BACKEND_POD 8000:8000 &
45+ kubectl port-forward -n opea pod/$BACKEND_POD 8888:8888 &
6446 PF_PID=$!
65- sleep 10
47+ sleep 5
6648
6749 # Test health endpoint
68- echo " Testing health endpoint..."
69- response=$( curl -s http://localhost:8000/api/health 2> /dev/null) || {
70- echo " Health check failed, but continuing..."
71- kill $PF_PID 2> /dev/null || true
72- return 0
73- }
74-
50+ response=$( curl -s http://localhost:8888/health)
7551 if echo " $response " | grep -q " healthy" ; then
76- echo " ✅ Health check passed!"
52+ echo " Health check passed!"
7753 else
78- echo " Health check response: $response "
54+ echo " Health check failed!"
55+ kill $PF_PID
56+ exit 1
7957 fi
8058
81- # Test chat endpoint
82- echo " Testing chat endpoint..."
83- response=$( curl -s -X POST http://localhost:8000/api/chat \
59+ # Test chat completion
60+ response=$( curl -s -X POST http://localhost:8888/v1/chat/completions \
8461 -H " Content-Type: application/json" \
8562 -d ' {
86- "message": "What Intel processors are best for inventory systems?",
87- "session_id": "test_session",
88- "user_role": "Inventory Manager"
89- }' 2> /dev/null) || {
90- echo " Chat test failed, but continuing..."
91- }
63+ "messages": [
64+ {"role": "user", "content": "What Intel processors are available?"}
65+ ]
66+ }' )
9267
9368 if echo " $response " | grep -q " error" ; then
94- echo " Chat test returned error "
95- else
96- echo " ✅ Chat test passed! "
69+ echo " Chat completion test failed! "
70+ kill $PF_PID
71+ exit 1
9772 fi
9873
99- echo " Validation completed !"
100- kill $PF_PID 2> /dev/null || true
74+ echo " All validations passed !"
75+ kill $PF_PID
10176}
10277
10378function cleanup() {
10479 echo " Cleaning up..."
105-
106- # Uninstall Helm release
107- helm uninstall cogniwareims --namespace ${NAMESPACE} 2> /dev/null || true
108-
109- # Delete namespace
110- kubectl delete namespace ${NAMESPACE} --grace-period=0 --force 2> /dev/null || true
111-
112- # Wait for cleanup
113- sleep 5
114-
115- echo " Cleanup completed"
80+ kubectl delete namespace opea --grace-period=0 --force || true
11681}
11782
11883function main() {
11984 echo " ========================================="
120- echo " CogniwareIMS GMC Test on Intel Xeon"
121- echo " Namespace: ${NAMESPACE} "
85+ echo " InventoryMS GMC Test on Intel Xeon"
12286 echo " ========================================="
12387
124- # Trap to ensure cleanup on exit
125- trap cleanup EXIT
126-
12788 setup_gmc
128- deploy_cogniwareims
89+ deploy_inventoryms
12990 validate_deployment
91+ cleanup
13092
13193 echo " ========================================="
132- echo " CogniwareIMS GMC Test Completed !"
94+ echo " InventoryMS GMC Test Passed !"
13395 echo " ========================================="
13496}
13597
13698main
137-
0 commit comments