Skip to content

Test:migrate router contracts api - #21046

Merged
wangq8 merged 8 commits into
infiniflow:mainfrom
flyingwhit:test/migrate-router-contracts-api-rest-helper
Oct 16, 2026
Merged

wangq8 merged 8 commits into
infiniflow:mainfrom
flyingwhit:test/migrate-router-contracts-api-rest-helper

Conversation

@flyingwhit

@flyingwhit flyingwhit commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

What

Port test/testcases/restful_api/test_router_contracts.py into test/api using the
shared helper layer (restCall / restCode / restResult) instead of a private
request/logging layer.

Changes

  • Add test/api/router_contracts_api_test.go (35 lines):
    • requireRouteNotFound asserts the HandleNoRoute JSON contract from a
      restResult: HTTP 404, code 404, error "Not Found", exact
      "Not Found: /api/v1/missing_route" message, data null.
    • TestRouteNotFoundReturnsJSON sends an unauthenticated request via
      restCall (a *TestConfig copy with APIKey cleared) and delegates the
      assertions to the helper.
  • No helpers_test.go, no config.go changes, no CI changes, no Python deletion.

…nds (infiniflow#20367)"

This reverts commit fc578ea.

The MQ LIST PENDING form is needed again. Note that restoring the CLI
plumbing alone does not make it filter: the admin handler and the NATS
engine still ignore the pending flag.
Port the single test from
test/testcases/restful_api/test_router_contracts.py using the shared
test/api helpers instead of a private request layer.

- TestRouteNotFoundReturnsJSON drives an unauthenticated request through
  restCall and asserts the HandleNoRoute JSON contract via restCode and
  restResult.JSON
- No helpers_test.go or config.go changes; the shared restCall/restCode
  layer already covers logging and assertions

The Python test is kept until the restful suite is migrated as a whole.
@flyingwhit flyingwhit added the ci Continue Integration label Oct 16, 2026
@flyingwhit
flyingwhit requested a review from wangq8 October 16, 2026 03:12
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5307ce05-a88e-404a-a978-bd634a2208e6
📥 Commits

Reviewing files that changed from the base of the PR and between d375472 and 5a7dda4.

📒 Files selected for processing: 1
  • test/api/router_contracts_api_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Adds an integration test that sends a request to an unmatched API route without an API key. The test checks for a 404 JSON response with the expected error, versioned path message, and null data.

Changes: API Route Contract Test

Layer / File(s) Summary
Check missing-route response
test/api/router_contracts_api_test.go
Adds a helper and integration test that check the 404 response, "Not Found" error, versioned path message, and null data. The test clears the API key before requesting a missing route.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 5a7dd

This change adds integration coverage for the existing JSON 404 response, including its null data field. The inspected implementation matches the contract, and no concrete behavior change blocks merging.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the migration of the router contracts API test. It is concise and related to the main change, although it would read better with standard spacing and capitalization.
Description check Passed The description includes the required Summary section and provides clear background, scope, implementation details, and explicitly listed non-changes.
  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks a route at night
The path comes back with 404
“Not Found,” says JSON, neat and clear
No key was needed for the test
The rabbit hops, its checks complete

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

@wangq8
wangq8 merged commit aac29e9 into infiniflow:main Oct 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants