kayx23 commented on code in PR #10138:
URL: https://github.com/apache/apisix/pull/10138#discussion_r1315328921


##########
t/plugin/proxy-cache/memory.t:
##########
@@ -661,3 +661,57 @@ GET /hello
 --- more_headers
 Cache-Control: only-if-cached
 --- error_code: 504
+
+
+
+=== TEST 36: configure plugin without memory_cache zone
+--- config
+       location /t {
+           content_by_lua_block {
+               local t = require("lib.test_admin").test
+               local code, body = t('/apisix/admin/routes/1',
+                    ngx.HTTP_PUT,
+                    [[{
+                        "plugins": {
+                            "proxy-cache": {
+                               "cache_strategy": "memory",
+                               "cache_key":["$host","$uri"],
+                               "cache_bypass": ["$arg_bypass"],
+                               "cache_control": true,
+                               "cache_method": ["GET"],
+                               "cache_ttl": 10,
+                               "cache_http_status": [200]
+                            }
+                        },
+                        "upstream": {
+                            "nodes": {
+                                "127.0.0.1:1986": 1
+                            },
+                            "type": "roundrobin"
+                        },
+                        "uri": "/hello"
+                   }]]
+                   )
+
+               if code >= 300 then
+                   ngx.status = code
+               end
+               ngx.say(body)
+           }
+       }
+--- request
+GET /t
+--- error_code: 200
+--- response_body
+passed
+
+
+
+=== TEST 37: hit route
+--- request
+GET /hello
+--- grep_error_log eval
+qr/no cache_zone provided/
+--- grep_error_log_out
+no cache_zone provided
+no cache_zone provided

Review Comment:
   There might be a misunderstanding? This should actually error out with an 
error in the 400 range and with the response body reminding users they should 
configure `cache_zone` to be an in-memory cache zone.
   
   Current behaviour: If you configure `proxy-cache` plugin with 
`"cache_strategy": "memory"` and without `cache_zone`, currently you get a 500 
Internal Server Error. 



-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to