This is an automated email from the ASF dual-hosted git repository.

starsz pushed a commit to branch feat_brokers
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit da13f13bd7749ecd5e028866b74a995fd59e816c
Author: starsz <[email protected]>
AuthorDate: Thu Sep 29 14:24:14 2022 +0800

    fix: ci
---
 apisix/plugins/kafka-logger.lua |  6 +++---
 t/plugin/kafka-logger.t         |  2 +-
 t/plugin/kafka-logger2.t        | 40 ++++++++++++++++++++--------------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/apisix/plugins/kafka-logger.lua b/apisix/plugins/kafka-logger.lua
index f095bd870..ee079d02f 100644
--- a/apisix/plugins/kafka-logger.lua
+++ b/apisix/plugins/kafka-logger.lua
@@ -19,7 +19,6 @@ local log_util = require("apisix.utils.log-util")
 local producer = require ("resty.kafka.producer")
 local bp_manager_mod = require("apisix.utils.batch-processor-manager")
 local plugin = require("apisix.plugin")
-local table = require("apisix.core.table")
 
 local math     = math
 local pairs    = pairs
@@ -223,10 +222,11 @@ function _M.log(conf, ctx)
     end
 
     -- reuse producer via lrucache to avoid unbalanced partitions of messages 
in kafka
-    local broker_list = core.table.new(conf.broker_list and 
core.table.nkeys(conf.broker_list) or #conf.brokers, 0)
+    local length = conf.broker_list and core.table.nkeys(conf.broker_list) or 
#conf.brokers
+    local broker_list = core.table.new(length, 0)
     local broker_config = {}
 
-    if conf.broker_list then 
+    if conf.broker_list then
         for host, port in pairs(conf.broker_list) do
             local broker = {
                 host = host,
diff --git a/t/plugin/kafka-logger.t b/t/plugin/kafka-logger.t
index 5b894abce..218f14c2a 100644
--- a/t/plugin/kafka-logger.t
+++ b/t/plugin/kafka-logger.t
@@ -72,7 +72,7 @@ done
         }
     }
 --- response_body
-property "broker_list" is required
+value should match only one schema, but matches none
 done
 
 
diff --git a/t/plugin/kafka-logger2.t b/t/plugin/kafka-logger2.t
index 60a584f1b..a77ca6eaa 100644
--- a/t/plugin/kafka-logger2.t
+++ b/t/plugin/kafka-logger2.t
@@ -342,47 +342,47 @@ qr/not found topic, retryable: true, topic: 
undefined_topic, partition_id: -1/
                 },
                 {
                     input = {
-                               brokers = {
-                               },
-                               kafka_topic = "test",
-                               key = "key1",
-                           },
+                        brokers = {
+                        },
+                        kafka_topic = "test",
+                        key = "key1",
+                    },
                 },
                 {
                     input = {
-                               brokers = {
+                        brokers = {
                             {
                                 host = "127.0.0.1",
                                 port = "9093",
                             },
-                               },
-                               kafka_topic = "test",
-                               key = "key1",
-                           },
+                        },
+                        kafka_topic = "test",
+                        key = "key1",
+                    },
                 },
                 {
                     input = {
-                               brokers = {
+                        brokers = {
                             {
                                 host = "127.0.0.1",
                                 port = 0,
                             },
-                               },
-                               kafka_topic = "test",
-                               key = "key1",
-                           },
+                        },
+                        kafka_topic = "test",
+                        key = "key1",
+                    },
                 },
                 {
                     input = {
-                               brokers = {
+                        brokers = {
                             {
                                 host = "127.0.0.1",
                                 port = 65536,
                             },
-                               },
-                               kafka_topic = "test",
-                               key = "key1",
-                           },
+                        },
+                        kafka_topic = "test",
+                        key = "key1",
+                    },
                 },
             }
 

Reply via email to