Skip to content

Commit 6266b8e

Browse files
authored
Replace dyn_client with client in all get calls (#980)
1 parent 5287612 commit 6266b8e

10 files changed

Lines changed: 12 additions & 12 deletions

File tree

tests/model_registry/image_validation/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ def resource_pods(request: FixtureRequest, admin_client: DynamicClient) -> list[
3131
namespace = request.param.get("namespace")
3232
label_selector = request.param.get("label_selector")
3333
assert namespace
34-
return list(Pod.get(namespace=namespace, label_selector=label_selector, dyn_client=admin_client))
34+
return list(Pod.get(namespace=namespace, label_selector=label_selector, client=admin_client))

tests/model_registry/model_catalog/catalog_config/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def validate_model_catalog_enabled(pod: Pod) -> bool:
2222
def validate_model_catalog_resource(
2323
kind: Any, admin_client: DynamicClient, namespace: str, expected_resource_count: int
2424
) -> None:
25-
resource = list(kind.get(namespace=namespace, label_selector="component=model-catalog", dyn_client=admin_client))
25+
resource = list(kind.get(namespace=namespace, label_selector="component=model-catalog", client=admin_client))
2626
assert resource
2727
LOGGER.info(f"Validating resource: {kind}: Found {len(resource)}")
2828
assert len(resource) == expected_resource_count, (

tests/model_registry/model_catalog/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def catalog_config_map(admin_client: DynamicClient, model_registry_namespace: st
397397
@pytest.fixture(scope="class")
398398
def model_catalog_routes(admin_client: DynamicClient, model_registry_namespace: str) -> list[Route]:
399399
return list(
400-
Route.get(namespace=model_registry_namespace, label_selector="component=model-catalog", dyn_client=admin_client)
400+
Route.get(namespace=model_registry_namespace, label_selector="component=model-catalog", client=admin_client)
401401
)
402402

403403

tests/model_registry/model_catalog/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_catalog_url_and_headers(
2222
Get model catalog URL and authentication headers from route.
2323
"""
2424
model_catalog_routes = list(
25-
Route.get(namespace=model_registry_namespace, label_selector="component=model-catalog", dyn_client=admin_client)
25+
Route.get(namespace=model_registry_namespace, label_selector="component=model-catalog", client=admin_client)
2626
)
2727
assert model_catalog_routes, f"Model catalog routes not found in namespace {model_registry_namespace}"
2828

tests/model_registry/model_registry/async_job/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_latest_job_pod(admin_client: DynamicClient, job: Job) -> Pod:
1616
"""Get the latest (most recently created) Pod created by a Job"""
1717
pods = list(
1818
Pod.get(
19-
dyn_client=admin_client,
19+
client=admin_client,
2020
namespace=job.namespace,
2121
label_selector=f"job-name={job.name}",
2222
)

tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_default_postgres_db_pod_log(
158158
f"{k}={v}" for k, v in model_registry_default_postgres_deployment_match_label.items()
159159
])
160160
LOGGER.info(label_selector)
161-
pods = list(Pod.get(dyn_client=admin_client, namespace=model_registry_namespace, label_selector=label_selector))
161+
pods = list(Pod.get(client=admin_client, namespace=model_registry_namespace, label_selector=label_selector))
162162
assert pods, (
163163
"No pods found for default postgres deployment with "
164164
f"label: {model_registry_default_postgres_deployment_match_label}"

tests/model_registry/model_registry/rest_api/test_multiple_mr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_validate_one_model_catalog_configmap(
5959
"""
6060
config_map_names: list[str] = []
6161
expected_number_config_maps: int = 2
62-
for config_map in list(ConfigMap.get(namespace=model_registry_namespace, dyn_client=admin_client)):
62+
for config_map in list(ConfigMap.get(namespace=model_registry_namespace, client=admin_client)):
6363
if config_map.name.startswith(tuple([DEFAULT_CUSTOM_MODEL_CATALOG, DEFAULT_MODEL_CATALOG_CM])):
6464
config_map_names.append(config_map.name)
6565
assert len(config_map_names) == expected_number_config_maps, (

tests/model_registry/model_registry/rest_api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,4 @@ def get_register_model_data(num_models: int) -> list[dict[str, Any]]:
265265

266266

267267
def get_mr_deployment(admin_client: DynamicClient, mr_namespace: str) -> list[Deployment]:
268-
return list(Deployment.get(dyn_client=admin_client, namespace=mr_namespace))
268+
return list(Deployment.get(client=admin_client, namespace=mr_namespace))

tests/model_registry/scc/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def get_pod_by_deployment_name(admin_client: DynamicClient, namespace: str, depl
9797
label_selector = ",".join([f"{k}={v}" for k, v in deployment_instance.spec.selector.matchLabels.items()])
9898
pods = list(
9999
Pod.get(
100-
dyn_client=admin_client,
100+
client=admin_client,
101101
namespace=namespace,
102102
label_selector=label_selector,
103103
)

tests/model_registry/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def get_mr_service_by_label(client: DynamicClient, namespace_name: str, mr_insta
6464
if svc := [
6565
svcs
6666
for svcs in Service.get(
67-
dyn_client=client,
67+
client=client,
6868
namespace=namespace_name,
6969
label_selector=f"app={mr_instance.name},component=model-registry",
7070
)
@@ -246,7 +246,7 @@ def wait_for_new_running_mr_pod(
246246
LOGGER.info("Waiting for pod to be replaced")
247247
pods = list(
248248
Pod.get(
249-
dyn_client=admin_client,
249+
client=admin_client,
250250
namespace=namespace,
251251
label_selector=MODEL_REGISTRY_POD_FILTER,
252252
)
@@ -663,7 +663,7 @@ def validate_mlmd_removal_in_model_registry_pod_log(
663663
def get_model_catalog_pod(
664664
client: DynamicClient, model_registry_namespace: str, label_selector: str = "app.kubernetes.io/name=model-catalog"
665665
) -> list[Pod]:
666-
return list(Pod.get(namespace=model_registry_namespace, label_selector=label_selector, dyn_client=client))
666+
return list(Pod.get(namespace=model_registry_namespace, label_selector=label_selector, client=client))
667667

668668

669669
def get_rest_headers(token: str) -> dict[str, str]:

0 commit comments

Comments
 (0)