66from ocp_resources .job import Job
77from ocp_resources .route import Route
88from model_registry .types import ArtifactState , RegisteredModelState
9- from timeout_sampler import TimeoutSampler , TimeoutExpiredError
109from tests .model_registry .async_job .constants import (
11- ASYNC_UPLOAD_IMAGE ,
1210 ASYNC_UPLOAD_JOB_NAME ,
1311)
1412from tests .model_registry .async_job .utils import (
1513 get_latest_job_pod ,
1614 pull_manifest_from_oci_registry ,
17- check_job_completion ,
1815)
1916from tests .model_registry .constants import MODEL_DICT
2017from utilities .constants import MinIo , OCIRegistry
6562class TestAsyncUploadE2E :
6663 """Test for async upload job with real MinIO, OCI registry, and Model Registry"""
6764
68- @pytest .mark .skipif (
69- ASYNC_UPLOAD_IMAGE .startswith ("PLACEHOLDER" ),
70- reason = "Downstream image not yet available - job will fail to start" ,
71- )
7265 def test_async_upload_job (
7366 self : Self ,
7467 admin_client : DynamicClient ,
@@ -82,31 +75,6 @@ def test_async_upload_job(
8275 job_pod = get_latest_job_pod (admin_client = admin_client , job = model_sync_async_job )
8376 assert job_pod .name .startswith (ASYNC_UPLOAD_JOB_NAME )
8477
85- # Verify job is created and configured correctly
86- assert model_sync_async_job .exists
87- LOGGER .info ("Job created successfully" )
88-
89- # Wait for job to complete
90- try :
91- for sample in TimeoutSampler (
92- wait_timeout = 300 , # 5 minutes
93- sleep = 10 , # Check every 10 seconds
94- func = lambda : check_job_completion (admin_client = admin_client , job = model_sync_async_job ),
95- ):
96- if sample : # Job completed successfully
97- break
98- except TimeoutExpiredError :
99- # Timeout reached - get final logs for debugging
100- LOGGER .error ("Job timed out after 300 seconds" )
101- try :
102- current_pod = get_latest_job_pod (admin_client = admin_client , job = model_sync_async_job )
103- pod_logs = current_pod .log ()
104- LOGGER .error (f"Final pod logs: { pod_logs } " )
105- except Exception as e :
106- LOGGER .error (f"Could not retrieve final pod logs: { e } " )
107-
108- pytest .fail ("Async upload job did not complete within 300 seconds" )
109-
11078 # Verify OCI registry contains the uploaded artifact
11179 registry_host = oci_registry_route .instance .spec .host
11280 registry_url = f"http://{ registry_host } "
@@ -123,18 +91,15 @@ def test_async_upload_job(
12391 # Verify the manifest has the expected structure
12492 assert "manifests" in manifest , "Manifest should contain manifests section"
12593 assert len (manifest ["manifests" ]) > 0 , "Manifest should have at least one manifest"
126-
12794 LOGGER .info (f"Manifest contains { len (manifest ['manifests' ])} layer(s)" )
12895
12996 # Verify model registry metadata was updated
13097 LOGGER .info ("Verifying model registry model and artifact" )
13198 client = model_registry_client [0 ]
13299 model = client .get_registered_model (name = MODEL_NAME )
133- LOGGER .info (f"Model: { model } " )
134100 assert model .state == RegisteredModelState .LIVE
135101
136102 model_artifact = client .get_model_artifact (name = MODEL_NAME , version = MODEL_DATA ["model_version" ])
137- LOGGER .info (f"Model artifact: { model_artifact } " )
138103
139104 # Validate model artifact attributes
140105 assert model_artifact .name == MODEL_NAME
0 commit comments