Skip to content

Commit 75ad69c

Browse files
chore: update tests (#2027)
Co-authored-by: sangjanai <[email protected]>
1 parent eddc1d5 commit 75ad69c

File tree

9 files changed

+27
-28
lines changed

9 files changed

+27
-28
lines changed

Diff for: docs/static/openapi/cortex.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5356,7 +5356,7 @@
53565356
"type": "string",
53575357
"description": "The identifier or URL of the model to use. It can be a model ID on Cortexso (https://huggingface.co/cortexso) or a HuggingFace URL pointing to the model file. For example: 'gpt2' or 'https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/blob/main/mistral-7b-instruct-v0.1.Q2_K.gguf'",
53585358
"examples": [
5359-
"tinyllama:gguf",
5359+
"tinyllama:1b",
53605360
"https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/blob/main/mistral-7b-instruct-v0.1.Q2_K.gguf"
53615361
]
53625362
},

Diff for: engine/e2e-test/api/model/test_api_model.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ async def test_models_start_stop_should_be_successful(self):
9595
time.sleep(30)
9696

9797
print("Pull model")
98-
json_body = {"model": "tinyllama:gguf"}
98+
json_body = {"model": "tinyllama:1b"}
9999
response = requests.post("http://localhost:3928/v1/models/pull", json=json_body)
100-
assert response.status_code == 200, f"Failed to pull model: tinyllama:gguf"
100+
assert response.status_code == 200, f"Failed to pull model: tinyllama:1b"
101101
await wait_for_websocket_download_success_event(timeout=None)
102102

103103
# get API
104104
print("Get model")
105-
response = requests.get("http://localhost:3928/v1/models/tinyllama:gguf")
105+
response = requests.get("http://localhost:3928/v1/models/tinyllama:1b")
106106
assert response.status_code == 200
107107

108108
# list API
@@ -111,7 +111,7 @@ async def test_models_start_stop_should_be_successful(self):
111111
assert response.status_code == 200
112112

113113
print("Start model")
114-
json_body = {"model": "tinyllama:gguf"}
114+
json_body = {"model": "tinyllama:1b"}
115115
response = requests.post(
116116
"http://localhost:3928/v1/models/start", json=json_body
117117
)
@@ -123,13 +123,13 @@ async def test_models_start_stop_should_be_successful(self):
123123

124124
# update API
125125
print("Update model")
126-
body_json = {'model': 'tinyllama:gguf'}
127-
response = requests.patch("http://localhost:3928/v1/models/tinyllama:gguf", json = body_json)
126+
body_json = {'model': 'tinyllama:1b'}
127+
response = requests.patch("http://localhost:3928/v1/models/tinyllama:1b", json = body_json)
128128
assert response.status_code == 200
129129

130130
# delete API
131131
print("Delete model")
132-
response = requests.delete("http://localhost:3928/v1/models/tinyllama:gguf")
132+
response = requests.delete("http://localhost:3928/v1/models/tinyllama:1b")
133133
assert response.status_code == 200
134134

135135
def test_models_sources_api(self):

Diff for: engine/e2e-test/api/model/test_api_model_import.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ def setup_and_teardown(self):
1616

