File: commit_test.go

package info (click to toggle)
golang-github-segmentio-kafka-go 0.2.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 572 kB
  • sloc: makefile: 3
file content (22 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package kafka

import "testing"

func TestMakeCommit(t *testing.T) {
	msg := Message{
		Topic:     "blah",
		Partition: 1,
		Offset:    2,
	}

	commit := makeCommit(msg)
	if commit.topic != msg.Topic {
		t.Errorf("bad topic: expected %v; got %v", msg.Topic, commit.topic)
	}
	if commit.partition != msg.Partition {
		t.Errorf("bad partition: expected %v; got %v", msg.Partition, commit.partition)
	}
	if commit.offset != msg.Offset+1 {
		t.Errorf("expected committed offset to be 1 greater than msg offset")
	}
}