1515from ocp_resources .resource import ResourceEditor
1616from pytest_testconfig import py_config
1717
18+ from tests .model_explainability .constants import MINIO_PORT , MINIO
19+ from tests .model_explainability .lm_eval .utils import MINIOADMIN
1820from utilities .constants import Labels , Timeout , Annotations , Protocols
1921
2022VLLM_EMULATOR : str = "vllm-emulator"
2123VLLM_EMULATOR_PORT : int = 8000
2224LMEVALJOB_NAME : str = "lmeval-test-job"
2325
2426
25- @pytest .fixture (scope = "function" )
26- def lmevaljob_hf_pod (admin_client : DynamicClient , lmevaljob_hf : LMEvalJob ) -> Generator [Pod , Any , Any ]:
27- lmeval_pod = Pod (
28- client = admin_client ,
29- namespace = lmevaljob_hf .namespace ,
30- name = lmevaljob_hf .name ,
31- )
32-
33- # TODO: Check if we can rely on LMEvalJob instead of pod
34- lmeval_pod .wait (timeout = Timeout .TIMEOUT_2MIN )
35-
36- yield lmeval_pod
37-
38-
3927@pytest .fixture (scope = "function" )
4028def lmevaljob_hf (
4129 admin_client : DynamicClient , model_namespace : Namespace , patched_trustyai_operator_configmap_allow_online : ConfigMap
@@ -108,22 +96,6 @@ def lmevaljob_local_offline(
10896 yield job
10997
11098
111- @pytest .fixture (scope = "function" )
112- def lmevaljob_vllm_emulator_pod (
113- admin_client : DynamicClient , lmevaljob_vllm_emulator : LMEvalJob
114- ) -> Generator [Pod , Any , Any ]:
115- lmeval_pod = Pod (
116- client = admin_client ,
117- namespace = lmevaljob_vllm_emulator .namespace ,
118- name = lmevaljob_vllm_emulator .name ,
119- )
120-
121- # TODO: Check if we can rely on LMEvalJob instead of pod
122- lmeval_pod .wait (timeout = Timeout .TIMEOUT_2MIN )
123-
124- yield lmeval_pod
125-
126-
12799@pytest .fixture (scope = "function" )
128100def lmevaljob_vllm_emulator (
129101 admin_client : DynamicClient ,
@@ -316,12 +288,8 @@ def lmeval_minio_pvc(
316288) -> Generator [PersistentVolumeClaim , Any , Any ]:
317289 with PersistentVolumeClaim (
318290 client = admin_client ,
319- name = "minio -pvc" ,
291+ name = f" { MINIO } -pvc" ,
320292 namespace = model_namespace .name ,
321- annotations = {
322- "helm.sh/hook" : "pre-install" ,
323- "helm.sh/hook-weight" : "0" ,
324- },
325293 accessmodes = PersistentVolumeClaim .AccessMode .RWO ,
326294 size = "10Gi" ,
327295 ) as pvc :
@@ -334,28 +302,25 @@ def lmeval_minio_deployment(
334302) -> Generator [Deployment , Any , Any ]:
335303 with Deployment (
336304 client = admin_client ,
337- name = "minio" ,
305+ name = MINIO ,
338306 namespace = model_namespace .name ,
339- annotations = {
340- "helm.sh/hook" : "pre-install" ,
341- "helm.sh/hook-weight" : "0" ,
342- },
343307 replicas = 1 ,
344- selector = {"matchLabels" : {"app" : "minio" }},
308+ selector = {"matchLabels" : {"app" : MINIO }},
345309 template = {
346- "metadata" : {"labels" : {"app" : "minio" }},
310+ "metadata" : {"labels" : {"app" : MINIO }},
347311 "spec" : {
348- "volumes" : [{"name" : "minio-storage" , "persistentVolumeClaim" : {"claimName" : "minio-pvc" }}],
312+ "volumes" : [{"name" : "minio-storage" , "persistentVolumeClaim" : {"claimName" : lmeval_minio_pvc . name }}],
349313 "containers" : [
350314 {
351- "name" : "minio" ,
352- "image" : "quay.io/minio/minio:latest" ,
315+ "name" : MINIO ,
316+ "image" : "quay.io/minio/minio"
317+ "@sha256:46b3009bf7041eefbd90bd0d2b38c6ddc24d20a35d609551a1802c558c1c958f" ,
353318 "args" : ["server" , "/data" , "--console-address" , ":9001" ],
354319 "env" : [
355- {"name" : "MINIO_ROOT_USER" , "value" : "minioadmin" },
356- {"name" : "MINIO_ROOT_PASSWORD" , "value" : "minioadmin" },
320+ {"name" : "MINIO_ROOT_USER" , "value" : MINIOADMIN },
321+ {"name" : "MINIO_ROOT_PASSWORD" , "value" : MINIOADMIN },
357322 ],
358- "ports" : [{"containerPort" : 9000 }, {"containerPort" : 9001 }],
323+ "ports" : [{"containerPort" : MINIO_PORT }, {"containerPort" : 9001 }],
359324 "volumeMounts" : [{"name" : "minio-storage" , "mountPath" : "/data" }],
360325 }
361326 ],
@@ -381,7 +346,8 @@ def lmeval_minio_copy_pod(
381346 init_containers = [
382347 {
383348 "name" : "copy-data" ,
384- "image" : "quay.io/ruimvieira/lmeval-assets-flan-arceasy:latest" ,
349+ "image" : "quay.io/trustyai_testing/lmeval-assets-flan-arceasy"
350+ "@sha256:11cc9c2f38ac9cc26c4fab1a01a8c02db81c8f4801b5d2b2b90f90f91b97ac98" ,
385351 "command" : ["/bin/sh" , "-c" ],
386352 "args" : ["cp -r /mnt/data /shared" ],
387353 "volumeMounts" : [{"name" : "shared-data" , "mountPath" : "/shared" }],
@@ -390,10 +356,10 @@ def lmeval_minio_copy_pod(
390356 containers = [
391357 {
392358 "name" : "minio-uploader" ,
393- "image" : "quay.io/minio/mc:latest " ,
359+ "image" : "quay.io/minio/mc@sha256:470f5546b596e16c7816b9c3fa7a78ce4076bb73c2c73f7faeec0c8043923123 " ,
394360 "command" : ["/bin/sh" , "-c" ],
395361 "args" : [
396- "mc alias set myminio http://minio:9000 minioadmin minioadmin &&\n "
362+ f "mc alias set myminio http://{ minio_service . name } : { MINIO_PORT } { MINIOADMIN } { MINIOADMIN } &&\n "
397363 "mc mb --ignore-existing myminio/models &&\n "
398364 "mc cp --recursive /shared/data/ myminio/models"
399365 ],
@@ -411,6 +377,7 @@ def lmevaljob_s3_offline(
411377 admin_client : DynamicClient ,
412378 model_namespace : Namespace ,
413379 lmeval_minio_deployment : Deployment ,
380+ minio_service : Service ,
414381 lmeval_minio_copy_pod : Pod ,
415382 minio_data_connection : Secret ,
416383) -> Generator [LMEvalJob , Any , Any ]:
0 commit comments