Skip to content

NO-JIRA: test(scheduler): add pair loss recovery unit coverage#7848

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
enxebre:agarcial/scheduler-pair-recovery-tests
Mar 13, 2026
Merged

NO-JIRA: test(scheduler): add pair loss recovery unit coverage#7848
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
enxebre:agarcial/scheduler-pair-recovery-tests

Conversation

@enxebre
Copy link
Copy Markdown
Member

@enxebre enxebre commented Mar 3, 2026

Summary

  • add unit coverage for DedicatedServingComponentSchedulerAndSizer when a scheduled hosted cluster loses one node in its assigned pair
  • validate successful recovery when a same-pair replacement node is available and can be claimed/labeled
  • validate placeholder deployment creation when no same-pair replacement node is available

Test plan

  • go test ./hypershift-operator/controllers/scheduler/aws -run TestHostedClusterSchedulerAndSizer -count=1

Made with Cursor

Summary by CodeRabbit

  • Tests
    • Added test helper to simulate node-pair mappings.
    • Added scenarios verifying that a scheduled hosted cluster:
      • claims and labels an available replacement node from the same pair when one is lost, and
      • creates a placeholder deployment when no same-pair replacement exists.
    • Applied these scenarios across the scheduler/sizer test suite to ensure coverage.

@openshift-ci-robot
Copy link
Copy Markdown

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 3, 2026

Walkthrough

Adds a test helper pairConfigMap and two test cases in TestHostedClusterSchedulerAndSizer to simulate pair-label mappings: one where a scheduled hosted cluster claims a same-pair replacement node, and one where it creates a placeholder deployment when no same-pair replacement exists.

Changes

Cohort / File(s) Summary
Test Scenarios & Helper
hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go
Adds pairConfigMap helper to create ConfigMaps with pair labels. Adds two test cases: claiming a replacement node from the same pair and creating a placeholder deployment when no same-pair replacement is available.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Stable And Deterministic Test Names ❓ Inconclusive Test file could not be accessed in repository to verify test names follow stable and deterministic naming requirements. Ensure repository contains hypershift codebase and verify test titles use static strings without dynamic values like generated identifiers or runtime-specific information.
Test Structure And Quality ❓ Inconclusive The test file specified in the PR summary cannot be located in the repository despite comprehensive searches. Verify the correct repository, branch, and file path; ensure all PR changes are properly committed or accessible.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'NO-JIRA: test(scheduler): add pair loss recovery unit coverage' directly and clearly summarizes the main change: adding unit test coverage for pair loss recovery scenarios in the scheduler.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@enxebre enxebre changed the title test(scheduler): add pair loss recovery unit coverage NO-JIRA: test(scheduler): add pair loss recovery unit coverage Mar 3, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@enxebre: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

  • add unit coverage for DedicatedServingComponentSchedulerAndSizer when a scheduled hosted cluster loses one node in its assigned pair
  • validate successful recovery when a same-pair replacement node is available and can be claimed/labeled
  • validate placeholder deployment creation when no same-pair replacement node is available

Test plan

  • go test ./hypershift-operator/controllers/scheduler/aws -run TestHostedClusterSchedulerAndSizer -count=1

Made with Cursor

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from csrwng and jparrill March 3, 2026 14:48
@openshift-ci openshift-ci bot added area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-area labels Mar 3, 2026
@enxebre
Copy link
Copy Markdown
Member Author

enxebre commented Mar 3, 2026

/auto-cc

@openshift-ci openshift-ci bot requested a review from bryan-cox March 3, 2026 14:50
Copy link
Copy Markdown
Contributor

@sdminonne sdminonne left a comment

Choose a reason for hiding this comment

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

It took me a while to understand the way this is designed but it looks OK.
thanks!

@sdminonne
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 3, 2026
@openshift-ci-robot
Copy link
Copy Markdown

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks-4-21
/test e2e-aws-4-21
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre, sdminonne

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cwbotbot
Copy link
Copy Markdown

cwbotbot commented Mar 3, 2026

Test Results

e2e-aws

Failed Tests

Total failed tests: 2

  • TestAutoscaling
  • TestAutoscaling/Teardown

