MCPcopy
hub / github.com/IBM/sarama / TestPartitionOffsetManagerInitialOffset

Function TestPartitionOffsetManagerInitialOffset

offset_manager_test.go:619–639  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

617}
618
619func TestPartitionOffsetManagerInitialOffset(t *testing.T) {
620 om, testClient, broker, coordinator := initOffsetManager(t, 0)
621 defer broker.Close()
622 defer coordinator.Close()
623 testClient.Config().Consumer.Offsets.Initial = OffsetOldest
624
625 // Kafka returns -1 if no offset has been stored for this partition yet.
626 pom := initPartitionOffsetManager(t, om, coordinator, -1, "")
627
628 offset, meta := pom.NextOffset()
629 if offset != OffsetOldest {
630 t.Errorf("Expected offset 5. Actual: %v", offset)
631 }
632 if meta != "" {
633 t.Errorf("Expected metadata to be empty. Actual: %q", meta)
634 }
635
636 safeClose(t, pom)
637 safeClose(t, om)
638 safeClose(t, testClient)
639}
640
641func TestPartitionOffsetManagerNextOffset(t *testing.T) {
642 om, testClient, broker, coordinator := initOffsetManager(t, 0)

Callers

nothing calls this directly

Calls 7

initOffsetManagerFunction · 0.85
safeCloseFunction · 0.70
CloseMethod · 0.65
ConfigMethod · 0.65
NextOffsetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected