Skip to content

Commit 65207bd

Browse files
committed
Fixed unit test.
1 parent c66bd7d commit 65207bd

File tree

1 file changed

+8
-29
lines changed

1 file changed

+8
-29
lines changed

tests/unitary/default_setup/model_deployment/test_oci_datascience_model_deployment.py

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

77
import oci
8-
import pytest
98
from unittest.mock import MagicMock, patch
109
from oci.data_science.models import (
1110
ModelDeployment,
1211
)
1312
from ads.common.oci_datascience import OCIDataScienceMixin
1413
from ads.common.oci_mixin import OCIModelMixin
15-
from ads.model.deployment.common.utils import State
1614

1715
from ads.model.service.oci_datascience_model_deployment import (
1816
ACTIVATE_WORKFLOW_STEPS,
@@ -75,7 +73,6 @@
7573
},
7674
},
7775
"model_deployment_url": "model_deployment_url",
78-
"deployment_mode": "deployment_mode",
7976
}
8077

8178

@@ -119,7 +116,7 @@ def test_activate_with_waiting(self):
119116
response.data = data
120117
mock_get.return_value = response
121118
with patch.object(
122-
OCIDataScienceModelDeployment, "_wait_for_progress_completion"
119+
OCIDataScienceModelDeployment, "_wait_for_work_request"
123120
) as mock_wait:
124121
with patch.object(
125122
OCIDataScienceModelDeployment, "sync"
@@ -131,12 +128,8 @@ def test_activate_with_waiting(self):
131128

132129
mock_activate.assert_called_with(self.mock_model_deployment.id)
133130
mock_wait.assert_called_with(
134-
State.ACTIVE.name,
135-
ACTIVATE_WORKFLOW_STEPS,
136-
[State.FAILED.name, State.INACTIVE.name],
137131
"test",
138-
State._from_str("INACTIVE"),
139-
self.mock_model_deployment.id,
132+
ACTIVATE_WORKFLOW_STEPS,
140133
1,
141134
1,
142135
)
@@ -176,7 +169,7 @@ def test_deactivate_with_waiting(self):
176169
response.data = data
177170
mock_get.return_value = response
178171
with patch.object(
179-
OCIDataScienceModelDeployment, "_wait_for_progress_completion"
172+
OCIDataScienceModelDeployment, "_wait_for_work_request"
180173
) as mock_wait:
181174
with patch.object(
182175
OCIDataScienceModelDeployment, "sync"
@@ -190,18 +183,13 @@ def test_deactivate_with_waiting(self):
190183
self.mock_model_deployment.id
191184
)
192185
mock_wait.assert_called_with(
193-
State.INACTIVE.name,
194-
DEACTIVATE_WORKFLOW_STEPS,
195-
[State.FAILED.name],
196186
"test",
197-
State._from_str("ACTIVE"),
198-
self.mock_model_deployment.id,
187+
DEACTIVATE_WORKFLOW_STEPS,
199188
1,
200189
1,
201190
)
202191
mock_sync.assert_called()
203192

204-
@pytest.mark.skip(reason="OCI SDK's support for BYOC hasn't GA yet.")
205193
def test_create(self):
206194
with patch.object(
207195
oci.data_science.DataScienceClient,
@@ -234,7 +222,6 @@ def test_create(self):
234222
mock_update_from_oci_model.assert_called()
235223
mock_sync.assert_called()
236224

237-
@pytest.mark.skip(reason="OCI SDK's support for BYOC hasn't GA yet.")
238225
def test_create_with_waiting(self):
239226
with patch.object(
240227
oci.data_science.DataScienceClient,
@@ -256,7 +243,7 @@ def test_create_with_waiting(self):
256243
)
257244
mock_to_oci_mode.return_value = oci_model_deployment
258245
with patch.object(
259-
OCIDataScienceModelDeployment, "_wait_for_progress_completion"
246+
OCIDataScienceModelDeployment, "_wait_for_work_request"
260247
) as mock_wait:
261248
with patch("json.loads") as mock_json_load:
262249
create_model_deployment_details = MagicMock()
@@ -278,12 +265,8 @@ def test_create_with_waiting(self):
278265
)
279266
mock_update_from_oci_model.assert_called()
280267
mock_wait.assert_called_with(
281-
State.ACTIVE.name,
282-
CREATE_WORKFLOW_STEPS,
283-
[State.FAILED.name, State.INACTIVE.name],
284268
"test",
285-
State._from_str("UNKNOWN"),
286-
self.mock_model_deployment.id,
269+
CREATE_WORKFLOW_STEPS,
287270
1,
288271
1,
289272
)
@@ -371,7 +354,7 @@ def test_delete_with_waiting(self):
371354
}
372355
mock_delete.return_value = response
373356
with patch.object(
374-
OCIDataScienceModelDeployment, "_wait_for_progress_completion"
357+
OCIDataScienceModelDeployment, "_wait_for_work_request"
375358
) as mock_wait:
376359
with patch.object(
377360
oci.data_science.DataScienceClient, "get_model_deployment"
@@ -390,12 +373,8 @@ def test_delete_with_waiting(self):
390373

391374
mock_delete.assert_called_with(self.mock_model_deployment.id)
392375
mock_wait.assert_called_with(
393-
State.DELETED.name,
394-
DELETE_WORKFLOW_STEPS,
395-
[State.FAILED.name, State.INACTIVE.name],
396376
"test",
397-
State._from_str("ACTIVE"),
398-
self.mock_model_deployment.id,
377+
DELETE_WORKFLOW_STEPS,
399378
1,
400379
1,
401380
)

0 commit comments

Comments
 (0)