feat: Add dependency protocol checking and deletion checking for stream routing#12794
Conversation
…am routing Signed-off-by: Orician <[email protected]>
…eanup. Fixed status code check in pingpong test to ensure correct error message is output when 400 error is returned 1. Update TEST 15 to expect 400 when creating a route with a non-existent superior_id, reflecting the new validation logic. 2. Add TEST 22 to clean up created stream routes after tests to prevent Etcd data pollution affecting subsequent tests (e.g., redis.t). Signed-off-by: Orician <[email protected]>
|
Modified |
…quest body is missing The plugin now returns HTTP 400 (HTTP_BAD_REQUEST) when the request body is missing instead of just logging a warning and continuing. This prevents unnecessary upstream requests when the client fails to provide a request body. TEST 4 in ai-request-rewrite2.t was updated to expect status 400 instead of 200 when sending a POST request without a body. Signed-off-by: Orician <[email protected]>
Add TEST 5 cleanup to delete the route created in the test suite, preventing etcd data pollution that could affect subsequent tests. This follows the same pattern used in t/xrpc/pingpong.t.
|
|
…st expectation to 200
4ca5e42 to
c07855a
Compare
Sync feature branch with latest master changes to perform up-to-date testing in the local environment.
…thorizations returned as arrays (matching "Authorization": ["hello"])
CI test failure occurred in the job: Error log details: Error: 2025/12/12 06:10:14 [error] 95223#95223: *1 [lua] config_etcd.lua:602: load_full_data(): failed to check item data of [/apisix/routes] err:object matches none of the required: ["plugins","uri"] or ["upstream","uri"] or ["upstream_id","uri"] or ["service_id","uri"] or ["plugins","uris"] or ["upstream","uris"] or ["upstream_id","uris"] or ["service_id","uris"] or ["script","uri"] or ["script","uris"] ,val: {"priority":0,"status":1,"uri":"/2"}, context: init_worker_by_lua*Root cause analysis: The CLI test script issue: #12815 |
|
During the last CI test run, I noticed that the Therefore, I modified the expected response in However, in today's CI test run, Should we revert the expected response back to |
|
Hi @yixianOu, without any logical changes, we cannot make tests pass by modifying the test code. All test-related modifications in a PR must revolve around the functionality of the PR itself; irrelevant modifications should not be included. I addressed a portion of the issues in CI at #12805. Have you merged that part of the code? |
|
Signed-off-by: Orician <[email protected]>
Description
This PR implements dependency protocol checking and deletion protection for stream routes, resolving #6939.
Previously, it was possible to create a subordinate stream route referencing a non-existent
superior_idor a superior route with a mismatched protocol. Additionally, superior routes could be deleted even while being referenced by subordinate routes, leading to potential runtime errors.Checklist
Changes
check_confto ensure that when asuperior_idis provided:delete_checkerto prevent the deletion of a stream route if it is currently referenced as asuperior_idby other routes.t/admin/stream-routes-subordinate.tcovering various scenarios including creation, protocol mismatch, and deletion protection.Related Issue
Resolves #6939
Sign-off
Signed-off-by: Orician [email protected]