1717from ocp_resources .service import Service
1818from semver import Version
1919
20+ import utilities
2021from tests .llama_stack .constants import (
2122 HTTPS_PROXY ,
22- IS_DISCONNECTED_CLUSTER ,
2323 LLAMA_STACK_DISTRIBUTION_SECRET_DATA ,
2424 LLS_CLIENT_VERIFY_SSL ,
2525 LLS_CORE_EMBEDDING_MODEL ,
@@ -73,13 +73,20 @@ def enabled_llama_stack_operator(dsc_resource: DataScienceCluster) -> Generator[
7373 yield dsc
7474
7575
76+ @pytest .fixture (scope = "class" )
77+ def is_disconnected_cluster (admin_client : DynamicClient ) -> bool :
78+ """Whether the target cluster is disconnected (air-gapped)."""
79+ return utilities .infra .is_disconnected_cluster (client = admin_client )
80+
81+
7682@pytest .fixture (scope = "class" )
7783def llama_stack_server_config (
7884 request : FixtureRequest ,
7985 pytestconfig : pytest .Config ,
8086 distribution_name : str ,
8187 vector_io_provider_deployment_config_factory : Callable [[str ], list [dict [str , str ]]],
8288 files_provider_config_factory : Callable [[str ], list [dict [str , str ]]],
89+ is_disconnected_cluster : bool ,
8390) -> dict [str , Any ]:
8491 """
8592 Generate server configuration for LlamaStack distribution deployment and deploy vector I/O provider resources.
@@ -96,6 +103,7 @@ def llama_stack_server_config(
96103 and return their configuration environment variables
97104 files_provider_config_factory: Factory function to configure files storage providers
98105 and return their configuration environment variables
106+ is_disconnected_cluster: Whether the target cluster is disconnected (air-gapped)
99107
100108 Returns:
101109 Dict containing server configuration with the following structure:
@@ -204,7 +212,7 @@ def test_with_remote_milvus(llama_stack_server_config):
204212 env_vars .append ({"name" : "ENABLE_SENTENCE_TRANSFORMERS" , "value" : "true" })
205213 env_vars .append ({"name" : "EMBEDDING_PROVIDER" , "value" : "sentence-transformers" })
206214
207- if IS_DISCONNECTED_CLUSTER :
215+ if is_disconnected_cluster :
208216 # Workaround to fix sentence-transformer embeddings on disconnected (RHAIENG-1624)
209217 env_vars .append ({"name" : "SENTENCE_TRANSFORMERS_HOME" , "value" : "/opt/app-root/src/.cache/huggingface/hub" })
210218 env_vars .append ({"name" : "HF_HUB_OFFLINE" , "value" : "1" })
@@ -247,7 +255,7 @@ def test_with_remote_milvus(llama_stack_server_config):
247255 env_vars_vector_io = vector_io_provider_deployment_config_factory (provider_name = vector_io_provider )
248256 env_vars .extend (env_vars_vector_io )
249257
250- if IS_DISCONNECTED_CLUSTER and HTTPS_PROXY :
258+ if is_disconnected_cluster and HTTPS_PROXY :
251259 LOGGER .info (f"Setting proxy and tlsconfig configuration (https_proxy:{ HTTPS_PROXY } )" )
252260 env_vars .append ({"name" : "HTTPS_PROXY" , "value" : HTTPS_PROXY })
253261
@@ -288,7 +296,7 @@ def test_with_remote_milvus(llama_stack_server_config):
288296 server_config ["tlsConfig" ] = tls_config
289297
290298 if params .get ("llama_stack_storage_size" ):
291- if IS_DISCONNECTED_CLUSTER :
299+ if is_disconnected_cluster :
292300 LOGGER .warning ("Skipping storage_size configuration on disconnected clusters due to known bug RHAIENG-1819" )
293301 else :
294302 storage_size = params .get ("llama_stack_storage_size" )
0 commit comments