Skip to content

fix: fail early in forklift_pods_state when MTV operator is not installed - #355

Merged
myakove merged 5 commits into
mainfrom
fix/issue-354-fail-early-mtv-not-installed
Mar 19, 2026
Merged

myakove merged 5 commits into
mainfrom
fix/issue-354-fail-early-mtv-not-installed

Conversation

@myakove

@myakove myakove commented Mar 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add pre-check for MTV operator Subscription in forklift_pods_state fixture before the 5-minute TimeoutSampler loop. When the Subscription doesn't exist, raises MtvOperatorNotInstalledError immediately with an actionable error message
  • Extract MTV_OPERATOR_NAME constant to utilities/constants.py to eliminate hardcoded "mtv-operator" string duplication across conftest.py, utilities/must_gather.py, and utilities/utils.py
  • Fix pre-existing type annotation: controller_pod: str | None -> Pod | None

Context

Jenkins job mtv-2.12-ocp-4.21-test-release-non-gate #8 had all 35 tests across 3 child jobs wait 5 minutes each before failing with an unhelpful timeout error, because MTV was not installed on the cluster despite the deploy job reporting SUCCESS.

Closes #354

Test plan

  • Verify pre-commit passes
  • Verify forklift_pods_state raises MtvOperatorNotInstalledError immediately when MTV Subscription is missing
  • Verify normal flow still works when MTV is properly installed

Summary by CodeRabbit

  • Tests

    • Added MTV operator availability validation during test setup and improved pod readiness detection; provides a clear, actionable error when the operator Subscription is missing and logs a warning on permission issues.
  • Refactor

    • Consolidated the MTV operator identifier into a shared constant for consistent operator detection across utilities.
  • Documentation

    • Clarified docstring rules: include Args/Returns/Raises only when applicable.

…lled

- Add pre-check for MTV operator Subscription before the 5-minute
  TimeoutSampler loop
- Add MtvOperatorNotInstalledError custom exception
- Extract MTV_OPERATOR_NAME constant to utilities/constants.py
- Fix pre-existing type annotation (controller_pod: str -> Pod)

Closes #354
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Fail early when MTV operator is not installed

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add early validation for MTV operator Subscription in forklift_pods_state fixture
  - Raises MtvOperatorNotInstalledError immediately instead of timing out after 5 minutes
  - Provides actionable error message with namespace information
• Extract MTV_OPERATOR_NAME constant to eliminate string duplication
  - Centralize "mtv-operator" string in utilities/constants.py
  - Update references in conftest.py, must_gather.py, and utils.py
• Fix type annotation for controller_pod from str | None to Pod | None
Diagram
flowchart LR
  A["forklift_pods_state fixture"] -->|check MTV Subscription| B["MTV_OPERATOR_NAME constant"]
  B -->|exists?| C{Subscription found}
  C -->|No| D["MtvOperatorNotInstalledError"]
  C -->|Yes| E["Continue with pod checks"]
  D -->|actionable message| F["Fail immediately"]
  E -->|normal flow| G["Monitor pod state"]
Loading

Grey Divider

File Changes

1. conftest.py 🐞 Bug fix +14/-2

Add MTV Subscription validation and fix type annotation

• Add import for Subscription and MtvOperatorNotInstalledError
• Import MTV_OPERATOR_NAME constant from utilities
• Add pre-check in forklift_pods_state fixture to validate MTV Subscription exists before
 TimeoutSampler loop
• Fix type annotation: controller_pod: str | None → controller_pod: Pod | None
• Extract mtv_namespace to variable for reuse

conftest.py


2. exceptions/exceptions.py Error handling +16/-0

Add MtvOperatorNotInstalledError custom exception

• Add new MtvOperatorNotInstalledError exception class
• Include namespace parameter and informative error message
• Message guides users to verify MTV installation or set correct namespace

exceptions/exceptions.py


3. utilities/constants.py ⚙️ Configuration changes +1/-0

Create constants file with MTV operator name

• Create new constants file with MTV_OPERATOR_NAME constant
• Define constant as "mtv-operator" string value

utilities/constants.py


View more (2)
4. utilities/must_gather.py ✨ Enhancement +2/-1

Use MTV_OPERATOR_NAME constant in must_gather

• Import MTV_OPERATOR_NAME constant from utilities
• Replace hardcoded "mtv-operator" string with constant reference

utilities/must_gather.py


5. utilities/utils.py ✨ Enhancement +2/-1

Use MTV_OPERATOR_NAME constant in utils

• Import MTV_OPERATOR_NAME constant from utilities
• Replace hardcoded "mtv-operator" string with constant in get_mtv_version function

utilities/utils.py


Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@myakove has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 6 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 50beba1f-24c9-4da0-b1f3-484aeaabec9d

📥 Commits

Reviewing files that changed from the base of the PR and between a1e6377 and 35bee2c.

📒 Files selected for processing (1)
  • conftest.py

Walkthrough

Add an early MTV Subscription existence check to the forklift_pods_state fixture that raises MtvOperatorNotInstalledError if missing; introduce MtvOperatorNotInstalledError; centralize MTV operator name in MTV_OPERATOR_NAME; update utilities to use that constant and refine pod detection typing/namespace usage.

Changes

Cohort / File(s) Summary
Fixture: MTV pre-check
conftest.py
Added a pre-check in forklift_pods_state that attempts to instantiate ocp_resources.subscription.Subscription in py_config["mtv_namespace"]; raises MtvOperatorNotInstalledError if Subscription is missing. Adjusted pod readiness logic to use a local mtv_namespace variable and changed controller_pod typing from str | None to Pod | None.
New exception
exceptions/exceptions.py
Added MtvOperatorNotInstalledError(namespace: str) which stores the namespace and provides an error message indicating the missing MTV Subscription and suggesting --tc=mtv_namespace:<namespace>.
Constants & utilities
utilities/constants.py, utilities/must_gather.py, utilities/utils.py
Added MTV_OPERATOR_NAME = "mtv-operator" constant; updated run_must_gather() and get_mtv_version() to reference MTV_OPERATOR_NAME instead of hardcoded strings.
Docs
CLAUDE.md
Updated docstring rules: Args only if parameters exist, Returns only for non-None meaningful returns (omit for __init__), and Raises only when exceptions are actually raised. Also allowed importing kubernetes.dynamic.exceptions in rules.

Sequence Diagram(s)

sequenceDiagram
    participant Pytest as Pytest (forklift_pods_state)
    participant K8s as Kubernetes API
    participant Poller as Pod Poller (TimeoutSampler)

    Pytest->>K8s: GET Subscription in mtv_namespace (MTV_OPERATOR_NAME)
    alt Subscription not found
        K8s-->>Pytest: 404 / not found
        Pytest-->>Pytest: raise MtvOperatorNotInstalledError(namespace)
    else Subscription exists
        K8s-->>Pytest: Subscription resource
        Pytest->>Poller: start polling pods in mtv_namespace
        Poller->>K8s: GET Pods (label selector)
        K8s-->>Poller: Pod list
        alt controller pod found
            Poller-->>Pytest: controller pod running
        else timeout/no pod
            Poller-->>Pytest: raise ForkliftPodsNotRunningError
        end
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: fail early in forklift_pods_state when MTV operator is not installed' directly describes the main change: adding an early Subscription check to the forklift_pods_state fixture instead of waiting 5 minutes.
Linked Issues check ✅ Passed All objectives from issue #354 are met: Subscription pre-check added before TimeoutSampler, MtvOperatorNotInstalledError created with actionable message, MTV_OPERATOR_NAME constant extracted, type annotation fixed (str|None→Pod|None), and ForbiddenError fallback added for RBAC environments.
Out of Scope Changes check ✅ Passed Changes are well-scoped: MTV operator validation logic, new exception class, constant extraction, type fix, and documentation updates all directly support failing fast when MTV is not installed; no unrelated alterations present.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-354-fail-early-mtv-not-installed
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@qodo-code-review

qodo-code-review Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. NotFoundError not handled ☑ 🐞 Bug ⛯ Reliability
Description
forklift_pods_state only catches ForbiddenError around the new Subscription pre-check, so a
NotFoundError during that lookup can escape and fail the session with a raw exception instead of
the intended MtvOperatorNotInstalledError message. This undermines the fixture’s goal of failing
early with an actionable error in misconfiguration/missing-namespace/missing-resource scenarios.
Code

conftest.py[R1281-1294]

+    mtv_namespace: str = py_config["mtv_namespace"]
+    try:
+        mtv_subscription = Subscription(
+            client=ocp_admin_client,
+            name=MTV_OPERATOR_NAME,
+            namespace=mtv_namespace,
+        )
+        if not mtv_subscription.exists:
+            raise MtvOperatorNotInstalledError(namespace=mtv_namespace)
+    except ForbiddenError:
+        LOGGER.warning(
+            f"Insufficient RBAC permissions to check MTV Subscription in namespace '{mtv_namespace}'. "
+            "Falling back to pod-based readiness check."
+        )
Evidence
The new pre-check wraps the Subscription existence check but only handles ForbiddenError, while
the same fixture explicitly treats NotFoundError as an expected condition in the subsequent
readiness sampling loop—indicating NotFoundError can occur in this readiness path and should be
translated to the same actionable failure mode rather than surfacing as a raw dynamic-client
exception.

conftest.py[1280-1294]
conftest.py[1316-1322]
conftest.py[17-18]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`forklift_pods_state` performs a new Subscription existence pre-check and raises `MtvOperatorNotInstalledError` when the Subscription is missing, but it only catches `ForbiddenError`. If the Subscription lookup path raises `NotFoundError` (e.g., namespace missing, API/resource discovery failures, etc.), the fixture fails with a raw `NotFoundError` traceback instead of the intended actionable `MtvOperatorNotInstalledError`.
### Issue Context
This fixture is session-scoped and `autouse`, so any uncaught exception here aborts the entire test run early and should provide the most actionable failure message possible.
### Fix Focus Areas
- conftest.py[1281-1294]
### Suggested change
- Add an `except NotFoundError:` handler around the Subscription pre-check.
- In that handler, raise `MtvOperatorNotInstalledError(namespace=mtv_namespace)` (or wrap the original exception as the cause) so the error stays actionable and consistent with the fail-fast intent.
- Keep the existing `ForbiddenError` handler to preserve the RBAC fallback behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Runtime kubernetes ForbiddenError import 📘 Rule violation ⛨ Security
Description
conftest.py adds a runtime import and usage of kubernetes.dynamic.exceptions.ForbiddenError,
which violates the project rule forbidding runtime kubernetes.* usage in favor of
openshift-python-wrapper patterns. This can increase inconsistency and bypass the standardized
client/exception handling approach.
Code

conftest.py[17]

+from kubernetes.dynamic.exceptions import ForbiddenError, NotFoundError
Evidence
PR Compliance ID 9 forbids runtime kubernetes.* imports. The PR modifies conftest.py to import
ForbiddenError from kubernetes.dynamic.exceptions and uses it in a new except ForbiddenError:
block.

CLAUDE.md
conftest.py[17-17]
conftest.py[1281-1295]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`conftest.py` now imports and catches `kubernetes.dynamic.exceptions.ForbiddenError` at runtime. The compliance rules for this repo forbid runtime `kubernetes.*` imports/usages and require using approved openshift-python-wrapper patterns.
## Issue Context
The new pre-check in `forklift_pods_state` catches `ForbiddenError` to fall back when RBAC prevents checking the Subscription. Keep the fallback behavior, but implement it without importing `kubernetes.*` at runtime.
## Fix Focus Areas
- conftest.py[17-17]
- conftest.py[1281-1295]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. RBAC blocks subscription precheck 🐞 Bug ⛯ Reliability
Description
forklift_pods_state (session-autouse) now unconditionally checks the OLM Subscription and can
fail the entire test session for users/SA that don’t have permissions on
subscriptions.operators.coreos.com, even though the suite’s readiness check is otherwise
pod-based. This is a behavior change that can break the documented least-privilege RBAC setup by
introducing a new required API permission at session start.
Code

conftest.py[R1281-1288]

+    mtv_namespace: str = py_config["mtv_namespace"]
+    mtv_subscription = Subscription(
+        client=ocp_admin_client,
+        name=MTV_OPERATOR_NAME,
+        namespace=mtv_namespace,
+    )
+    if not mtv_subscription.exists:
+        raise MtvOperatorNotInstalledError(namespace=mtv_namespace)
Evidence
forklift_pods_state is pulled into a session-scoped autouse fixture, so the new
Subscription(...).exists check runs for every test run before the 5-minute pod readiness loop. The
README’s recommended least-privilege role lists MTV/core resources but does not include OLM
Subscription permissions, so this new call path can fail immediately due to missing RBAC rather
than providing the intended "MTV not installed" guidance.

conftest.py[409-415]
conftest.py[1280-1316]
README.md[89-102]
docs/plan-and-resource-reference.md[372-373]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The session-autouse `forklift_pods_state` fixture now checks an OLM `Subscription` before the existing pod-based readiness loop. This introduces a new RBAC requirement (`subscriptions.operators.coreos.com`) that is not part of the documented least-privilege role, and can cause the entire test session to fail early with an authorization error instead of running the existing readiness logic.
### Issue Context
- `forklift_pods_state` is executed for every test session via `autouse_fixtures`.
- The new code calls `Subscription(...).exists` outside the `TimeoutSampler` loop.
- The project documentation describes readiness as pod-based and documents a least-privilege role that does not mention OLM Subscription access.
### Fix Focus Areas
- conftest.py[409-415]
- conftest.py[1280-1289]
### What to change
- Wrap the `mtv_subscription.exists` access in a try/except for authorization-related API errors.
- If access is denied, either:
1) Fall back to the existing pod-based readiness loop (so least-privilege runs still work), and optionally log a warning that the fail-fast subscription check was skipped due to RBAC; or
2) Raise a dedicated, actionable error explaining the missing RBAC rule needed to read `Subscription` resources.
- (Optional but recommended) Update README least-privilege RBAC guidance to include the required OLM resources if the subscription check is intended to be mandatory.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
4. MtvOperatorNotInstalledError.__init__ docstring incomplete 📘 Rule violation ⚙ Maintainability
Description
The newly added MtvOperatorNotInstalledError.__init__ docstring includes an Args section but
omits required Returns and Raises sections. This violates the project’s standardized docstring
requirements for new functions.
Code

exceptions/exceptions.py[R13-17]

+        """Initialize MtvOperatorNotInstalledError.
+
+        Args:
+            namespace (str): The namespace where the MTV operator Subscription was expected.
+        """
Evidence
PR Compliance ID 7 requires all new functions to include docstrings with Args, Returns, and
Raises sections. The new __init__ docstring for MtvOperatorNotInstalledError contains only
Args and lacks Returns/Raises.

CLAUDE.md
exceptions/exceptions.py[13-17]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added function docstring is missing required standardized sections.
## Issue Context
`MtvOperatorNotInstalledError.__init__` includes an `Args` section but omits `Returns` and `Raises`, which are required for all new functions.
## Fix Focus Areas
- exceptions/exceptions.py[13-17]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

5. Fragile Subscription name check ☑ 🐞 Bug ⛯ Reliability
Description
forklift_pods_state now hard-fails if there is no Subscription named MTV_OPERATOR_NAME
("mtv-operator"), but the suite’s own docs validate MTV by CSV/pods rather than a fixed Subscription
*metadata.name*, so a cluster with a differently-named Subscription can now fail the whole session
despite MTV being installed.
Code

conftest.py[R1283-1289]

+        mtv_subscription = Subscription(
+            client=ocp_admin_client,
+            name=MTV_OPERATOR_NAME,
+            namespace=mtv_namespace,
+        )
+        if not mtv_subscription.exists:
+            raise MtvOperatorNotInstalledError(namespace=mtv_namespace)
Evidence
The fixture’s new pre-check requires a Subscription with name=MTV_OPERATOR_NAME and raises
immediately if it doesn’t exist. However, the repository documentation describes MTV readiness in
terms of forklift-* pods and CSV presence, not a fixed Subscription resource name. Also, previous
Subscription usage was in must-gather (best-effort, exception swallowed), whereas this fixture is
session-scoped and will now abort test runs early.

conftest.py[1281-1294]
docs/installation-and-local-setup.md[182-188]
README.md[33-44]
utilities/must_gather.py[142-184]
Best Practice: Kubernetes API conventions

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`forklift_pods_state` currently checks for a Subscription whose **metadata.name** equals `MTV_OPERATOR_NAME` (&amp;amp;amp;amp;amp;amp;amp;amp;quot;mtv-operator&amp;amp;amp;amp;amp;amp;amp;amp;quot;). Subscription names are not inherently fixed and can be chosen at install time, so this can produce a false “not installed” failure and abort the entire session even when MTV is installed.
## Issue Context
Repo docs describe MTV readiness in terms of `forklift-*` pods and/or CSV presence, not Subscription name. Must-gather’s Subscription lookup is best-effort (exceptions are caught and only logged), but this new check is session-scoped and fatal.
## Fix Focus Areas
- conftest.py[1281-1294]
## Suggested fix
- Instead of checking `Subscription(name=MTV_OPERATOR_NAME)`, **list Subscriptions in `mtv_namespace`** and treat MTV as installed if any Subscription has `spec.name == MTV_OPERATOR_NAME` (i.e., match by the operator/package identifier, not metadata.name).
- Keep the existing `ForbiddenError` fallback.
- (Optional) Consider renaming the constant to clarify intent (e.g., `MTV_PACKAGE_NAME`) if it’s meant to represent the operator package/prefix, not a Subscription object name.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@rh-bot-1

Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. Status Checks: All required status checks must pass
  3. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  4. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • solenoci

Reviewers:

  • krcmarik
  • myakove
  • solenoci
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is automatically removed on each new commit
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@myakove

myakove commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator Author

/cherry-pick v2.11 v2.10

@redhat-qe-bot2

Copy link
Copy Markdown

Cherry-pick requested for PR: fix: fail early in forklift_pods_state when MTV operator is not installed by user myakove
Adding label/s cherry-pick-v2.10 cherry-pick-v2.11 for automatic cheery-pick once the PR is merged

Comment thread exceptions/exceptions.py Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@exceptions/exceptions.py`:
- Around line 12-17: Update the docstring for the __init__ method of
MtvOperatorNotInstalledError to include Returns and Raises sections in addition
to Args: keep the existing Args entry for namespace: str, add a Returns section
that documents the return type (None) and a Raises section that documents any
exceptions this initializer may raise (e.g., ValueError or TypeError if you
validate namespace) or state "None" if it never raises; modify the __init__
docstring in the MtvOperatorNotInstalledError class accordingly to match the
repo standard.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d95dc938-8c8b-4fc1-a0b5-4de4de66cd8d

📥 Commits

Reviewing files that changed from the base of the PR and between 94c32df and f8912ec.

📒 Files selected for processing (5)
  • conftest.py
  • exceptions/exceptions.py
  • utilities/constants.py
  • utilities/must_gather.py
  • utilities/utils.py

Comment thread exceptions/exceptions.py Resolved
@qodo-code-review

qodo-code-review Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

Persistent review updated to latest commit 8fb6f22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@CLAUDE.md`:
- Line 237: Update the docstring rule to remove the contradiction by changing
the hard requirement to "Include Args, Returns, and Raises sections as
applicable" and explicitly state the two exceptions: omit Returns for __init__
methods (they always return None) and omit Raises when the function raises no
exceptions; ensure the rule references the section names "Args", "Returns", and
"Raises" and replaces any current wording that says "must" include all sections
to avoid forcing placeholder entries like "Returns: None".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 15c1a8cd-c4f7-4d6b-ad4c-f5d30798a8c1

📥 Commits

Reviewing files that changed from the base of the PR and between f8912ec and 8fb6f22.

📒 Files selected for processing (1)
  • CLAUDE.md

Comment thread CLAUDE.md Resolved
Comment thread conftest.py Resolved
@qodo-code-review

qodo-code-review Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

Persistent review updated to latest commit 35bee2c

@myakove

myakove commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator Author

/verifed
/approve

@myakove

myakove commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator Author

/verified

