twmb / franz-go

franz-go contains a feature complete, pure Go library for interacting with Kafka from 0.8.0 through 3.6+. Producing, consuming, transacting, administrating, etc.
BSD 3-Clause "New" or "Revised" License
1.61k stars 158 forks source link

ListOffsetsAfterMilli returns unexpected results when called against kfake cluster #706

Closed narqo closed 2 months ago

narqo commented 2 months ago

While testing a chunk of our code, that uses kadm.ListOffsetsAfterMilli() against a kfake cluster, we bumped into an unexpected behaviour.

We expect that listing the topic's offsets, using a "know" timestamp (e.g. the timestamp of the last produced record) should return a known offset. But in our tests, kfake returns either 0, or the offset after the last record. ~But~ Both are confusing and look different from what we observe from real Kafka.

To illustrate the problem, I've extracted an example into this repo https://github.com/narqo/test-kfake.