github.com/streamdal/segmentio-kafka-go@v0.4.47-streamdal/commit_test.go (about) 1 package kafka 2 3 import "testing" 4 5 func TestMakeCommit(t *testing.T) { 6 msg := Message{ 7 Topic: "blah", 8 Partition: 1, 9 Offset: 2, 10 } 11 12 commit := makeCommit(msg) 13 if commit.topic != msg.Topic { 14 t.Errorf("bad topic: expected %v; got %v", msg.Topic, commit.topic) 15 } 16 if commit.partition != msg.Partition { 17 t.Errorf("bad partition: expected %v; got %v", msg.Partition, commit.partition) 18 } 19 if commit.offset != msg.Offset+1 { 20 t.Errorf("expected committed offset to be 1 greater than msg offset") 21 } 22 }