File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1919from utilities .constants import DscComponents , Timeout
2020from utilities .data_science_cluster_utils import update_components_in_dsc
2121from tests .llama_stack .constants import (
22+ LLS_OPENSHIFT_MINIMAL_VERSION ,
2223 ModelInfo ,
2324)
25+ from utilities .infra import get_openshift_version
2426
2527
2628LOGGER = get_logger (name = __name__ )
@@ -216,6 +218,19 @@ def _get_llama_stack_distribution_deployment(
216218 yield deployment
217219
218220
221+ @pytest .fixture (scope = "session" , autouse = True )
222+ def skip_llama_stack_if_not_supported_openshift_version (admin_client : DynamicClient ) -> None :
223+ """Skip llama-stack tests if OpenShift version is not supported (< 4.17) by llama-stack-operator"""
224+ version = get_openshift_version (admin_client = admin_client )
225+ if version < LLS_OPENSHIFT_MINIMAL_VERSION :
226+ message = (
227+ f"Skipping llama-stack tests, as llama-stack-operator is not supported "
228+ f"on OpenShift { version } ({ LLS_OPENSHIFT_MINIMAL_VERSION } or newer required)"
229+ )
230+ LOGGER .info (message )
231+ pytest .skip (reason = message )
232+
233+
219234@pytest .fixture (scope = "class" )
220235def unprivileged_llama_stack_distribution_deployment (
221236 unprivileged_client : DynamicClient ,
Original file line number Diff line number Diff line change 22from enum import Enum
33from typing import List , NamedTuple , TypedDict
44from llama_stack_client .types import Model
5+ from semver import VersionInfo
6+ import semver
57
68
79class LlamaStackProviders :
@@ -26,6 +28,7 @@ class ModelInfo(NamedTuple):
2628
2729
2830LLS_CORE_POD_FILTER : str = "app=llama-stack"
31+ LLS_OPENSHIFT_MINIMAL_VERSION : VersionInfo = semver .VersionInfo .parse ("4.17.0" )
2932
3033
3134class TurnExpectation (TypedDict ):
Original file line number Diff line number Diff line change 2323)
2424from ocp_resources .catalog_source import CatalogSource
2525from ocp_resources .cluster_service_version import ClusterServiceVersion
26+ from ocp_resources .cluster_version import ClusterVersion
2627from ocp_resources .config_map import ConfigMap
2728from ocp_resources .config_imageregistry_operator_openshift_io import Config
2829from ocp_resources .console_cli_download import ConsoleCLIDownload
@@ -611,6 +612,16 @@ def get_openshift_token() -> str:
611612 return run_command (command = shlex .split ("oc whoami -t" ))[1 ].strip ()
612613
613614
615+ @cache
616+ def get_openshift_version (admin_client : DynamicClient ) -> Version :
617+ """Get the OpenShift cluster version."""
618+ cluster_version = ClusterVersion (client = admin_client , name = "version" )
619+ if not cluster_version :
620+ raise MissingResourceError ("ClusterVersion not found" )
621+
622+ return Version .parse (version = str (cluster_version .instance .status .desired .version ))
623+
624+
614625def get_kserve_storage_initialize_image (client : DynamicClient ) -> str :
615626 """
616627 Get the image used to storage-initializer.
You can’t perform that action at this time.
0 commit comments