Skip to content

Commit 8ec9641

Browse files
committed
Refine
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent dd51398 commit 8ec9641

33 files changed

Lines changed: 975 additions & 785 deletions

DBQnA/tests/test_compose_on_rocm.sh

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,6 @@ function validate_microservice() {
6666

6767
}
6868

69-
function validate_frontend() {
70-
echo "[ TEST INFO ]: --------- frontend test started ---------"
71-
cd $WORKPATH/ui/react
72-
local conda_env_name="OPEA_e2e"
73-
export PATH=${HOME}/miniconda3/bin/:$PATH
74-
if conda info --envs | grep -q "$conda_env_name"; then
75-
echo "$conda_env_name exist!"
76-
else
77-
conda create -n ${conda_env_name} python=3.12 -y
78-
fi
79-
80-
source activate ${conda_env_name}
81-
echo "[ TEST INFO ]: --------- conda env activated ---------"
82-
83-
conda install -c conda-forge nodejs=22.6.0 -y
84-
npm install && npm ci
85-
node -v && npm -v && pip list
86-
87-
exit_status=0
88-
npm run test || exit_status=$?
89-
90-
if [ $exit_status -ne 0 ]; then
91-
echo "[TEST INFO]: ---------frontend test failed---------"
92-
exit $exit_status
93-
else
94-
echo "[TEST INFO]: ---------frontend test passed---------"
95-
fi
96-
}
97-
9869
function stop_docker() {
9970
cd $WORKPATH/docker_compose/amd/gpu/rocm/
10071
docker compose stop && docker compose rm -f
@@ -118,10 +89,6 @@ function main() {
11889
validate_microservice
11990
echo "::endgroup::"
12091

121-
echo "::group::validate_frontend"
122-
validate_frontend
123-
echo "::endgroup::"
124-
12592
echo "::group::stop_docker"
12693
stop_docker
12794
echo "::endgroup::"

DBQnA/tests/test_compose_on_xeon.sh

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,6 @@ function validate_microservice() {
6666

6767
}
6868

69-
function validate_frontend() {
70-
echo "[ TEST INFO ]: --------- frontend test started ---------"
71-
cd $WORKPATH/ui/react
72-
local conda_env_name="OPEA_e2e"
73-
export PATH=${HOME}/miniforge3/bin/:$PATH
74-
if conda info --envs | grep -q "$conda_env_name"; then
75-
echo "$conda_env_name exist!"
76-
else
77-
conda create -n ${conda_env_name} python=3.12 -y
78-
fi
79-
80-
source activate ${conda_env_name}
81-
echo "[ TEST INFO ]: --------- conda env activated ---------"
82-
83-
conda install -c conda-forge nodejs=22.6.0 -y
84-
npm install && npm ci
85-
node -v && npm -v && pip list
86-
87-
exit_status=0
88-
npm run test || exit_status=$?
89-
90-
if [ $exit_status -ne 0 ]; then
91-
echo "[TEST INFO]: ---------frontend test failed---------"
92-
exit $exit_status
93-
else
94-
echo "[TEST INFO]: ---------frontend test passed---------"
95-
fi
96-
}
97-
9869
function stop_docker() {
9970
cd $WORKPATH/docker_compose/intel/cpu/xeon
10071
docker compose stop && docker compose rm -f
@@ -118,10 +89,6 @@ function main() {
11889
validate_microservice
11990
echo "::endgroup::"
12091

121-
echo "::group::validate_frontend"
122-
validate_frontend
123-
echo "::endgroup::"
124-
12592
echo "::group::stop_docker"
12693
stop_docker
12794
echo "::endgroup::"

DBQnA/tests/test_ui_on_xeon.sh

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/bin/bash
2+
# Copyright (C) 2024 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set -xe
6+
7+
IMAGE_REPO=${IMAGE_REPO:-"opea"}
8+
IMAGE_TAG=${IMAGE_TAG:-"latest"}
9+
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
10+
echo "TAG=IMAGE_TAG=${IMAGE_TAG}"
11+
export REGISTRY=${IMAGE_REPO}
12+
export TAG=${IMAGE_TAG}
13+
export MODEL_CACHE=${model_cache:-"./data"}
14+
15+
WORKPATH=$(dirname "$PWD")
16+
LOG_PATH="$WORKPATH/tests"
17+
ip_address=$(hostname -I | awk '{print $1}')
18+
19+
function build_docker_images() {
20+
cd $WORKPATH/docker_image_build
21+
git clone --single-branch --branch "${opea_branch:-"main"}" https://github.com/opea-project/GenAIComps.git
22+
23+
echo "Build all the images with --no-cache, check docker_image_build.log for details..."
24+
docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log
25+
26+
docker pull ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu
27+
docker images && sleep 1s
28+
}
29+
30+
function start_services() {
31+
cd $WORKPATH/docker_compose/intel/cpu/xeon
32+
export no_proxy="localhost,127.0.0.1,$ip_address"
33+
source ./set_env.sh
34+
35+
# Start Docker Containers
36+
docker compose -f compose.yaml up -d > ${LOG_PATH}/start_services_with_compose.log
37+
38+
# check whether tgi is fully ready.
39+
n=0
40+
until [[ "$n" -ge 100 ]] || [[ $ready == true ]]; do
41+
docker logs tgi-service > ${LOG_PATH}/tgi.log
42+
n=$((n+1))
43+
if grep -q Connected ${LOG_PATH}/tgi.log; then
44+
break
45+
fi
46+
sleep 5s
47+
done
48+
}
49+
50+
function validate_frontend() {
51+
echo "[ TEST INFO ]: --------- frontend test started ---------"
52+
cd $WORKPATH/ui/react
53+
local conda_env_name="OPEA_e2e"
54+
export PATH=${HOME}/miniforge3/bin/:$PATH
55+
if conda info --envs | grep -q "$conda_env_name"; then
56+
echo "$conda_env_name exist!"
57+
else
58+
conda create -n ${conda_env_name} python=3.12 -y
59+
fi
60+
61+
source activate ${conda_env_name}
62+
echo "[ TEST INFO ]: --------- conda env activated ---------"
63+
64+
conda install -c conda-forge nodejs=22.6.0 -y
65+
npm install && npm ci
66+
node -v && npm -v && pip list
67+
68+
exit_status=0
69+
npm run test || exit_status=$?
70+
71+
if [ $exit_status -ne 0 ]; then
72+
echo "[TEST INFO]: ---------frontend test failed---------"
73+
exit $exit_status
74+
else
75+
echo "[TEST INFO]: ---------frontend test passed---------"
76+
fi
77+
}
78+
79+
function stop_docker() {
80+
cd $WORKPATH/docker_compose/intel/cpu/xeon
81+
docker compose stop && docker compose rm -f
82+
}
83+
84+
function main() {
85+
86+
echo "::group::stop_docker"
87+
stop_docker
88+
echo "::endgroup::"
89+
90+
echo "::group::build_docker_images"
91+
if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi
92+
echo "::endgroup::"
93+
94+
echo "::group::start_services"
95+
start_services
96+
echo "::endgroup::"
97+
98+
echo "::group::validate_frontend"
99+
validate_frontend
100+
echo "::endgroup::"
101+
102+
echo "::group::stop_docker"
103+
stop_docker
104+
echo "::endgroup::"
105+
106+
docker system prune -f
107+
108+
}
109+
110+
main

GraphRAG/tests/test_compose_on_gaudi.sh

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -153,34 +153,6 @@ function validate_megaservice() {
153153

154154
}
155155

156-
function validate_frontend() {
157-
cd $WORKPATH/ui/svelte
158-
local conda_env_name="OPEA_e2e"
159-
export PATH=${HOME}/miniforge3/bin/:$PATH
160-
if conda info --envs | grep -q "$conda_env_name"; then
161-
echo "$conda_env_name exist!"
162-
else
163-
conda create -n ${conda_env_name} python=3.12 -y
164-
fi
165-
source activate ${conda_env_name}
166-
167-
sed -i "s/localhost/$host_ip/g" playwright.config.ts
168-
169-
conda install -c conda-forge nodejs=22.6.0 -y
170-
npm install && npm ci && npx playwright install --with-deps
171-
node -v && npm -v && pip list
172-
173-
exit_status=0
174-
npx playwright test || exit_status=$?
175-
176-
if [ $exit_status -ne 0 ]; then
177-
echo "[TEST INFO]: ---------frontend test failed---------"
178-
exit $exit_status
179-
else
180-
echo "[TEST INFO]: ---------frontend test passed---------"
181-
fi
182-
}
183-
184156
function stop_docker() {
185157
cd $WORKPATH/docker_compose/intel/hpu/gaudi
186158
docker compose -f compose.yaml down
@@ -208,10 +180,6 @@ function main() {
208180
validate_megaservice
209181
echo "::endgroup::"
210182

211-
echo "::group::validate_frontend"
212-
validate_frontend
213-
echo "::endgroup::"
214-
215183
echo "::group::stop_docker"
216184
stop_docker
217185
echo "::endgroup::"

GraphRAG/tests/test_ui_on_gaudi.sh

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/bin/bash
2+
# Copyright (C) 2024 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set -x
6+
IMAGE_REPO=${IMAGE_REPO:-"opea"}
7+
IMAGE_TAG=${IMAGE_TAG:-"latest"}
8+
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
9+
echo "TAG=IMAGE_TAG=${IMAGE_TAG}"
10+
export REGISTRY=${IMAGE_REPO}
11+
export TAG=${IMAGE_TAG}
12+
export MODEL_CACHE=${model_cache:-"./data"}
13+
14+
WORKPATH=$(dirname "$PWD")
15+
LOG_PATH="$WORKPATH/tests"
16+
export host_ip=$(hostname -I | awk '{print $1}')
17+
18+
function build_docker_images() {
19+
opea_branch=${opea_branch:-"main"}
20+
21+
cd $WORKPATH/docker_image_build
22+
git clone --depth 1 --branch ${opea_branch} https://github.com/opea-project/GenAIComps.git
23+
pushd GenAIComps
24+
echo "GenAIComps test commit is $(git rev-parse HEAD)"
25+
docker build --no-cache -t ${REGISTRY}/comps-base:${TAG} --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
26+
popd && sleep 1s
27+
28+
echo "Build all the images with --no-cache, check docker_image_build.log for details..."
29+
docker compose -f build.yaml build --no-cache > ${LOG_PATH}/docker_image_build.log 2>&1
30+
31+
docker images && sleep 1s
32+
}
33+
34+
function start_services() {
35+
cd $WORKPATH/docker_compose/intel/hpu/gaudi
36+
source set_env.sh
37+
unset OPENAI_API_KEY
38+
export no_proxy="localhost,127.0.0.1,$ip_address"
39+
# Start Docker Containers
40+
docker compose -f compose.yaml up -d > ${LOG_PATH}/start_services_with_compose.log
41+
42+
n=0
43+
until [[ "$n" -ge 100 ]]; do
44+
docker logs tgi-gaudi-server > ${LOG_PATH}/tgi_service_start.log 2>&1
45+
if grep -q Connected ${LOG_PATH}/tgi_service_start.log; then
46+
break
47+
fi
48+
sleep 5s
49+
n=$((n+1))
50+
done
51+
}
52+
53+
function validate_frontend() {
54+
cd $WORKPATH/ui/svelte
55+
local conda_env_name="OPEA_e2e"
56+
export PATH=${HOME}/miniforge3/bin/:$PATH
57+
if conda info --envs | grep -q "$conda_env_name"; then
58+
echo "$conda_env_name exist!"
59+
else
60+
conda create -n ${conda_env_name} python=3.12 -y
61+
fi
62+
source activate ${conda_env_name}
63+
64+
sed -i "s/localhost/$host_ip/g" playwright.config.ts
65+
66+
conda install -c conda-forge nodejs=22.6.0 -y
67+
npm install && npm ci && npx playwright install --with-deps
68+
node -v && npm -v && pip list
69+
70+
exit_status=0
71+
npx playwright test || exit_status=$?
72+
73+
if [ $exit_status -ne 0 ]; then
74+
echo "[TEST INFO]: ---------frontend test failed---------"
75+
exit $exit_status
76+
else
77+
echo "[TEST INFO]: ---------frontend test passed---------"
78+
fi
79+
}
80+
81+
function stop_docker() {
82+
cd $WORKPATH/docker_compose/intel/hpu/gaudi
83+
docker compose -f compose.yaml down
84+
}
85+
86+
function main() {
87+
88+
echo "::group::stop_docker"
89+
stop_docker
90+
echo "::endgroup::"
91+
92+
echo "::group::build_docker_images"
93+
if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi
94+
echo "::endgroup::"
95+
96+
echo "::group::start_services"
97+
start_services
98+
echo "::endgroup::"
99+
100+
echo "::group::validate_frontend"
101+
validate_frontend
102+
echo "::endgroup::"
103+
104+
echo "::group::stop_docker"
105+
stop_docker
106+
echo "::endgroup::"
107+
108+
docker system prune -f
109+
110+
}
111+
112+
main

0 commit comments

Comments
 (0)