Skip to content

test(maas): add MaaS API and controller component health tests#1170

Merged
dbasunag merged 10 commits intoopendatahub-io:mainfrom
SB159:feature/maas-component-health
Mar 5, 2026
Merged

test(maas): add MaaS API and controller component health tests#1170
dbasunag merged 10 commits intoopendatahub-io:mainfrom
SB159:feature/maas-component-health

Conversation

@SB159
Copy link
Copy Markdown
Contributor

@SB159 SB159 commented Mar 4, 2026

Pull Request

Summary

Adds component health tests for MaaS components.

These tests validate that MaaS components are deployed and healthy before running MaaS tests.

The following checks are added:

  • Verify modelsAsService managementState is MANAGED in the DataScienceCluster
  • Verify ModelsAsServiceReady condition is True
  • Verify maas-controller deployment is Available
  • Verify maas-controller pods are Running
  • Verify maas-api deployment is Available
  • Verify maas-api pods are Running
  • Verify MaaS CRDs exist
  • Verify MaaS subscription resources (MaaSModel, MaaSAuthPolicy, MaaSSubscription) are Ready

Related Issues

  • Fixes: N/A
  • JIRA: N/A

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 comprehensive MaaS health tests covering API and controller: management state and readiness conditions, required CRDs presence, deployment availability checks, pod readiness/health, and end-to-end subscription stack readiness for a sample model.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 4, 2026

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

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

Adds two new pytest modules introducing health checks for MaaS API and MaaS controller: DSC managementState and ModelsAsServiceReady validations, CRD existence checks, deployment availability waits, pod readiness checks, and a parameterized subscription stack readiness test.

Changes

Cohort / File(s) Summary
MaaS API Component Health Tests
tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_api_health.py
Adds TestMaaSApiComponentHealth with tests for DSC managementState, ModelsAsServiceReady condition, maas-api Deployment Available wait, and maas-api pods running/ready. Uses fixtures like DataScienceCluster, DynamicClient, admin_client, and wait_for_pods_running.
MaaS Controller Component Health Tests
tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py
Adds TestMaaSController with tests verifying ModelsAsServiceReady in DSC, presence of MaaS CRDs (maasmodels.maas.io, maasauthpolicies.maas.io, maassubscriptions.maas.io), maas-controller Deployment Available wait, controller pods running, and a parameterized readiness check for MaaSModel/MaaSAuthPolicy/MaaSSubscription resources (tinyllama_free fixtures).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 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 MaaS API and controller component health tests.
Description check ✅ Passed The description covers all required sections with substantive content: Summary of changes, Related Issues, and How it has been tested. All required information is present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% 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 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.

🧹 Nitpick comments (1)
tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py (1)

18-28: Duplicate test: identical to test_maas_condition_in_dsc in test_maas_api_health.py.

Both test classes verify the same ModelsAsServiceReady DSC condition with identical logic. Consider consolidating into a single test or creating a shared test base/mixin to avoid duplication.

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

In
`@tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py`
around lines 18 - 28, The test function test_maas_condition_in_dsc in this file
duplicates an identical test in
tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_api_health.py;
either remove this duplicate test or extract the assertion into a shared
helper/mixin (e.g., a helper named assert_models_as_service_ready_in_dsc or a
TestMixin class) and call that from both test modules, ensuring the unique check
for ModelsAsServiceReady on dsc_resource.instance.status.conditions remains
implemented once and reused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py`:
- Around line 18-28: The test function test_maas_condition_in_dsc in this file
duplicates an identical test in
tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_api_health.py;
either remove this duplicate test or extract the assertion into a shared
helper/mixin (e.g., a helper named assert_models_as_service_ready_in_dsc or a
TestMixin class) and call that from both test modules, ensuring the unique check
for ModelsAsServiceReady on dsc_resource.instance.status.conditions remains
implemented once and reused.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c770a8c7-d884-4e15-9851-c17223a5bf7a

📥 Commits

Reviewing files that changed from the base of the PR and between 39d3462 and 73975ba.

📒 Files selected for processing (2)
  • tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_api_health.py
  • tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py

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

🤖 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_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py`:
- Line 78: The test currently ignores wait_for_pods_running(...) return value
and checks all namespace pods; change the call in test_maas_controller_health.py
to assert the helper returns True (or raises on failure) and restrict the check
to only maas-controller pods by passing a label selector or using the
maas-controller deployment selector (e.g., filter by label "app=maas-controller"
or the deployment's selector) into wait_for_pods_running (or call a variant that
accepts label_selector) so the test only verifies maas-controller pod readiness
and fails when those pods are unhealthy.
- Line 95: The test currently calls request.getfixturevalue using an invalid
keyword "fixture_name"; change the call to use the correct parameter name
"argname" (i.e., replace request.getfixturevalue(fixture_name=resource_fixture)
with request.getfixturevalue(argname=resource_fixture)) so the pytest
FixtureRequest API is used correctly in test_maas_controller_health.py.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ba4c1f09-92dc-4b2d-a3cf-3f2d284a7184

📥 Commits

Reviewing files that changed from the base of the PR and between 73975ba and 4f42e4d.

📒 Files selected for processing (2)
  • tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_api_health.py
  • tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_api_health.py

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.

♻️ Duplicate comments (1)
tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py (1)

77-78: ⚠️ Potential issue | 🟠 Major

Pod health check is still too broad and not asserted.

On Line 78, the call result is not asserted, and the helper evaluates all namespace pods rather than only maas-controller pods. This can mask controller issues or fail due to unrelated workloads.

Suggested fix
-        wait_for_pods_running(admin_client=admin_client, namespace_name=applications_namespace)
+        assert wait_for_pods_running(
+            admin_client=admin_client,
+            namespace_name=applications_namespace,
+        ), f"Pods did not reach Running/Completed in namespace {applications_namespace}"

Please also scope this check to maas-controller pods (e.g., selector-based helper) so the test matches its name and intent.

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

In
`@tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py`
around lines 77 - 78, The test currently logs and calls
wait_for_pods_running(admin_client=admin_client,
namespace_name=applications_namespace) without asserting its result and it
checks all pods in the namespace; change it to target only maas-controller pods
using a selector (e.g., pass a label_selector or use a selector-aware helper)
and assert the helper returns success: replace the generic call to
wait_for_pods_running with the selector-scoped variant (or add
label_selector="app=maas-controller") using admin_client and
applications_namespace, then add an assertion that the call indicates pods are
running (e.g., assert truthy/True) so failures are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py`:
- Around line 77-78: The test currently logs and calls
wait_for_pods_running(admin_client=admin_client,
namespace_name=applications_namespace) without asserting its result and it
checks all pods in the namespace; change it to target only maas-controller pods
using a selector (e.g., pass a label_selector or use a selector-aware helper)
and assert the helper returns success: replace the generic call to
wait_for_pods_running with the selector-scoped variant (or add
label_selector="app=maas-controller") using admin_client and
applications_namespace, then add an assertion that the call indicates pods are
running (e.g., assert truthy/True) so failures are caught.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 92c07c1b-4cea-4be8-8479-0f91e617e81a

📥 Commits

Reviewing files that changed from the base of the PR and between 4f42e4d and 32fef2e.

📒 Files selected for processing (1)
  • tests/model_serving/model_server/maas_billing/maas_subscription/component_health/test_maas_controller_health.py

@SB159 SB159 requested a review from dbasunag March 5, 2026 02:23
@dbasunag dbasunag enabled auto-merge (squash) March 5, 2026 19:43
@dbasunag dbasunag merged commit d800fbd into opendatahub-io:main Mar 5, 2026
8 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

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.

4 participants