Skip to content

Commit f4429e5

Browse files
jiripetrlikpre-commit-ci[bot]jgarciao
committed
Use random name for RAG namespace (#675)
* Use random name for RAG namespace * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jorge <jgarciao@users.noreply.github.com>
1 parent 8d2c467 commit f4429e5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/llama_stack/rag/test_rag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"unprivileged_model_namespace, llama_stack_server_config",
1818
[
1919
pytest.param(
20-
{"name": "test-llamastack-rag"},
20+
{"name": "test-llamastack-rag", "randomize_name": True},
2121
{"llama_stack_storage_size": "2Gi"},
2222
),
2323
],

utilities/infra.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
from timeout_sampler import TimeoutExpiredError, TimeoutSampler, TimeoutWatch, retry
6464
import utilities.general
6565
from ocp_resources.utils.constants import DEFAULT_CLUSTER_RETRY_EXCEPTIONS
66+
from utilities.general import generate_random_name
6667

6768
LOGGER = get_logger(name=__name__)
6869

@@ -79,6 +80,7 @@ def create_ns(
7980
model_mesh_enabled: bool = False,
8081
add_dashboard_label: bool = False,
8182
add_kueue_label: bool = False,
83+
randomize_name: bool = False,
8284
pytest_request: FixtureRequest | None = None,
8385
) -> Generator[Namespace | Project, Any, Any]:
8486
"""
@@ -104,6 +106,8 @@ def create_ns(
104106
add_dashboard_label (bool): if True, dashboard label will be added to namespace
105107
Can be overwritten by `request.param["add-dashboard-label"]`
106108
pytest_request (FixtureRequest): pytest request
109+
randomize_name (bool): if True, randomize the namespace name.
110+
Can be overwritten by `request.param["randomize_name"]`
107111
108112
Yields:
109113
Namespace | Project: namespace or project
@@ -115,6 +119,12 @@ def create_ns(
115119
model_mesh_enabled = pytest_request.param.get("modelmesh-enabled", model_mesh_enabled)
116120
add_dashboard_label = pytest_request.param.get("add-dashboard-label", add_dashboard_label)
117121
add_kueue_label = pytest_request.param.get("add-kueue-label", add_kueue_label)
122+
randomize_name = pytest_request.param.get("randomize_name", randomize_name)
123+
124+
# Handle randomization
125+
base_name = name or "test-namespace"
126+
if randomize_name:
127+
name = generate_random_name(prefix=base_name, length=4)
118128

119129
namespace_kwargs = {
120130
"name": name,

0 commit comments

Comments
 (0)