Skip to content

Commit 451f309

Browse files
thiago-aixplainThiago Castro Ferreira
andauthored
Skip model onboard and deployment tests (#153)
Co-authored-by: Thiago Castro Ferreira <[email protected]>
1 parent e4b076b commit 451f309

File tree

4 files changed

+43
-14
lines changed

4 files changed

+43
-14
lines changed

tests/functional/model/hf_onboarding_test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
__author__ = "michaellam"
22

3-
import time
3+
import pytest
4+
import time
45

56
from aixplain.factories.model_factory import ModelFactory
67
from tests.test_utils import delete_asset
78
from aixplain.utils import config
89

10+
11+
@pytest.mark.skip(reason="Model Deployment is deactivated for improvements.")
912
def test_deploy_model():
1013
# Start the deployment
1114
model_name = "Test Model"
@@ -26,6 +29,8 @@ def test_deploy_model():
2629
# Clean up
2730
delete_asset(model_id, config.TEAM_API_KEY)
2831

32+
33+
@pytest.mark.skip(reason="Model Deployment is deactivated for improvements.")
2934
def test_nonexistent_model():
3035
# Start the deployment
3136
model_name = "Test Model"
@@ -34,6 +39,8 @@ def test_nonexistent_model():
3439
assert response["statusCode"] == 400
3540
assert response["message"] == "err.unable_to_onboard_model"
3641

42+
43+
@pytest.mark.skip(reason="Model Deployment is deactivated for improvements.")
3744
def test_size_limit():
3845
# Start the deployment
3946
model_name = "Test Model"
@@ -42,10 +49,12 @@ def test_size_limit():
4249
assert response["statusCode"] == 400
4350
assert response["message"] == "err.unable_to_onboard_model"
4451

52+
53+
@pytest.mark.skip(reason="Model Deployment is deactivated for improvements.")
4554
def test_gated_model():
4655
# Start the deployment
4756
model_name = "Test Model"
4857
repo_id = "meta-llama/Llama-2-7b-hf"
4958
response = ModelFactory.deploy_huggingface_model(model_name, repo_id, "mock_key")
5059
assert response["statusCode"] == 400
51-
assert response["message"] == "err.unable_to_onboard_model"
60+
assert response["message"] == "err.unable_to_onboard_model"

tests/image_upload_e2e_test.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
from tests.test_utils import delete_asset, delete_service_account
77
from aixplain.utils import config
88
import docker
9-
import os
9+
import pytest
1010

11+
12+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
1113
def test_create_and_upload_model():
1214
# List the host machines
1315
host_response = ModelFactory.list_host_machines()
@@ -44,7 +46,7 @@ def test_create_and_upload_model():
4446

4547
# Log into the image repository.
4648
login_response = ModelFactory.asset_repo_login()
47-
49+
4850
assert login_response["username"] == "AWS"
4951
assert login_response["registry"] == "535945872701.dkr.ecr.us-east-1.amazonaws.com"
5052
assert "password" in login_response.keys()
@@ -55,12 +57,12 @@ def test_create_and_upload_model():
5557

5658
# Push an image to ECR
5759
# os.system("aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 535945872701.dkr.ecr.us-east-1.amazonaws.com")
58-
low_level_client = docker.APIClient(base_url='unix://var/run/docker.sock')
60+
low_level_client = docker.APIClient(base_url="unix://var/run/docker.sock")
5961
# low_level_client.pull("535945872701.dkr.ecr.us-east-1.amazonaws.com/bash")
6062
# low_level_client.tag("535945872701.dkr.ecr.us-east-1.amazonaws.com/bash", f"{registry}/{repo_name}")
6163
low_level_client.pull("bash")
6264
low_level_client.tag("bash", f"{registry}/{repo_name}")
63-
low_level_client.push(f"{registry}/{repo_name}", auth_config={"username":username, "password":password})
65+
low_level_client.push(f"{registry}/{repo_name}", auth_config={"username": username, "password": password})
6466

6567
# Send an email to finalize onboarding process
6668
ModelFactory.onboard_model(model_id, "latest", "fake_hash")

tests/image_upload_functional_test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from aixplain.factories.model_factory import ModelFactory
77
import pytest
88

9+
10+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
911
def test_login():
1012
response = ModelFactory.asset_repo_login()
1113
assert response["username"] == "AWS"
@@ -15,6 +17,8 @@ def test_login():
1517
# Test cleanup
1618
delete_service_account(config.TEAM_API_KEY)
1719

20+
21+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
1822
def test_create_asset_repo():
1923
with open(Path("tests/test_requests/create_asset_request.json")) as f:
2024
mock_register_payload = json.load(f)
@@ -33,6 +37,8 @@ def test_create_asset_repo():
3337
# Test cleanup
3438
delete_asset(response["id"], config.TEAM_API_KEY)
3539

40+
41+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
3642
def test_list_host_machines():
3743
response = ModelFactory.list_host_machines()
3844
for hosting_machine_dict in response:
@@ -42,6 +48,8 @@ def test_list_host_machines():
4248
assert "memory" in hosting_machine_dict.keys()
4349
assert "hourlyCost" in hosting_machine_dict.keys()
4450

51+
52+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
4553
def test_get_functions():
4654
# Verbose
4755
response = ModelFactory.list_functions(True)
@@ -53,14 +61,15 @@ def test_get_functions():
5361
assert "name" in item.keys()
5462

5563
# Non-verbose
56-
response = ModelFactory.list_functions() # Not verbose by default
64+
response = ModelFactory.list_functions() # Not verbose by default
5765
items = response["items"]
5866
for item in items:
5967
assert "output" not in item.keys()
6068
assert "params" not in item.keys()
6169
assert "id" not in item.keys()
6270
assert "name" in item.keys()
6371

72+
6473
@pytest.mark.skip(reason="Not included in first release")
6574
def list_image_repo_tags():
6675
response = ModelFactory.list_image_repo_tags()

tests/image_upload_test.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@
1313
API_FIXED_HEADER = {"x-api-key": f"{config.TEAM_API_KEY}", "Content-Type": "application/json"}
1414

1515

16+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
1617
def test_login():
17-
url = urljoin(config.BACKEND_URL, f"sdk/ecr/login")
18+
url = urljoin(config.BACKEND_URL, f"sdk/ecr/login")
1819
with requests_mock.Mocker() as mock:
1920
with open(Path("tests/mock_responses/login_response.json")) as f:
2021
mock_json = json.load(f)
2122
mock.post(url, headers=AUTH_FIXED_HEADER, json=mock_json)
2223
creds = ModelFactory.asset_repo_login(config.TEAM_API_KEY)
2324
assert creds == mock_json
2425

26+
27+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
2528
def test_create_asset_repo():
26-
url_register = urljoin(config.BACKEND_URL, f"sdk/models/register")
29+
url_register = urljoin(config.BACKEND_URL, f"sdk/models/register")
2730
url_function = urljoin(config.BACKEND_URL, f"sdk/functions")
2831
with requests_mock.Mocker() as mock:
2932
with open(Path("tests/mock_responses/create_asset_repo_response.json")) as f:
@@ -32,12 +35,15 @@ def test_create_asset_repo():
3235
with open(Path("tests/mock_responses/list_functions_response.json")) as f:
3336
mock_json_functions = json.load(f)
3437
mock.get(url_function, headers=AUTH_FIXED_HEADER, json=mock_json_functions)
35-
model_id = ModelFactory.create_asset_repo("mock_name", "mock_machines", "mock_version",
36-
"mock_description", "Speech Recognition", "en", config.TEAM_API_KEY)
38+
model_id = ModelFactory.create_asset_repo(
39+
"mock_name", "mock_machines", "mock_version", "mock_description", "Speech Recognition", "en", config.TEAM_API_KEY
40+
)
3741
assert model_id == mock_json_register
3842

43+
44+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
3945
def test_list_host_machines():
40-
url = urljoin(config.BACKEND_URL, f"sdk/hosting-machines")
46+
url = urljoin(config.BACKEND_URL, f"sdk/hosting-machines")
4147
with requests_mock.Mocker() as mock:
4248
with open(Path("tests/mock_responses/list_host_machines_response.json")) as f:
4349
mock_json = json.load(f)
@@ -49,19 +55,22 @@ def test_list_host_machines():
4955
for key in machine_dict.keys():
5056
assert machine_dict[key] == mock_json_dict[key]
5157

58+
59+
@pytest.mark.skip(reason="Model Upload is deactivated for improvements.")
5260
def test_get_functions():
53-
url = urljoin(config.BACKEND_URL, f"sdk/functions")
61+
url = urljoin(config.BACKEND_URL, f"sdk/functions")
5462
with requests_mock.Mocker() as mock:
5563
with open(Path("tests/mock_responses/list_functions_response.json")) as f:
5664
mock_json = json.load(f)
5765
mock.get(url, headers=AUTH_FIXED_HEADER, json=mock_json)
5866
functions = ModelFactory.list_functions(config.TEAM_API_KEY)
5967
assert functions == mock_json
6068

69+
6170
@pytest.mark.skip(reason="Not currently supported.")
6271
def test_list_image_repo_tags():
6372
model_id = "mock_id"
64-
url = urljoin(config.BACKEND_URL, f"sdk/models/{model_id}/images")
73+
url = urljoin(config.BACKEND_URL, f"sdk/models/{model_id}/images")
6574
with requests_mock.Mocker() as mock:
6675
with open(Path("tests/mock_responses/list_image_repo_tags_response.json")) as f:
6776
mock_json = json.load(f)

0 commit comments

Comments
 (0)