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


##########
t/plugin/kafka-logger.t:
##########
@@ -592,3 +592,118 @@ 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",
+                                    "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: inject create producer
+--- extra_init_by_lua
+    local producer = require("resty.kafka.producer")
+    producer.new = function(self, broker_list, producer_config, cluster_name)
+        if (#broker_list) then
+            ngx.log(ngx.ERR, "unexpected broker_list length: ", #broker_list)
+            return nil
+        end
+        return producer

Review Comment:
   The `producer` should not be returned here, you can see that the original 
returned is a table.



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