Skip to content

Use random name for RAG namespace#675

Merged
jgarciao merged 3 commits intoopendatahub-io:mainfrom
jiripetrlik:rag-random-namespace
Oct 3, 2025
Merged

Use random name for RAG namespace#675
jgarciao merged 3 commits intoopendatahub-io:mainfrom
jiripetrlik:rag-random-namespace

Conversation

@jiripetrlik
Copy link
Copy Markdown
Contributor

@jiripetrlik jiripetrlik commented Oct 3, 2025

Based on https://issues.redhat.com/browse/RHAIENG-999 it will be good to use random namespace name.

Summary by CodeRabbit

  • Tests
    • Test run identifiers are now randomized to ensure unique names per run, improving isolation and repeatability.
    • Reduces naming collisions and flakiness in parallel and CI environments.
    • Improves overall test reliability while leaving user-facing behavior, features, and performance unchanged.

@jiripetrlik jiripetrlik requested a review from a team as a code owner October 3, 2025 10:16
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 3, 2025

📝 Walkthrough

Walkthrough

Added an optional randomize_name parameter to utilities/infra.create_ns and updated a test parameter in tests/llama_stack/rag/test_rag.py to enable namespace name randomization. No other behavioral changes or public API removals introduced.

Changes

Cohort / File(s) Change summary
Infra namespace creation
utilities/infra.py
Added optional parameter randomize_name: bool = False to create_ns. When true, the function derives a base name from the provided name (or "test-namespace") and uses generate_random_name to produce a randomized namespace before creation.
RAG test parametrization
tests/llama_stack/rag/test_rag.py
Updated parametrized test data: added "randomize_name": True to the dict passed as unprivileged_model_namespace so the test requests randomized namespace names.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Use random name for RAG namespace” directly and concisely summarizes the core change of introducing randomized namespace names for the RAG tests, aligns with the added randomize_name parameter and test updates, and contains no extraneous information. It clearly communicates the primary intent to any reviewer scanning PR history without overloading with details. Therefore, it meets the criteria for clarity, specificity, and brevity.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3c997f and ca8382a.

📒 Files selected for processing (2)
  • tests/llama_stack/rag/test_rag.py (1 hunks)
  • utilities/infra.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/llama_stack/rag/test_rag.py
🧰 Additional context used
🧬 Code graph analysis (1)
utilities/infra.py (1)
utilities/general.py (1)
  • generate_random_name (314-339)
🔇 Additional comments (5)
utilities/infra.py (5)

66-66: LGTM!

The import is correct and the generate_random_name function exists in the specified module with the expected signature.


83-83: LGTM!

The optional parameter with a default value of False ensures backward compatibility for existing callers.


109-110: LGTM!

The documentation clearly describes the parameter's behavior and follows the established pattern for other configurable parameters.


122-122: LGTM!

The pytest parameter override follows the established pattern for other configurable parameters in this function.


124-127: LGTM!

The randomization logic is correct:

  • The fallback base_name = name or "test-namespace" ensures a non-empty prefix for generate_random_name.
  • The 4-character UUID suffix provides sufficient uniqueness for test namespaces.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jiripetrlik jiripetrlik requested a review from jgarciao October 3, 2025 10:16
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 3, 2025

The following are automatically added/executed:

  • PR size label.
  • Run pre-commit
  • Run tox
  • Add PR author as the PR assignee
  • Build image based on the PR

Available user actions:

  • To mark a PR as WIP, add /wip in a comment. To remove it from the PR comment /wip cancel to the PR.
  • To block merging of a PR, add /hold in a comment. To un-block merging of PR comment /hold cancel.
  • To mark a PR as approved, add /lgtm in a comment. To remove, add /lgtm cancel.
    lgtm label removed on each new commit push.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To Cherry-pick a merged PR /cherry-pick <target_branch_name> to the PR. If <target_branch_name> is valid,
    and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
  • To build and push image to quay, add /build-push-pr-image in a comment. This would create an image with tag
    pr-<pr_number> to quay repository. This image tag, however would be deleted on PR merge or close action.
Supported labels

{'/hold', '/cherry-pick', '/wip', '/build-push-pr-image', '/lgtm', '/verified'}

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/llama_stack/rag/test_rag.py (1)

21-21: Consider increasing the random suffix length for better uniqueness.

The change correctly uses generate_random_name to create a random namespace for each test run. However, with length=4, there are only 65,536 possible namespace names (16^4 hex combinations). This might lead to collisions if tests run in parallel or if namespace cleanup is delayed.

Consider using a longer suffix (e.g., length=8 for 4.3 billion combinations) to reduce collision probability:

-            {"name": generate_random_name("test-rag", length=4)},
+            {"name": generate_random_name("test-rag", length=8)},

Note: The function is called at test collection time, so all test methods in the TestLlamaStackRag class will share the same namespace name within a single test run, which appears to be the intended behavior.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8897f6a and b3c997f.

📒 Files selected for processing (1)
  • tests/llama_stack/rag/test_rag.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/llama_stack/rag/test_rag.py (1)
utilities/general.py (1)
  • generate_random_name (314-339)
🔇 Additional comments (1)
tests/llama_stack/rag/test_rag.py (1)

12-12: LGTM!

The import is correctly added and the function is used appropriately in the test parametrization.

Comment thread tests/llama_stack/rag/test_rag.py
@jiripetrlik
Copy link
Copy Markdown
Contributor Author

@jgarciao
Thank you! I've tried to address your comment.

@jgarciao jgarciao merged commit 7d9deef into opendatahub-io:main Oct 3, 2025
8 checks passed
@jgarciao
Copy link
Copy Markdown
Contributor

jgarciao commented Oct 3, 2025

/cherry-pick 2.25

rhods-ci-bot pushed a commit that referenced this pull request Oct 3, 2025
* 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>
@rhods-ci-bot
Copy link
Copy Markdown
Contributor

Cherry pick action created PR #677 successfully 🎉!
See: https://github.com/opendatahub-io/opendatahub-tests/actions/runs/18225111195

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 3, 2025

Status of building tag latest: success.
Status of pushing tag latest to image registry: success.

jiripetrlik added a commit that referenced this pull request Oct 3, 2025
* 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: Jiri Petrlik <jiripetrlik@gmail.com>
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>
mwaykole pushed a commit to mwaykole/opendatahub-tests that referenced this pull request Jan 23, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants