ruanweihong-aaa commented on code in PR #14036:
URL: https://github.com/apache/apisix/pull/14036#discussion_r4293620324


##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after 
internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1

Review Comment:
   Thanks for catching this. I moved the new cases to 
`t/node/grpc-client-control.t` and added the same `apisix-nginx-module` 
availability check used by the existing `client-control` test suite. The new 
cases are skipped when the module is unavailable, while the existing gRPC proxy 
tests remain runnable.



##########
t/node/grpc-proxy-unary.t:
##########
@@ -33,6 +33,79 @@ run_tests;
 
 __DATA__
 
+=== TEST: client-control rejects a gRPC request without Content-Length after 
internal redirect
+--- http2
+--- apisix_yaml
+routes:
+  - id: grpc-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 1
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto 
-plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello 
2>&1
+--- response_body_like: 413
+--- error_log
+client intended to send too large chunked body
+
+
+
+=== TEST: client-control zero keeps gRPC request bodies unlimited after 
internal redirect
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-no-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 0
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto 
-plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix
+
+
+
+=== TEST: client-control raises the gRPC body limit above the global limit
+--- http2
+--- extra_yaml_config
+nginx_config:
+  http:
+    client_max_body_size: 1
+--- apisix_yaml
+routes:
+  - id: grpc-larger-body-limit
+    uri: /helloworld.Greeter/SayHello
+    plugins:
+      client-control:
+        max_body_size: 5242880
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:10051": 1
+      type: roundrobin
+#END
+--- exec
+grpcurl -import-path ./t/grpc_server_example/proto -proto helloworld.proto 
-plaintext -d '{"name":"apisix"}' 127.0.0.1:1984 helloworld.Greeter.SayHello
+--- response_body_like: Hello apisix

Review Comment:
   Agreed—the original small requests could not verify that the raised limit 
took effect. The test fixture already sets a 30 MiB Nginx limit, so I removed 
the duplicate directive after CI showed it prevented Nginx from starting. In 
`adec29cd`, both raised-limit cases send a 31 MiB request, with the plugin set 
to unlimited or 50 MiB. They expect the upstream gRPC server's 
`ResourceExhausted` response rather than an APISIX 413, which would show that 
the request reached the upstream. CI for this revision is still running.



-- 
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