44import pytest
55from kubernetes .dynamic import DynamicClient
66from ocp_resources .job import Job
7- from ocp_resources .route import Route
87from model_registry .types import ArtifactState , RegisteredModelState
98from tests .model_registry .async_job .constants import (
109 ASYNC_UPLOAD_JOB_NAME ,
6059 indirect = True ,
6160)
6261class TestAsyncUploadE2E :
63- """Test for async upload job with real MinIO, OCI registry, and Model Registry"""
62+ """RHOAIENG-29344: Test for async upload job with real MinIO, OCI registry, and Model Registry"""
6463
65- def test_async_upload_job (
64+ @pytest .mark .dependency (name = "job_creation_and_pod_spawning" )
65+ def test_job_creation_and_pod_spawning (
6666 self : Self ,
6767 admin_client : DynamicClient ,
6868 model_sync_async_job : Job ,
69- model_registry_client : list [ModelRegistryClient ],
70- oci_registry_route : Route ,
7169 ) -> None :
7270 """
73- RHOAIENG-29344: Test for async upload job execution using model from KSERVE_MINIO_IMAGE
74- Steps:
75- Create a model from KSERVE_MINIO_IMAGE
76- Create a job to upload the model to OCI registry
77- Verify the job completed successfully
78- Verify the model is uploaded to OCI registry
79- Verify the model is registered in model registry
71+ Verify job creation and pod spawning
8072 """
81- LOGGER .info ("Starting async upload job test with KSERVE_MINIO_IMAGE" )
73+ LOGGER .info ("Verifying job creation and pod spawning" )
74+
8275 # Wait for job to create a pod
8376 job_pod = get_latest_job_pod (admin_client = admin_client , job = model_sync_async_job )
8477 assert job_pod .name .startswith (ASYNC_UPLOAD_JOB_NAME )
8578
86- # Verify OCI registry contains the uploaded artifact
87- registry_host = oci_registry_route .instance .spec .host
88- registry_url = f"http://{ registry_host } "
79+ @pytest .mark .dependency (name = "oci_registry_verification" , depends = ["job_creation_and_pod_spawning" ])
80+ def test_oci_registry_verification (
81+ self : Self ,
82+ oci_registry_host : str ,
83+ ) -> None :
84+ """
85+ Verify OCI registry upload
86+ - Model manifest exists in OCI registry
87+ - Manifest has correct structure and layers
88+ """
89+ LOGGER .info ("Verifying OCI registry upload" )
90+
91+ registry_url = f"http://{ oci_registry_host } "
8992
9093 LOGGER .info (f"Verifying artifact in OCI registry: { registry_url } /v2/{ REPO_NAME } /manifests/{ TAG } " )
9194
@@ -101,8 +104,20 @@ def test_async_upload_job(
101104 assert len (manifest ["manifests" ]) > 0 , "Manifest should have at least one manifest"
102105 LOGGER .info (f"Manifest contains { len (manifest ['manifests' ])} layer(s)" )
103106
104- # Verify model registry metadata was updated
107+ @pytest .mark .dependency (name = "model_registry_verification" , depends = ["oci_registry_verification" ])
108+ def test_model_registry_verification (
109+ self : Self ,
110+ model_registry_client : list [ModelRegistryClient ],
111+ oci_registry_host : str ,
112+ ) -> None :
113+ """
114+ Verify model registration
115+ - Model is registered in model registry
116+ - Model artifact has correct attributes
117+ """
105118 LOGGER .info ("Verifying model registry model and artifact" )
119+
120+ # Verify model registry metadata was updated
106121 client = model_registry_client [0 ]
107122 model = client .get_registered_model (name = MODEL_NAME )
108123 assert model .state == RegisteredModelState .LIVE
@@ -112,7 +127,7 @@ def test_async_upload_job(
112127 # Validate model artifact attributes
113128 assert model_artifact .name == MODEL_NAME
114129 assert model_artifact .state == ArtifactState .LIVE
115- assert model_artifact .uri == f"oci://{ registry_host } /{ REPO_NAME } "
130+ assert model_artifact .uri == f"oci://{ oci_registry_host } /{ REPO_NAME } "
116131 assert model_artifact .storage_key == MODEL_DATA ["model_storage_key" ]
117132 assert model_artifact .storage_path == MODEL_DATA ["model_storage_path" ]
118133
0 commit comments