add UI test for codegen (#244)

Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com>
Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com>
This commit is contained in:
Sun, Xuehao
2024-05-31 21:22:59 +08:00
committed by GitHub
parent 3237ee4c58
commit dbee190e64
32 changed files with 1144 additions and 246 deletions

View File

@@ -36,6 +36,8 @@ function start_services() {
export LLM_SERVICE_HOST_IP=${ip_address}
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7778/v1/codegen"
sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env
# Start Docker Containers
# TODO: Replace the container name with a test-specific name
docker compose -f docker_compose.yaml up -d
@@ -101,6 +103,31 @@ function validate_megaservice() {
}
function validate_frontend() {
cd $WORKPATH/docker/ui/svelte
local conda_env_name="CodeGen_e2e"
export PATH=${HOME}/miniforge3/bin/:$PATH
conda remove -n ${conda_env_name} --all -y
conda create -n ${conda_env_name} python=3.12 -y
source activate ${conda_env_name}
sed -i "s/localhost/$ip_address/g" playwright.config.ts
conda install -c conda-forge nodejs -y && npm install && npm ci && npx playwright install --with-deps
node -v && npm -v && pip list
exit_status=0
npx playwright test || exit_status=$?
if [ $exit_status -ne 0 ]; then
echo "[TEST INFO]: ---------frontend test failed---------"
exit $exit_status
else
echo "[TEST INFO]: ---------frontend test passed---------"
fi
}
function stop_docker() {
cd $WORKPATH/docker/gaudi
container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2)
@@ -119,6 +146,7 @@ function main() {
validate_microservices
validate_megaservice
validate_frontend
stop_docker
echo y | docker system prune

View File

@@ -34,6 +34,8 @@ function start_services() {
export LLM_SERVICE_HOST_IP=${ip_address}
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7778/v1/codegen"
sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env
# Start Docker Containers
# TODO: Replace the container name with a test-specific name
docker compose -f docker_compose.yaml up -d
@@ -99,6 +101,32 @@ function validate_megaservice() {
}
function validate_frontend() {
cd $WORKPATH/docker/ui/svelte
local conda_env_name="CodeGen_e2e"
export PATH=${HOME}/miniforge3/bin/:$PATH
conda remove -n ${conda_env_name} --all -y
conda create -n ${conda_env_name} python=3.12 -y
source activate ${conda_env_name}
sed -i "s/localhost/$ip_address/g" playwright.config.ts
conda install -c conda-forge nodejs -y && npm install && npm ci && npx playwright install --with-deps
node -v && npm -v && pip list
exit_status=0
npx playwright test || exit_status=$?
if [ $exit_status -ne 0 ]; then
echo "[TEST INFO]: ---------frontend test failed---------"
exit $exit_status
else
echo "[TEST INFO]: ---------frontend test passed---------"
fi
}
function stop_docker() {
cd $WORKPATH/docker/xeon
container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2)
@@ -117,6 +145,7 @@ function main() {
validate_microservices
validate_megaservice
validate_frontend
stop_docker
echo y | docker system prune