From 1c4079e7e3fcd97a677a83c14d50ef9f80cc4292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ch=C3=A1bek?= Date: Sun, 5 Dec 2021 12:07:33 +0100 Subject: [PATCH] Add test for partitionConsumer HWMO before consumption This will fail now, because HWMO is not set correctly --- consumer_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/consumer_test.go b/consumer_test.go index 8d8c33b8c..0f752c4e0 100644 --- a/consumer_test.go +++ b/consumer_test.go @@ -57,6 +57,9 @@ func TestConsumerOffsetManual(t *testing.T) { } // Then + if hwmo := consumer.HighWaterMarkOffset(); hwmo != offsetNewest { + t.Errorf("Expected high water mark offset %d, found %d", offsetNewest, hwmo) + } for i := int64(0); i < 10; i++ { select { case message := <-consumer.Messages(): @@ -109,6 +112,9 @@ func TestConsumerOffsetNewest(t *testing.T) { } // Then + if hwmo := consumer.HighWaterMarkOffset(); hwmo != offsetNewest { + t.Errorf("Expected high water mark offset %d, found %d", offsetNewest, hwmo) + } assertMessageOffset(t, <-consumer.Messages(), 10) if hwmo := consumer.HighWaterMarkOffset(); hwmo != offsetNewestAfterFetchRequest { t.Errorf("Expected high water mark offset %d, found %d", offsetNewestAfterFetchRequest, hwmo) @@ -154,6 +160,9 @@ func TestConsumerOffsetOldest(t *testing.T) { } // Then + if hwmo := consumer.HighWaterMarkOffset(); hwmo != offsetNewest { + t.Errorf("Expected high water mark offset %d, found %d", offsetNewest, hwmo) + } assertMessageOffset(t, <-consumer.Messages(), int64(7)) if hwmo := consumer.HighWaterMarkOffset(); hwmo != offsetNewest { t.Errorf("Expected high water mark offset %d, found %d", offsetNewest, hwmo)