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/09/07 07:27:50 UTC

[GitHub] [apisix] tzssangglass commented on a diff in pull request #7782: feat(kafka-logger): support sasl conf

tzssangglass commented on code in PR #7782:
URL: https://github.com/apache/apisix/pull/7782#discussion_r964481607


##########
t/plugin/kafka-logger.t:
##########
@@ -592,3 +592,111 @@ qr/partition_id: 2/]
 [qr/partition_id: 1/,
 qr/partition_id: 0/,
 qr/partition_id: 2/]
+
+
+
+=== TEST 20: set route(id: 1)
+--- 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": {
+                            "kafka-logger": {
+                                "broker_list" :
+                                  {
+                                    "127.0.0.1":9092
+                                  },
+                                "kafka_topic" : "test2",
+                                "key" : "key1",
+                                "timeout" : 1,
+                                "batch_max_size": 1,
+                                "sasl_config": {
+                                    "mechanism": "PLAIN",
+                                    "strategy": "sasl",
+                                    "user": "admin",
+                                    "password": "admin-secret"
+                                }
+                            }
+                        },
+                        "upstream": {
+                            "nodes": {
+                                "127.0.0.1:1980": 1
+                            },
+                            "type": "roundrobin"
+                        },
+                        "uri": "/hello"
+                }]]
+                )
+            if code >= 300 then
+                ngx.status = code
+            end
+            ngx.say(body)
+        }
+    }
+--- response_body
+passed
+
+
+
+=== TEST 21: access
+--- request
+GET /hello
+--- response_body
+hello world
+--- wait: 2

Review Comment:
   we can inject the producer.new like: https://github.com/apache/apisix/blob/2aa5c48d3acc9bea9b61958a09b51ae99c8a528b/t/plugin/tencent-cloud-cls.t#L220-L236



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