From 80a8457bf48c9c9776eaa39c5d468432355d0e62 Mon Sep 17 00:00:00 2001 From: Nic Date: Fri, 17 Jul 2026 10:07:05 +0800 Subject: [PATCH] test(error-log-logger): don't assert a fixed JSON key order for the broker list TEST 10 matches the broker list the plugin logs against a literal `[{"host":"127.0.0.1","port":9093}]`. The plugin builds that string with `core.json.delay_encode(config.kafka.brokers)`, and cjson serialises a Lua table in hash order, which is not stable across runs. When the encoder emits `[{"port":9093,"host":"127.0.0.1"}]` instead, the pattern misses and the block fails. Match the host and the port as two independent patterns so the assertion holds whatever order the encoder picks, without weakening what it checks. Observed over 12 runs of the block before the change: 9 runs encoded host-first and passed, 3 encoded port-first and failed. With the change, 14 runs pass, 3 of which encoded port-first. --- t/plugin/error-log-logger-kafka.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/plugin/error-log-logger-kafka.t b/t/plugin/error-log-logger-kafka.t index 1ede14cd15b2..c7b12bcc2f7b 100644 --- a/t/plugin/error-log-logger-kafka.t +++ b/t/plugin/error-log-logger-kafka.t @@ -366,7 +366,8 @@ done } --- error_log eval [qr/this is a error message for tls test/, -qr/sending a batch logs to kafka brokers: \[\{"host":"127.0.0.1","port":9093\}\]/, +qr/sending a batch logs to kafka brokers: .*"host":"127\.0\.0\.1"/, +qr/sending a batch logs to kafka brokers: .*"port":9093/, qr/send data to kafka: .*this is a error message for tls test/] --- no_error_log failed to do SSL handshake