@myakove
myakove merged commit 7df2f17 into main Mar 19, 2026
7 checks passed
@myakove
myakove deleted the fix/issue-354-fail-early-mtv-not-installed branch March 19, 2026 12:36
redhat-qe-bot1 pushed a commit that referenced this pull request Mar 19, 2026
…lled (#355)

* fix: fail early in forklift_pods_state when MTV operator is not installed

- Add pre-check for MTV operator Subscription before the 5-minute
  TimeoutSampler loop
- Add MtvOperatorNotInstalledError custom exception
- Extract MTV_OPERATOR_NAME constant to utilities/constants.py
- Fix pre-existing type annotation (controller_pod: str -> Pod)

Closes #354

* docs: clarify docstring rule - omit Returns for __init__ and Raises when none

* fix: handle RBAC permissions gracefully in forklift_pods_state Subscription check

- Wrap Subscription.exists check in try/except ForbiddenError to fall back to
  pod-based readiness check when RBAC permissions are insufficient
- Clarify CLAUDE.md docstring rule to use "sections as applicable" wording

* docs: allow kubernetes.dynamic.exceptions imports in CLAUDE.md rules

* fix: catch NotFoundError in Subscription pre-check to provide actionable error
@redhat-qe-bot1

Copy link
Copy Markdown

Cherry-picked PR fix: fail early in forklift_pods_state when MTV operator is not installed into v2.11: #356

redhat-qe-bot1 pushed a commit that referenced this pull request Mar 19, 2026
…lled (#355)

* fix: fail early in forklift_pods_state when MTV operator is not installed

- Add pre-check for MTV operator Subscription before the 5-minute
  TimeoutSampler loop
- Add MtvOperatorNotInstalledError custom exception
- Extract MTV_OPERATOR_NAME constant to utilities/constants.py
- Fix pre-existing type annotation (controller_pod: str -> Pod)

Closes #354

* docs: clarify docstring rule - omit Returns for __init__ and Raises when none

* fix: handle RBAC permissions gracefully in forklift_pods_state Subscription check

- Wrap Subscription.exists check in try/except ForbiddenError to fall back to
  pod-based readiness check when RBAC permissions are insufficient
- Clarify CLAUDE.md docstring rule to use "sections as applicable" wording

* docs: allow kubernetes.dynamic.exceptions imports in CLAUDE.md rules

* fix: catch NotFoundError in Subscription pre-check to provide actionable error
@redhat-qe-bot1

Copy link
Copy Markdown

Cherry-picked PR fix: fail early in forklift_pods_state when MTV operator is not installed into v2.10: #357

redhat-qe-bot pushed a commit that referenced this pull request Mar 19, 2026
…lled (#355) (#356)

* fix: fail early in forklift_pods_state when MTV operator is not installed

- Add pre-check for MTV operator Subscription before the 5-minute
  TimeoutSampler loop
- Add MtvOperatorNotInstalledError custom exception
- Extract MTV_OPERATOR_NAME constant to utilities/constants.py
- Fix pre-existing type annotation (controller_pod: str -> Pod)

Closes #354

* docs: clarify docstring rule - omit Returns for __init__ and Raises when none

* fix: handle RBAC permissions gracefully in forklift_pods_state Subscription check

- Wrap Subscription.exists check in try/except ForbiddenError to fall back to
  pod-based readiness check when RBAC permissions are insufficient
- Clarify CLAUDE.md docstring rule to use "sections as applicable" wording

* docs: allow kubernetes.dynamic.exceptions imports in CLAUDE.md rules

* fix: catch NotFoundError in Subscription pre-check to provide actionable error

Co-authored-by: Meni Yakove <441263+myakove@users.noreply.github.com>
redhat-qe-bot1 pushed a commit that referenced this pull request Mar 19, 2026
…lled (#355) (#357)

* fix: fail early in forklift_pods_state when MTV operator is not installed

- Add pre-check for MTV operator Subscription before the 5-minute
  TimeoutSampler loop
- Add MtvOperatorNotInstalledError custom exception
- Extract MTV_OPERATOR_NAME constant to utilities/constants.py
- Fix pre-existing type annotation (controller_pod: str -> Pod)

Closes #354

* docs: clarify docstring rule - omit Returns for __init__ and Raises when none

* fix: handle RBAC permissions gracefully in forklift_pods_state Subscription check

- Wrap Subscription.exists check in try/except ForbiddenError to fall back to
  pod-based readiness check when RBAC permissions are insufficient
- Clarify CLAUDE.md docstring rule to use "sections as applicable" wording

* docs: allow kubernetes.dynamic.exceptions imports in CLAUDE.md rules

* fix: catch NotFoundError in Subscription pre-check to provide actionable error

Co-authored-by: Meni Yakove <441263+myakove@users.noreply.github.com>
@redhat-qe-bot1

Copy link
Copy Markdown

New container for ghcr.io/redhatqe/mtv-api-tests:latest published

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.

fix: fail early in forklift_pods_state when MTV operator is not installed

5 participants