nic-6443 commented on code in PR #13181:
URL: https://github.com/apache/apisix/pull/13181#discussion_r3055031888


##########
t/APISIX.pm:
##########
@@ -777,6 +777,22 @@ _EOC_
         $ipv6_listen_conf = "listen \[::1\]:1984;"
     }
 
+    my $enable_test_control_api_v1 =
+        !defined($ENV{TEST_ENABLE_CONTROL_API_V1}) ||
+        $ENV{TEST_ENABLE_CONTROL_API_V1} ne "0";
+
+    my $control_api_v1_location = "";

Review Comment:
   The test framework has a hardcoded `location /v1/` block for the control API 
(`apisix.http_control()`), which intercepts **all** `/v1/*` requests. The 
Anthropic Messages API uses `/v1/messages` as its endpoint, so without this 
change, all test requests to `/v1/messages` are intercepted by the control API 
location block and return 404 instead of reaching the mock upstream.
   
   This `TEST_ENABLE_CONTROL_API_V1` env var allows tests that use `/v1/*` 
paths (like the Anthropic protocol tests added in this PR) to conditionally 
disable the control API location. When a test file sets 
`$ENV{TEST_ENABLE_CONTROL_API_V1} = "0"` in its `BEGIN` block, the `/v1/` 
location is excluded from the nginx config, allowing `/v1/messages` requests to 
pass through to the upstream normally.
   
   The test file `t/plugin/ai-proxy-protocol-conversion.t` uses this mechanism 
— see its `BEGIN` block.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to