5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
6
7
7
import oci
8
- import pytest
9
8
from unittest .mock import MagicMock , patch
10
9
from oci .data_science .models import (
11
10
ModelDeployment ,
12
11
)
13
12
from ads .common .oci_datascience import OCIDataScienceMixin
14
13
from ads .common .oci_mixin import OCIModelMixin
15
- from ads .model .deployment .common .utils import State
16
14
17
15
from ads .model .service .oci_datascience_model_deployment import (
18
16
ACTIVATE_WORKFLOW_STEPS ,
75
73
},
76
74
},
77
75
"model_deployment_url" : "model_deployment_url" ,
78
- "deployment_mode" : "deployment_mode" ,
79
76
}
80
77
81
78
@@ -119,7 +116,7 @@ def test_activate_with_waiting(self):
119
116
response .data = data
120
117
mock_get .return_value = response
121
118
with patch .object (
122
- OCIDataScienceModelDeployment , "_wait_for_progress_completion "
119
+ OCIDataScienceModelDeployment , "_wait_for_work_request "
123
120
) as mock_wait :
124
121
with patch .object (
125
122
OCIDataScienceModelDeployment , "sync"
@@ -131,12 +128,8 @@ def test_activate_with_waiting(self):
131
128
132
129
mock_activate .assert_called_with (self .mock_model_deployment .id )
133
130
mock_wait .assert_called_with (
134
- State .ACTIVE .name ,
135
- ACTIVATE_WORKFLOW_STEPS ,
136
- [State .FAILED .name , State .INACTIVE .name ],
137
131
"test" ,
138
- State ._from_str ("INACTIVE" ),
139
- self .mock_model_deployment .id ,
132
+ ACTIVATE_WORKFLOW_STEPS ,
140
133
1 ,
141
134
1 ,
142
135
)
@@ -176,7 +169,7 @@ def test_deactivate_with_waiting(self):
176
169
response .data = data
177
170
mock_get .return_value = response
178
171
with patch .object (
179
- OCIDataScienceModelDeployment , "_wait_for_progress_completion "
172
+ OCIDataScienceModelDeployment , "_wait_for_work_request "
180
173
) as mock_wait :
181
174
with patch .object (
182
175
OCIDataScienceModelDeployment , "sync"
@@ -190,18 +183,13 @@ def test_deactivate_with_waiting(self):
190
183
self .mock_model_deployment .id
191
184
)
192
185
mock_wait .assert_called_with (
193
- State .INACTIVE .name ,
194
- DEACTIVATE_WORKFLOW_STEPS ,
195
- [State .FAILED .name ],
196
186
"test" ,
197
- State ._from_str ("ACTIVE" ),
198
- self .mock_model_deployment .id ,
187
+ DEACTIVATE_WORKFLOW_STEPS ,
199
188
1 ,
200
189
1 ,
201
190
)
202
191
mock_sync .assert_called ()
203
192
204
- @pytest .mark .skip (reason = "OCI SDK's support for BYOC hasn't GA yet." )
205
193
def test_create (self ):
206
194
with patch .object (
207
195
oci .data_science .DataScienceClient ,
@@ -234,7 +222,6 @@ def test_create(self):
234
222
mock_update_from_oci_model .assert_called ()
235
223
mock_sync .assert_called ()
236
224
237
- @pytest .mark .skip (reason = "OCI SDK's support for BYOC hasn't GA yet." )
238
225
def test_create_with_waiting (self ):
239
226
with patch .object (
240
227
oci .data_science .DataScienceClient ,
@@ -256,7 +243,7 @@ def test_create_with_waiting(self):
256
243
)
257
244
mock_to_oci_mode .return_value = oci_model_deployment
258
245
with patch .object (
259
- OCIDataScienceModelDeployment , "_wait_for_progress_completion "
246
+ OCIDataScienceModelDeployment , "_wait_for_work_request "
260
247
) as mock_wait :
261
248
with patch ("json.loads" ) as mock_json_load :
262
249
create_model_deployment_details = MagicMock ()
@@ -278,12 +265,8 @@ def test_create_with_waiting(self):
278
265
)
279
266
mock_update_from_oci_model .assert_called ()
280
267
mock_wait .assert_called_with (
281
- State .ACTIVE .name ,
282
- CREATE_WORKFLOW_STEPS ,
283
- [State .FAILED .name , State .INACTIVE .name ],
284
268
"test" ,
285
- State ._from_str ("UNKNOWN" ),
286
- self .mock_model_deployment .id ,
269
+ CREATE_WORKFLOW_STEPS ,
287
270
1 ,
288
271
1 ,
289
272
)
@@ -371,7 +354,7 @@ def test_delete_with_waiting(self):
371
354
}
372
355
mock_delete .return_value = response
373
356
with patch .object (
374
- OCIDataScienceModelDeployment , "_wait_for_progress_completion "
357
+ OCIDataScienceModelDeployment , "_wait_for_work_request "
375
358
) as mock_wait :
376
359
with patch .object (
377
360
oci .data_science .DataScienceClient , "get_model_deployment"
@@ -390,12 +373,8 @@ def test_delete_with_waiting(self):
390
373
391
374
mock_delete .assert_called_with (self .mock_model_deployment .id )
392
375
mock_wait .assert_called_with (
393
- State .DELETED .name ,
394
- DELETE_WORKFLOW_STEPS ,
395
- [State .FAILED .name , State .INACTIVE .name ],
396
376
"test" ,
397
- State ._from_str ("ACTIVE" ),
398
- self .mock_model_deployment .id ,
377
+ DELETE_WORKFLOW_STEPS ,
399
378
1 ,
400
379
1 ,
401
380
)
0 commit comments