e2e-aks

@enxebre
Copy link
Copy Markdown
Member Author

enxebre commented Mar 4, 2026

/retest

@bryan-cox
Copy link
Copy Markdown
Member

/verified by unit tests

@enxebre
Copy link
Copy Markdown
Member Author

enxebre commented Mar 5, 2026

/retest

Add scheduler-and-sizer test cases for scheduled clusters that
lose one node in a pair, covering both successful same-pair
replacement and placeholder creation when no same-pair replacement
is available.

Made-with: Cursor
@enxebre enxebre force-pushed the agarcial/scheduler-pair-recovery-tests branch from a82d2e0 to 7c7fee2 Compare March 5, 2026 14:55
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 5, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@enxebre: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

  • add unit coverage for DedicatedServingComponentSchedulerAndSizer when a scheduled hosted cluster loses one node in its assigned pair
  • validate successful recovery when a same-pair replacement node is available and can be claimed/labeled
  • validate placeholder deployment creation when no same-pair replacement node is available

Test plan

  • go test ./hypershift-operator/controllers/scheduler/aws -run TestHostedClusterSchedulerAndSizer -count=1

Made with Cursor

Summary by CodeRabbit

  • Tests
  • Added test helper to simulate node-pair mappings.
  • Added scenarios verifying that a scheduled hosted cluster:
    • claims and labels an available replacement node from the same pair when one is lost, and
    • creates a placeholder deployment when no same-pair replacement exists.
  • Applied these scenarios across the scheduler/sizer test suite to ensure coverage.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

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)
hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go (1)

575-590: Optional: bind pairConfigMap to the exact test HC instance.

Using a separate hostedcluster() call for additionalObjects can drift from hc if fixtures evolve (name/namespace overrides). Consider deriving the ConfigMap from the same hc object per case to keep fixtures coupled.

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

In
`@hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go`
around lines 575 - 590, The test uses pairConfigMap(hostedcluster(), "id1")
which can diverge from the test case's hc fixture; update the additionalObjects
to derive the ConfigMap from the same hosted cluster instance used by the test
(e.g., call pairConfigMap(hc, "id1") or
pairConfigMap(hostedcluster(scheduledHC), "id1") depending on the case) so the
ConfigMap is bound to the exact hosted cluster under test; adjust occurrences in
the table-driven cases where pairConfigMap is created from a fresh
hostedcluster() to instead reference the case's hc variable or the same
hostedcluster(...) call used for that case.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go`:
- Around line 575-590: The test uses pairConfigMap(hostedcluster(), "id1") which
can diverge from the test case's hc fixture; update the additionalObjects to
derive the ConfigMap from the same hosted cluster instance used by the test
(e.g., call pairConfigMap(hc, "id1") or
pairConfigMap(hostedcluster(scheduledHC), "id1") depending on the case) so the
ConfigMap is bound to the exact hosted cluster under test; adjust occurrences in
the table-driven cases where pairConfigMap is created from a fresh
hostedcluster() to instead reference the case's hc variable or the same
hostedcluster(...) call used for that case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 87d42736-53be-4203-8d81-84cf1fc444b5

📥 Commits

Reviewing files that changed from the base of the PR and between a82d2e0 and 7c7fee2.

📒 Files selected for processing (1)
  • hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go

@enxebre
Copy link
Copy Markdown
Member Author

enxebre commented Mar 10, 2026

/verified by unit test @enxebre

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 10, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@enxebre: This PR has been marked as verified by unit test @enxebre.

Details

In response to this:

/verified by unit test @enxebre

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sdminonne
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 10, 2026
@openshift-ci-robot
Copy link
Copy Markdown

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks-4-21
/test e2e-aws-4-21
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@enxebre
Copy link
Copy Markdown
Member Author

enxebre commented Mar 12, 2026

/retest

@openshift-ci-robot
Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 259cead and 2 for PR HEAD 7c7fee2 in total

@openshift-ci-robot
Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD dd74079 and 1 for PR HEAD 7c7fee2 in total

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 13, 2026

@enxebre: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 3de8e22 into openshift:main Mar 13, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants