Skip to content

feat(evalhub): add EvalHub service health check tests#1145

Merged
sheltoncyril merged 6 commits intoopendatahub-io:mainfrom
ruivieira:evalhub
Feb 26, 2026
Merged

feat(evalhub): add EvalHub service health check tests#1145
sheltoncyril merged 6 commits intoopendatahub-io:mainfrom
ruivieira:evalhub

Conversation

@ruivieira
Copy link
Copy Markdown
Member

@ruivieira ruivieira commented Feb 25, 2026

Summary

Add initial test coverage for the EvalHub service, including:

  • Health endpoint smoke test via kube-rbac-proxy
  • EvalHub CR, Deployment, Route, and CA bundle fixtures
  • EvalHub resource wrapper in utilities/resources/

Related Issues

How it has been tested

  • Locally
  • Jenkins

Additional Requirements

  • If this PR introduces a new test image, did you create a PR to mirror it in disconnected environment?
  • If this PR introduces new marker(s)/adds a new component, was relevant ticket created to update relevant Jenkins job?

Summary by CodeRabbit

  • Tests

    • Added a health check test for the EvalHub service to verify endpoint health and readiness.
  • Chores

    • Added pytest fixtures to manage EvalHub lifecycle in tests (CR, deployment, route, TLS bundle).
    • Added configuration constants for EvalHub service and CRD metadata.
    • Added utilities to validate EvalHub health over HTTPS.
    • Added a resource wrapper for EvalHub custom resources.

@github-actions
Copy link
Copy Markdown

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

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Adds test infrastructure and utilities for EvalHub: new pytest fixtures to manage EvalHub CR lifecycle, constants and a health-check utility, a health test, and a NamespacedResource wrapper class for the EvalHub custom resource.

Changes

Cohort / File(s) Summary
EvalHub Test Fixtures & Constants
tests/model_explainability/evalhub/conftest.py, tests/model_explainability/evalhub/constants.py
Adds pytest fixtures evalhub_cr, evalhub_deployment, evalhub_route, evalhub_ca_bundle_file to create/wait for CR, Deployment, Route, and CA bundle; introduces EvalHub-related constants (service, ports, paths, CRD metadata).
EvalHub Health Tests & Utils
tests/model_explainability/evalhub/test_evalhub_health.py, tests/model_explainability/evalhub/utils.py
Adds TestEvalHubHealth.test_evalhub_health_endpoint and validate_evalhub_health function which performs an HTTPS GET to the EvalHub health endpoint with auth and CA bundle verification and asserts expected JSON fields/status.
EvalHub Resource Wrapper
utilities/resources/evalhub.py
Adds EvalHub class extending NamespacedResource with API group set to TRUSTYAI_OPENDATAHUB_IO, optional env and replicas in constructor, and to_dict override injecting spec fields when provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding EvalHub service health check tests, which aligns with the core additions of test fixtures, health check test, and resource wrapper.
Description check ✅ Passed The description follows the repository template with all required sections: Summary, Related Issues, How it has been tested, and Additional Requirements. It provides clear, actionable information about the changes.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

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: 1

🧹 Nitpick comments (1)
utilities/resources/evalhub.py (1)

3-6: Avoid utility-layer imports from tests.* modules.

At Line 3, utilities/resources/evalhub.py depends on tests.model_explainability.evalhub.constants, which creates a reversed module boundary. Please move shared EvalHub CR metadata to a non-test shared module and import from there in both places.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@utilities/resources/evalhub.py` around lines 3 - 6, The file
utilities/resources/evalhub.py must not import from
tests.model_explainability.evalhub.constants; extract the shared CR metadata
constants (EVALHUB_KIND, EVALHUB_PLURAL) into a new non-test shared module
(e.g., a module named evalhub_constants or shared.evalhub_constants) and update
both utilities/resources/evalhub.py and
tests.model_explainability.evalhub.constants to import EVALHUB_KIND and
EVALHUB_PLURAL from that new shared module instead of from tests.* so the
utility layer no longer depends on test code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/model_explainability/evalhub/conftest.py`:
- Around line 64-69: The fixture evalhub_ca_bundle_file may return an empty path
from create_ca_bundle_file(admin_client, ca_type="openshift"), causing later TLS
checks to fail with opaque errors; update the evalhub_ca_bundle_file fixture to
immediately fail-fast by asserting the returned CA bundle path is non-empty and
the file exists (e.g., check truthiness and os.path.exists/Path.exists on the
returned value) so failures point to the real missing OpenShift CA bundle;
reference create_ca_bundle_file and admin_client when adding these assertions.

---

Nitpick comments:
In `@utilities/resources/evalhub.py`:
- Around line 3-6: The file utilities/resources/evalhub.py must not import from
tests.model_explainability.evalhub.constants; extract the shared CR metadata
constants (EVALHUB_KIND, EVALHUB_PLURAL) into a new non-test shared module
(e.g., a module named evalhub_constants or shared.evalhub_constants) and update
both utilities/resources/evalhub.py and
tests.model_explainability.evalhub.constants to import EVALHUB_KIND and
EVALHUB_PLURAL from that new shared module instead of from tests.* so the
utility layer no longer depends on test code.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 2b3a900 and 103d085.

📒 Files selected for processing (6)
  • tests/model_explainability/evalhub/__init__.py
  • tests/model_explainability/evalhub/conftest.py
  • tests/model_explainability/evalhub/constants.py
  • tests/model_explainability/evalhub/test_evalhub_health.py
  • tests/model_explainability/evalhub/utils.py
  • utilities/resources/evalhub.py

Comment thread tests/model_explainability/evalhub/conftest.py
dbasunag
dbasunag previously approved these changes Feb 25, 2026
Copy link
Copy Markdown
Collaborator

@dbasunag dbasunag left a comment

Choose a reason for hiding this comment

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

Resource can be generated in a follow up PR too. Just let me know what you need from my side.

Comment thread utilities/resources/evalhub.py Outdated
Comment thread utilities/resources/evalhub.py
@kpunwatk
Copy link
Copy Markdown
Contributor

Thanks for the PR, @ruivieira! This looks great—I've just left one small comment.
FYI, Before we merge any PR, we ensure run the tests locally and added the /verified label so we know it’s safe to go.

@rhods-ci-bot rhods-ci-bot added the Verified Verified pr in Jenkins label Feb 25, 2026
@ruivieira
Copy link
Copy Markdown
Member Author

Thanks @dbasunag @kpunwatk the EvalHub resource is now generated from the CRD too.

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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@utilities/resources/evalhub.py`:
- Around line 38-40: The code currently unconditionally overwrites
self.res["spec"] with an empty dict when neither self.kind_dict nor
self.yaml_file are present, which can drop existing spec fields; change this to
non-destructive initialization (e.g., use self.res.setdefault("spec", {}) or
guard with if "spec" not in self.res: self.res["spec"] = {}) so existing spec
content is preserved, then assign _spec = self.res["spec"] as before in the
block that references _spec.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 103d085 and 9bdae4c.

📒 Files selected for processing (1)
  • utilities/resources/evalhub.py

Comment thread utilities/resources/evalhub.py
Copy link
Copy Markdown
Contributor

@sheltoncyril sheltoncyril left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Copy Markdown
Contributor

@sheltoncyril sheltoncyril left a comment

Choose a reason for hiding this comment

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

/lgtm

Comment thread utilities/resources/evalhub.py
@sheltoncyril sheltoncyril merged commit 8a28c9b into opendatahub-io:main Feb 26, 2026
11 checks passed
@github-actions
Copy link
Copy Markdown

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

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.

5 participants