You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/12/23 08:19:39 UTC
[GitHub] [apisix] ronething commented on a diff in pull request #8558: feat: limit-count plugin with redis cluster support tls/ssl
ronething commented on code in PR #8558:
URL: https://github.com/apache/apisix/pull/8558#discussion_r1056130812
##########
t/plugin/limit-count-redis-cluster.t:
##########
@@ -384,3 +384,170 @@ GET /hello
hello world
--- error_log
connection refused
+
+
+
+=== TEST 12: set route, use error type for redis_cluster_ssl and redis_cluster_ssl_verify
+--- 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": {
+ "limit-count": {
+ "count": 2,
+ "time_window": 60,
+ "rejected_code": 503,
+ "key": "remote_addr",
+ "policy": "redis-cluster"
+ "redis_timeout": 1001,
+ "redis_cluster_nodes": [
+ "127.0.0.1:7000",
+ "127.0.0.1:7001"
+ ],
+ "redis_cluster_name": "redis-cluster-1",
+ "redis_cluster_ssl": "true",
+ "redis_cluster_ssl_verify": "false"
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/hello"
+ }]]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.print(body)
+ }
+ }
+--- error_code: 400
+--- error_log
+Expected comma or object end but found T_STRING
Review Comment:
Yes, i send a error type(string) cause check schema err.
##########
t/plugin/limit-count-redis-cluster.t:
##########
@@ -384,3 +384,170 @@ GET /hello
hello world
--- error_log
connection refused
+
+
+
+=== TEST 12: set route, use error type for redis_cluster_ssl and redis_cluster_ssl_verify
+--- 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": {
+ "limit-count": {
+ "count": 2,
+ "time_window": 60,
+ "rejected_code": 503,
+ "key": "remote_addr",
+ "policy": "redis-cluster"
+ "redis_timeout": 1001,
+ "redis_cluster_nodes": [
+ "127.0.0.1:7000",
+ "127.0.0.1:7001"
+ ],
+ "redis_cluster_name": "redis-cluster-1",
+ "redis_cluster_ssl": "true",
+ "redis_cluster_ssl_verify": "false"
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/hello"
+ }]]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.print(body)
+ }
+ }
+--- error_code: 400
+--- error_log
+Expected comma or object end but found T_STRING
+
+
+
+=== TEST 13: set route, redis_cluster_ssl_verify is true(will cause ssl handshake err), with enable degradation switch
+--- 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,
+ [[{
+ "uri": "/hello",
+ "plugins": {
+ "limit-count": {
+ "count": 2,
+ "time_window": 60,
+ "rejected_code": 503,
+ "key": "remote_addr",
+ "policy": "redis-cluster",
+ "allow_degradation": true,
+ "redis_timeout": 1001,
+ "redis_cluster_nodes": [
+ "127.0.0.1:7000",
+ "127.0.0.1:7001"
+ ],
+ "redis_cluster_name": "redis-cluster-1",
+ "redis_cluster_ssl": true,
+ "redis_cluster_ssl_verify": true
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ }
+ }]]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- response_body
+passed
+
+
+
+=== TEST 14: enable degradation switch for TEST 5
Review Comment:
Fixed.
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org