Skip to content

Conversation

@IsuruGunarathne
Copy link
Contributor

@IsuruGunarathne IsuruGunarathne commented Feb 11, 2026

Purpose

This PR fixes the failing scenarios in model-round-robin and model-weighted-round-robin policies and enables the integration tests for these policies. It also enables code coverage for the refactored policy-engine folder inside gateway runtime.

Goals

  • model-round-robin and model-weighted-round-robin policy integration tests should pass
  • Code coverage for policy-engine should be tracked

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI. Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Summary by CodeRabbit

  • Tests

    • Expanded coverage for model round‑robin and weighted scenarios (canary, fallback, suspension, rate‑limit, invalid‑input, empty‑body).
    • Migrated tests to declarative CRD-driven API deployments with health/readiness checks, consistent auth, per‑scenario readiness verification and explicit cleanup for improved reliability and isolation.
    • Added extensive edge‑case validations (5xx/429 behaviors, suspendDuration variants, JSON/JSONPath errors).
  • Chores

    • Test runner now produces a coverage profile for easier test coverage reporting.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Replaces inline in-test REST deployments with declarative RestApi CRD manifests across integration tests, adds global admin auth and gateway readiness, standardizes health/readiness checks and cleanup, and extends scenarios for weighted models, location strategies, and failure edge cases.

Changes

Cohort / File(s) Summary
Model Round-Robin Feature
gateway/it/features/model-round-robin.feature
Rewrote scenarios to deploy APIs via RestApi CRD manifests instead of inline YAML, added Background for gateway readiness and admin auth, added per-scenario /health readiness checks, standardized requestModel mappings and endpoints, added explicit RestApi deletion cleanup, and expanded edge-case coverage (5xx/429 suspension, all-suspended/503, suspendDuration variants, invalid/empty inputs, invalid JSONPath, missing model fields).
Model Weighted Round-Robin Feature
gateway/it/features/model-weighted-round-robin.feature
Converted inline REST test configurations to RestApi CRD manifests for all weighted-location variants (payload, header, queryParam, path), enforced global auth/health prerequisites, added per-scenario health/readiness assertions, normalized request targets and mappings, introduced suspension/rate-limit and invalid-input edge cases, and added explicit CRD cleanup steps.
Test Suite Registration
gateway/it/suite_test.go
Re-enabled the two model feature files in the suite feature path list so the updated CRD-driven scenarios run as part of the integration suite.
Test Coverage Makefile
gateway/gateway-runtime/Makefile
test target now generates a coverage profile (-coverprofile=unit-test-coverage.txt); build-coverage-image target now depends on test (coverage image build runs tests first).

Sequence Diagram(s)

sequenceDiagram
  participant Tester as Test Runner
  participant K8s as Kubernetes API
  participant Gateway as Gateway
  participant Upstream as Upstream Service

  Tester->>K8s: create RestApi CRD (apiVersion/kind/spec...)
  K8s-->>Gateway: CRD reconciled / config applied
  Gateway->>Upstream: provision routes / register upstreams
  Tester->>Gateway: poll /health for endpoint readiness
  Gateway-->>Tester: 200 OK when ready
  Tester->>Gateway: send test requests (various models/locations)
  Gateway->>Upstream: forward requests (apply routing/weights)
  Upstream-->>Gateway: responses (200, 5xx, 429, etc.)
  Gateway-->>Tester: aggregated/expected responses
  Tester->>K8s: delete RestApi CRD (cleanup)
  K8s-->>Gateway: remove routes
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through CRDs at morning light,
YAML carrots stacked tidy and bright.
Health probes sang and endpoints woke,
Routes and weights danced as tests spoke—
A rabbit cheered the gateway’s flight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description contains critical template placeholders that remain unfilled, providing incomplete information about implementation approach, test coverage, and verification steps. Complete all required sections: fill Approach section with specific implementation details, provide detailed Automation tests with code coverage metrics and test case descriptions, mark all Security checks, provide Documentation links or N/A explanation, list Test environment details, and specify any Related PRs.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the main change: fixing scenarios and enabling integration tests for model-round-robin and model-weighted-round-robin policies.
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 docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! 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.

@IsuruGunarathne IsuruGunarathne changed the title Fix scenarios in model-round-robin policy integration tests Fix scenarios in model-round-robin and model-weighted-round-robin policy integration tests Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant