Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VipulMascarenhas committed Oct 23, 2024
1 parent 2b5cd84 commit e080822
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions tests/unitary/with_extras/aqua/test_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class TestDataset:
"MODEL_DEPLOY_PREDICT_ENDPOINT": "/v1/completions",
"PARAMS": "--served-model-name odsc-llm --seed 42",
},
"cmd": [],
"console_link": "https://cloud.oracle.com/data-science/model-deployments/ocid1.datasciencemodeldeployment.oc1.<region>.<MD_OCID>?region=region-name",
"lifecycle_details": "",
"shape_info": {
Expand Down Expand Up @@ -319,6 +320,13 @@ class TestDataset:
"memory_in_gbs": None,
}

aqua_deployment_tei_byoc_embeddings_cmd = [
"--model-id",
"/opt/ds/model/deployed_model/service_models/model-name/artifact/",
"--port",
"8080",
]


class TestAquaDeployment(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -719,6 +727,7 @@ def test_create_deployment_for_tei_byoc_embedding_model(
expected_result["shape_info"] = (
TestDataset.aqua_deployment_tei_byoc_embeddings_shape_info
)
expected_result["cmd"] = TestDataset.aqua_deployment_tei_byoc_embeddings_cmd
expected_result["environment_variables"] = (
TestDataset.aqua_deployment_tei_byoc_embeddings_env_vars
)
Expand Down
10 changes: 7 additions & 3 deletions tests/unitary/with_extras/aqua/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def mock_get_container_config():
yield mock_config


@pytest.fixture(autouse=True, scope="class")
@pytest.fixture(autouse=True, scope="function")
def mock_get_hf_model_info():
with patch.object(HfApi, "model_info") as mock_get_hf_model_info:
test_hf_model_info = ModelInfo(
Expand Down Expand Up @@ -933,7 +933,7 @@ def test_import_model_with_missing_config(
app.list = MagicMock(return_value=[])

if download_from_hf:
with pytest.raises(AquaValueError):
with pytest.raises(AquaRuntimeError):
mock_get_hf_model_info.return_value.siblings = []
with tempfile.TemporaryDirectory() as tmpdir:
model: AquaModel = app.register(
Expand Down Expand Up @@ -1037,7 +1037,11 @@ def test_import_tei_model_byoc(
DataScienceModel.sync = MagicMock()
OCIDataScienceModel.create = MagicMock()

mock_list_objects.return_value = MagicMock(objects=[])
artifact_path = "service_models/model-name/commit-id/artifact"
obj1 = MagicMock(etag="12345-1234-1234-1234-123456789", size=150)
obj1.name = f"{artifact_path}/config.json"
objects = [obj1]
mock_list_objects.return_value = MagicMock(objects=objects)
ds_model = DataScienceModel()
os_path = "oci://aqua-bkt@aqua-ns/prefix/path"
model_name = "oracle/aqua-1t-mega-model"
Expand Down

0 comments on commit e080822

Please sign in to comment.