1717
@pytest.mark.skipif(True, reason="Expensive test. Only test when you have local gguf file.")
1818
def test_model_import_should_be_success(self):
19-
body_json = {'model': 'tinyllama:gguf',
19+
body_json = {'model': 'tinyllama:1b',
2020
'modelPath': '/path/to/local/gguf'}
2121
response = requests.post("http://localhost:3928/v1/models/import", json=body_json)
2222
assert response.status_code == 200
2323

2424
@pytest.mark.skipif(True, reason="Expensive test. Only test when you have local gguf file.")
2525
def test_model_import_with_name_should_be_success(self):
26-
body_json = {'model': 'tinyllama:gguf',
26+
body_json = {'model': 'tinyllama:1b',
2727
'modelPath': '/path/to/local/gguf',
2828
'name': 'test_model'}
2929
response = requests.post("http://localhost:3928/v1/models/import", json=body_json)
@@ -45,7 +45,7 @@ def test_model_import_with_name_should_be_success(self):
4545
assert response.json()['files'][0] != '/path/to/local/gguf'
4646

4747
def test_model_import_with_invalid_path_should_fail(self):
48-
body_json = {'model': 'tinyllama:gguf',
48+
body_json = {'model': 'tinyllama:1b',
4949
'modelPath': '/invalid/path/to/gguf'}
5050
response = requests.post("http://localhost:3928/v1/models/import", json=body_json)
5151
assert response.status_code == 400

Diff for: engine/e2e-test/cli/model/test_cli_model.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def setup_and_teardown(self):
2222

2323
# Teardown
2424
# Clean up
25-
run("Delete model", ["models", "delete", "tinyllama:gguf"])
25+
run("Delete model", ["models", "delete", "tinyllama:1b"])
2626
stop_server()
2727

2828
def test_model_pull_with_direct_url_should_be_success(self):
@@ -40,13 +40,13 @@ def test_model_pull_with_direct_url_should_be_success(self):
4040

4141
@pytest.mark.asyncio
4242
async def test_models_delete_should_be_successful(self):
43-
json_body = {"model": "tinyllama:gguf"}
43+
json_body = {"model": "tinyllama:1b"}
4444
response = requests.post("http://localhost:3928/v1/models/pull", json=json_body)
45-
assert response.status_code == 200, f"Failed to pull model: tinyllama:gguf"
45+
assert response.status_code == 200, f"Failed to pull model: tinyllama:1b"
4646
await wait_for_websocket_download_success_event(timeout=None)
4747

4848
exit_code, output, error = run(
49-
"Delete model", ["models", "delete", "tinyllama:gguf"]
49+
"Delete model", ["models", "delete", "tinyllama:1b"]
5050
)
51-
assert "Model tinyllama:gguf deleted successfully" in output
51+
assert "Model tinyllama:1b deleted successfully" in output
5252
assert exit_code == 0, f"Model does not exist: {error}"

Diff for: engine/e2e-test/local_test.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import websockets
1010

1111
# Define a list of request configurations
12-
model_id = "tinyllama:gguf"
12+
model_id = "tinyllama:1b"
1313

1414

1515
def make_request(config):
@@ -78,7 +78,7 @@ def get_setup_configs(host_port):
7878
"method": "POST",
7979
"url": "http://" + host_port + "/v1/models/pull",
8080
"headers": {"Content-Type": "application/json"},
81-
"data": {"model": "tinyllama:gguf"},
81+
"data": {"model": "tinyllama:1b"},
8282
},
8383
{
8484
"method": "POST",
@@ -89,14 +89,14 @@ def get_setup_configs(host_port):
8989
"method": "POST",
9090
"url": "http://" + host_port + "/v1/models/start",
9191
"headers": {"Content-Type": "application/json"},
92-
"data": {"model": "tinyllama:gguf"},
92+
"data": {"model": "tinyllama:1b"},
9393
},
9494
{
9595
"method": "POST",
9696
"url": "http://" + host_port + "/v1/chat/completions",
9797
"headers": {"Content-Type": "application/json"},
9898
"data": {
99-
"model": "tinyllama:gguf",
99+
"model": "tinyllama:1b",
100100
"stream": True,
101101
"messages": [{"content": "How are you today?", "role": "user"}],
102102
"max_tokens": 256,
@@ -111,7 +111,7 @@ def get_teardown_configs(host_port):
111111
"method": "POST",
112112
"url": "http://" + host_port + "/v1/models/stop",
113113
"headers": {"Content-Type": "application/json"},
114-
"data": {"model": "tinyllama:gguf"},
114+
"data": {"model": "tinyllama:1b"},
115115
},
116116
{
117117
"method": "DELETE",

Diff for: engine/e2e-test/test_api_docker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import requests
33
from utils.test_runner import wait_for_websocket_download_success_event
44

5-
repo_branches = ["tinyllama:gguf"]
5+
repo_branches = ["tinyllama:1b"]
66

77

88
class TestCortexsoModels:

Diff for: engine/e2e-test/utils/test_runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def start_server_if_needed():
9090
start_server()
9191

9292

93-
def pull_model_if_needed(model_id: str = "tinyllama:gguf"):
93+
def pull_model_if_needed(model_id: str = "tinyllama:1b"):
9494
"""
9595
Pull the model if it is not already pulled.
9696
"""

Diff for: engine/test/components/test_event.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TEST_F(EventTest, EventFromString) {
99
// clang-format off
1010
std::string ev_str = R"({
1111
"task": {
12-
"id": "tinyllama:gguf",
12+
"id": "tinyllama:1b",
1313
"items": [
1414
{
1515
"bytes": 668788096,

Diff for: engine/test/components/test_huggingface_utils.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ TEST_F(HuggingFaceUtilTestSuite, TestGetModelRepositoryBranches) {
77
auto branches =
88
huggingface_utils::GetModelRepositoryBranches("cortexso", "tinyllama");
99

10-
EXPECT_GE(branches.value().size(), 3);
10+
EXPECT_GE(branches.value().size(), 1);
1111
EXPECT_EQ(branches.value()["main"].name, "main");
1212
EXPECT_EQ(branches.value()["main"].ref, "refs/heads/main");
1313
EXPECT_EQ(branches.value()["1b"].name, "1b");
1414
EXPECT_EQ(branches.value()["1b"].ref, "refs/heads/1b");
15-
EXPECT_EQ(branches.value()["gguf"].name, "gguf");
16-
EXPECT_EQ(branches.value()["gguf"].ref, "refs/heads/gguf");
1715
}
1816

1917
// TODO(sang) re-enable when main branch is fixed
20-
TEST_F(HuggingFaceUtilTestSuite, DISABLED_TestGetHuggingFaceModelRepoInfoSuccessfully) {
18+
TEST_F(HuggingFaceUtilTestSuite,
19+
DISABLED_TestGetHuggingFaceModelRepoInfoSuccessfully) {
2120
auto model_info =
2221
huggingface_utils::GetHuggingFaceModelRepoInfo("cortexso", "tinyllama");
2322

0 commit comments

Comments
 (0)