Skip to content

Commit 2cf7cfa

Browse files
author
zhengzhiyong
committed
changes: add autonl test
1 parent ddd4502 commit 2cf7cfa

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

blackboxtest/etc/basic.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ file = "logs/basic.log"
22
topic = "basic"
33
autocreat = true
44
autoparti = true
5+
-- autonl = false
56
-- rawcopy = true

src/tail2kafka.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,7 @@ void TEST(loadLuaCtx)()
18991899
check(ctx->topic == "basic", "%s", ctx->topic.c_str());
19001900
check(ctx->autoparti, "%s", (ctx->autoparti ? "TRUE" : "FALSE"));
19011901
check(ctx->partition == RD_KAFKA_PARTITION_UA, "%d", ctx->partition);
1902+
check(ctx->autonl, "%s", (ctx->autonl ? "TRUE" : "FALSE"));
19021903
unloadLuaCtx(ctx);
19031904

19041905
ctx = loadLuaCtx(0, LUA("filter.lua"), errbuf);

src/tail2kafka_blackbox.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,10 @@ void *consumer_routine(void *data)
317317

318318
void basic_consumer(rd_kafka_message_t *rkm)
319319
{
320-
// printf("%.*s\n", (int) rkm->len, (char *) rkm->payload);
320+
// printf("%.*s", (int) rkm->len, (char *) rkm->payload);
321321
const char *ptr = basicPro();
322+
check(rkm->len == strlen(ptr),
323+
"length(%.*s) != length(%s)", (int) rkm->len, (char *) rkm->payload, ptr);
322324
check(memcmp(rkm->payload, ptr, rkm->len) == 0,
323325
"%.*s != %s", (int) rkm->len, (char *) rkm->payload, ptr);
324326
}

0 commit comments

Comments
 (0)