← Back to Pull requests

test(dqo): clean up handoff tests #19997

Open
unknown opened this pull request with 428 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 30, 2026 13:06 UTC
Author

What type of PR is this?

/kind cleanup
/area testing

What this PR does / why we need it?

Refactors the DQO handoff regression coverage requested in the review of #18594.

  • Move distribution handoffs into the existing named map table and reuse its DQO and effective-quota comparisons, including expectations before and after a failed ownership lookup is retried.

  • Keep ancestry coverage in named tables and replace reference and queue factories with testing wrappers.

  • Inline the integration fixtures, creates, moves and checks while preserving watch-driven execution, quota assertions and all 17 cleanup registrations.
  • Fixes #19406

    Useful notes for your reviewer

    The SparkApplication and TrainJob test changes update name reads to Obj().Name, keeping them compatible with the new ClusterQueueWrapper.Name(...) method.

    | Behavior | Level | Command and result | Not run and why |
    |---|---|---|---|
    | Distribution handoffs, foreign owners, ancestry edge cases and lookup-error recovery | unit | go test -race -p 2 ./pkg/controller/core/dqo/... ./pkg/util/testing/v1alpha1 ./pkg/util/testing/v1beta2 -count=1 — passed | — |
    | Existing queue-wrapper callers | unit | go test -race -p 2 ./pkg/controller/jobs/sparkapplication ./pkg/controller/jobs/trainjob -run '^TestDefault$' -count=1 — passed | — |
    | DQO integration coverage | integration | go test -p 2 ./test/integration/singlecluster/controller/dynamicquotaorchestrator -run TestAPIs -count=1 -v — all 25 specs passed | — |
    | Watch-driven handoffs and cleanup across repeated runs | integration | Ten separate focused runs with -ginkgo.focus='DynamicQuotaOrchestrator subtree handoff' -ginkgo.randomize-all -ginkgo.seed=<1..10> — all 20 spec executions passed | — |

    Toolchain: Go 1.27.4 and envtest Kubernetes 1.37.0. The local API server binds to loopback and uses --advertise-address=192.0.2.1 because this workspace has no default network route.

    Pinned golangci-lint v2.15.0 passed for all six affected packages with 0 issues. Existing unit and singlecluster integration presubmit targets select these tests.

    make verify was started, but the complete repository check cannot finish in this workspace: its required verify-skills-lint target needs Docker or Podman, neither of which is installed. Running make verify-skills-lint fails with run: command not found (exit 127); the aggregate run was stopped after confirming this blocker. Formatting and git diff --check passed, and the working tree is clean.

    AI assistance was used to refactor and review the tests and prepare this PR.

    Release note

    ``release-note
    NONE

    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->
    
    ## AI summary
    
    This change refactors handoff tests only. It does not change user-facing behavior.
    
    - `pkg/controller/core/dqo/distribution_test.go`: Moves handoff cases into the named table. Adds named foreign-owner, retry, and ancestry cases. Uses testing wrappers.
    - `test/integration/singlecluster/controller/dynamicquotaorchestrator/handoff_test.go`: Inlines helpers. Creates and cleans up objects explicitly.
    - `pkg/util/testing`: Adds `SubtreeRootRefWrapper` and `ClusterQueueWrapper.Name`.
    - SparkApplication and TrainJob webhook tests: Use `cq.Obj().Name`.
    
    ## Suggested release note
    
    
    text
    NONE
    ``
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 428 lines (+321 / -107) across 5 files Reviewer: tenzen-y Review duration: 847m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 428 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #19997"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.1% · Safe to merge
    24.1%