From a96e5ac0d6b309d72f58a9051af83e8061cfa608 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Tue, 3 Dec 2024 17:19:24 +0700 Subject: [PATCH] fix: e2e tests --- engine/e2e-test/main.py | 1 + engine/e2e-test/test_api_engine.py | 5 ----- engine/e2e-test/test_api_engine_list.py | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 engine/e2e-test/test_api_engine_list.py diff --git a/engine/e2e-test/main.py b/engine/e2e-test/main.py index 37e6d890e..e874ab3a0 100644 --- a/engine/e2e-test/main.py +++ b/engine/e2e-test/main.py @@ -2,6 +2,7 @@ import sys ### e2e tests are expensive, have to keep engines tests in order +from test_api_engine_list import TestApiEngineList from test_api_engine import TestApiEngine from test_api_model import TestApiModel from test_api_model_import import TestApiModelImport diff --git a/engine/e2e-test/test_api_engine.py b/engine/e2e-test/test_api_engine.py index f4120e2a2..57b47b879 100644 --- a/engine/e2e-test/test_api_engine.py +++ b/engine/e2e-test/test_api_engine.py @@ -20,11 +20,6 @@ def setup_and_teardown(self): # Teardown stop_server() - - # engines list - def test_engines_list_api_run_successfully(self): - response = requests.get("http://localhost:3928/engines") - assert response.status_code == 200 # engines get def test_engines_get_llamacpp_should_be_successful(self): diff --git a/engine/e2e-test/test_api_engine_list.py b/engine/e2e-test/test_api_engine_list.py new file mode 100644 index 000000000..f149f1450 --- /dev/null +++ b/engine/e2e-test/test_api_engine_list.py @@ -0,0 +1,25 @@ +import pytest +import requests +from test_runner import start_server, stop_server + + +class TestApiEngineList: + + @pytest.fixture(autouse=True) + def setup_and_teardown(self): + # Setup + # Not sure why but on macOS amd, the first start server timeouts with CI + start_server() + stop_server() + success = start_server() + if not success: + raise Exception("Failed to start server") + + yield + + # Teardown + stop_server() + + def test_engines_list_api_run_successfully(self): + response = requests.get("http://localhost:3928/engines") + assert response.status_code == 200 \ No newline at end of file