Skip to content

Commit

Permalink
changes: add autonl test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengzhiyong committed Aug 17, 2017
1 parent ddd4502 commit 2cf7cfa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions blackboxtest/etc/basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ file = "logs/basic.log"
topic = "basic"
autocreat = true
autoparti = true
-- autonl = false
-- rawcopy = true
1 change: 1 addition & 0 deletions src/tail2kafka.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,7 @@ void TEST(loadLuaCtx)()
check(ctx->topic == "basic", "%s", ctx->topic.c_str());
check(ctx->autoparti, "%s", (ctx->autoparti ? "TRUE" : "FALSE"));
check(ctx->partition == RD_KAFKA_PARTITION_UA, "%d", ctx->partition);
check(ctx->autonl, "%s", (ctx->autonl ? "TRUE" : "FALSE"));
unloadLuaCtx(ctx);

ctx = loadLuaCtx(0, LUA("filter.lua"), errbuf);
Expand Down
4 changes: 3 additions & 1 deletion src/tail2kafka_blackbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,10 @@ void *consumer_routine(void *data)

void basic_consumer(rd_kafka_message_t *rkm)
{
// printf("%.*s\n", (int) rkm->len, (char *) rkm->payload);
// printf("%.*s", (int) rkm->len, (char *) rkm->payload);
const char *ptr = basicPro();
check(rkm->len == strlen(ptr),
"length(%.*s) != length(%s)", (int) rkm->len, (char *) rkm->payload, ptr);
check(memcmp(rkm->payload, ptr, rkm->len) == 0,
"%.*s != %s", (int) rkm->len, (char *) rkm->payload, ptr);
}
Expand Down

0 comments on commit 2cf7cfa

Please sign in to comment.