Skip to content

Commit

Permalink
update log display feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
gladystonfranca committed Nov 8, 2024
1 parent 056a63c commit 0cfb15f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
11 changes: 11 additions & 0 deletions app/api/api_v1/endpoints/test_run_executions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from http import HTTPStatus
from typing import Any, Dict, List, Optional

import requests
from fastapi import APIRouter, BackgroundTasks, Depends, File, HTTPException, UploadFile
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse, StreamingResponse
Expand Down Expand Up @@ -525,6 +526,16 @@ def generate_summary_log(
detail="matter_qa_url must be configured",
)

page = requests.get(f"{matter_qa_url}/home")
if page.status_code is not int(HTTPStatus.OK):
raise HTTPException(
status_code=page.status_code,
detail=(
"The LogDisplay server is not responding.\n"
"Verify if the tool was installed, configured and initiated properly"
),
)

commissioning_method = project_config.dut_config.pairing_mode

test_run_execution = crud.test_run_execution.get(db=db, id=id)
Expand Down
8 changes: 5 additions & 3 deletions scripts/log_display/install_log_display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ clone_matter_qa() {
cd $MATTER_QA_PATH
git sparse-checkout set --cone
git checkout main
git sparse-checkout set tools
git sparse-checkout set tools src
else
echo "Matter QA repository already present at path $MATTER_QA_PATH"
fi
Expand All @@ -47,8 +47,10 @@ install_python_dependencies() {
sudo apt install uvicorn
sudo apt install python-is-python3
python -m venv $VIRTUAL_ENV
$VIRTUAL_ENV/bin/pip install fastapi
$VIRTUAL_ENV/bin/pip install pymongo
source $VIRTUAL_ENV/bin/activate
pip install setuptools
pip install $MATTER_QA_PATH/src/
deactivate
}

echo "Log Display install Initiated"
Expand Down
12 changes: 5 additions & 7 deletions scripts/log_display/uninstall_log_display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,25 @@ uninstall_mongodb() {
sudo apt-get purge "mongodb-org*"
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
echo "Done"
echo "MongoDB uninstall Done"
}

uninstall_python_dependencies() {
echo "Uninstalling packages..."
if [ "$VIRTUAL_ENV" != "" ]; then
deactivate
fi
$VIRTUAL_ENV/bin/pip uninstall pymongo
$VIRTUAL_ENV/bin/pip uninstall fastapi
rm -rf $VIRTUAL_ENV
sudo apt remove uvicorn
echo "Done"
echo "Packages uninstall Done"

}

remove_matter_qa_repo() {
if [ -d $MATTER_QA_PATH ]; then
echo "Deleting Matter QA repository..."
sudo rm -rf $MATTER_QA_PATH
echo "Done"
echo "Matter_QA repository removal Done"
else
echo "Matter QA repository not in the default location. Please, remove it manually"
fi
Expand All @@ -54,8 +52,8 @@ remove_matter_qa_repo() {
echo "Uninstall initiated"
echo

echo "The dependencies for LogDisplay app are: MongoDB, uvicorn, [pip] fastapi, [pip] pymongo and the Matter QA repository"
read -p "Are you sure you want to uninstall all those packages? [y/N] " -n 1 -r
echo "The dependencies for LogDisplay app are: MongoDB, uvicorn and the Python packages"
read -p "Are you sure you want to uninstall everything? [y/N] " -n 1 -r
echo

if [[ $REPLY =~ ^[Yy]$ ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_summary_report(
tc_name = line.split(": ")[1]

if not tc_result:
if line.find("Test Case Completed[") > 0:
if line.find("Test Case Completed [") > 0:
extract_datetime(line)

m = re.search(r"\[([A-Za-z0-9_]+)\]", line)
Expand Down

0 comments on commit 0cfb15f

Please sign in to comment.