77from ocp_resources .secret import Secret
88from ocp_resources .serving_runtime import ServingRuntime
99from simple_logger .logger import get_logger
10-
1110from utilities .constants import (
1211 KServeDeploymentType ,
12+ ModelAndFormat ,
13+ ModelFormat ,
1314 ModelStoragePath ,
15+ ModelVersion ,
1416 RuntimeTemplates ,
1517)
1618from utilities .inference_utils import create_isvc
2022
2123LOGGER = get_logger (name = __name__ )
2224
25+ UPGRADE_NAMESPACE = "upgrade-model-server"
26+ S3_CONNECTION = "upgrade-connection"
27+
2328
2429@pytest .fixture (scope = "session" )
25- def model_namespace_scope_session (
30+ def namespace_fixture (
2631 pytestconfig : pytest .Config ,
2732 admin_client : DynamicClient ,
2833 teardown_resources : bool ,
2934) -> Generator [Namespace , Any , Any ]:
30- name = "upgrade-model-server"
31- ns = Namespace (client = admin_client , name = name )
35+ ns = Namespace (client = admin_client , name = UPGRADE_NAMESPACE )
3236
3337 if pytestconfig .option .post_upgrade :
3438 yield ns
@@ -37,7 +41,7 @@ def model_namespace_scope_session(
3741 else :
3842 with create_ns (
3943 admin_client = admin_client ,
40- name = name ,
44+ name = UPGRADE_NAMESPACE ,
4145 model_mesh_enabled = False ,
4246 add_dashboard_label = True ,
4347 teardown = teardown_resources ,
@@ -46,10 +50,10 @@ def model_namespace_scope_session(
4650
4751
4852@pytest .fixture (scope = "session" )
49- def models_endpoint_s3_secret_scope_session (
53+ def s3_connection_fixture (
5054 pytestconfig : pytest .Config ,
5155 admin_client : DynamicClient ,
52- model_namespace_scope_session : Namespace ,
56+ namespace_fixture : Namespace ,
5357 aws_access_key_id : str ,
5458 aws_secret_access_key : str ,
5559 models_s3_bucket_name : str ,
@@ -59,8 +63,8 @@ def models_endpoint_s3_secret_scope_session(
5963) -> Generator [Secret , Any , Any ]:
6064 secret_kwargs = {
6165 "client" : admin_client ,
62- "name" : "models-bucket-secret" ,
63- "namespace" : model_namespace_scope_session .name ,
66+ "name" : S3_CONNECTION ,
67+ "namespace" : namespace_fixture .name ,
6468 }
6569
6670 secret = Secret (** secret_kwargs )
@@ -83,16 +87,16 @@ def models_endpoint_s3_secret_scope_session(
8387
8488
8589@pytest .fixture (scope = "session" )
86- def caikit_raw_serving_runtime_scope_session (
90+ def serving_runtime_fixture (
8791 pytestconfig : pytest .Config ,
8892 admin_client : DynamicClient ,
89- model_namespace_scope_session : Namespace ,
93+ namespace_fixture : Namespace ,
9094 teardown_resources : bool ,
9195) -> Generator [ServingRuntime , Any , Any ]:
9296 runtime_kwargs = {
9397 "client" : admin_client ,
94- "name" : "caikit-raw " ,
95- "namespace" : model_namespace_scope_session .name ,
98+ "name" : "upgrade-runtime " ,
99+ "namespace" : namespace_fixture .name ,
96100 }
97101
98102 model_runtime = ServingRuntime (** runtime_kwargs )
@@ -104,26 +108,32 @@ def caikit_raw_serving_runtime_scope_session(
104108 else :
105109 with ServingRuntimeFromTemplate (
106110 ** runtime_kwargs ,
107- template_name = RuntimeTemplates .CAIKIT_STANDALONE_SERVING ,
111+ template_name = RuntimeTemplates .OVMS_KSERVE ,
108112 multi_model = False ,
109113 enable_http = True ,
110114 teardown = teardown_resources ,
115+ resources = {
116+ ModelFormat .OVMS : {
117+ "requests" : {"cpu" : "1" , "memory" : "4Gi" },
118+ "limits" : {"cpu" : "2" , "memory" : "8Gi" },
119+ }
120+ },
111121 ) as model_runtime :
112122 yield model_runtime
113123
114124
115125@pytest .fixture (scope = "session" )
116- def caikit_raw_inference_service_scope_session (
126+ def inference_service_fixture (
117127 pytestconfig : pytest .Config ,
118128 admin_client : DynamicClient ,
119- caikit_raw_serving_runtime_scope_session : ServingRuntime ,
120- models_endpoint_s3_secret_scope_session : Secret ,
129+ serving_runtime_fixture : ServingRuntime ,
130+ s3_connection_fixture : Secret ,
121131 teardown_resources : bool ,
122132) -> Generator [InferenceService , Any , Any ]:
123133 isvc_kwargs = {
124134 "client" : admin_client ,
125- "name" : caikit_raw_serving_runtime_scope_session . name ,
126- "namespace" : caikit_raw_serving_runtime_scope_session .namespace ,
135+ "name" : "upgrade-isvc" ,
136+ "namespace" : serving_runtime_fixture .namespace ,
127137 }
128138
129139 isvc = InferenceService (** isvc_kwargs )
@@ -135,11 +145,12 @@ def caikit_raw_inference_service_scope_session(
135145
136146 else :
137147 with create_isvc (
138- runtime = caikit_raw_serving_runtime_scope_session .name ,
139- model_format = caikit_raw_serving_runtime_scope_session . instance . spec . supportedModelFormats [ 0 ]. name ,
148+ runtime = serving_runtime_fixture .name ,
149+ model_format = ModelAndFormat . OPENVINO_IR ,
140150 deployment_mode = KServeDeploymentType .RAW_DEPLOYMENT ,
141- storage_key = models_endpoint_s3_secret_scope_session .name ,
142- storage_path = ModelStoragePath .EMBEDDING_MODEL ,
151+ storage_key = s3_connection_fixture .name ,
152+ storage_path = ModelStoragePath .OPENVINO_EXAMPLE_MODEL ,
153+ model_version = ModelVersion .OPSET13 ,
143154 external_route = False ,
144155 teardown = teardown_resources ,
145156 ** isvc_kwargs ,
0 commit comments