From 002c4d06df30983ffa2da7389dd95940334caf1a Mon Sep 17 00:00:00 2001 From: Jack Dockerty Date: Sun, 14 Aug 2022 11:39:24 +0100 Subject: [PATCH 01/21] add tests for explicit offset type --- kafka/kafka_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kafka/kafka_test.go b/kafka/kafka_test.go index d0dc880b1..1fadbe3b2 100644 --- a/kafka/kafka_test.go +++ b/kafka/kafka_test.go @@ -131,6 +131,22 @@ func TestOffsetAPIs(t *testing.T) { t.Errorf("Failed to change offset. Expect (%v), got (%v)\n", 10, offset) } + // test passing explicit 'Offset' type + err = offset.Set(OffsetBeginning) + if err != nil { + t.Errorf("Cannot set offset to (%v). Error: %s \n", OffsetBeginning, err) + } else if offset != OffsetBeginning { + t.Errorf("Failed to change offset. Expect (%v), got %v\n", OffsetBeginning, offset) + } + + // test passing explicit 'Offset' type + err = offset.Set(OffsetEnd) + if err != nil { + t.Errorf("Cannot set offset to (%v). Error: %s \n", OffsetEnd, err) + } else if offset != OffsetEnd { + t.Errorf("Failed to change offset. Expect (%v), got %v\n", OffsetEnd, offset) + } + // test OffsetTail() tail := OffsetTail(offset) t.Logf("offset tail %v\n", tail) From 01ac3c754493a45c37e92a76c143fe4e09a60452 Mon Sep 17 00:00:00 2001 From: Jack Dockerty Date: Sun, 14 Aug 2022 11:39:49 +0100 Subject: [PATCH 02/21] add Offset type case and return --- kafka/offset.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kafka/offset.go b/kafka/offset.go index 4cb1819c8..6aee3f3c5 100644 --- a/kafka/offset.go +++ b/kafka/offset.go @@ -107,6 +107,8 @@ func NewOffset(offset interface{}) (Offset, error) { return Offset((int64)(v)), nil case int64: return Offset(v), nil + case Offset: + return Offset(v), nil default: return OffsetInvalid, newErrorFromString(ErrInvalidArg, fmt.Sprintf("Invalid offset type: %t", v)) From 8ec75fbee6851a304745c4484b46c4a48ccca4ab Mon Sep 17 00:00:00 2001 From: Jack Dockerty Date: Sun, 14 Aug 2022 11:41:35 +0100 Subject: [PATCH 03/21] update doc string for using Offset type --- kafka/offset.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kafka/offset.go b/kafka/offset.go index 6aee3f3c5..c0d27f95e 100644 --- a/kafka/offset.go +++ b/kafka/offset.go @@ -72,8 +72,8 @@ func (o *Offset) Set(offset interface{}) error { return err } -// NewOffset creates a new Offset using the provided logical string, or an -// absolute int64 offset value. +// NewOffset creates a new Offset using the provided logical string, an +// absolute int64 offset value, or a concrete Offset type. // Logical offsets: "beginning", "earliest", "end", "latest", "unset", "invalid", "stored" func NewOffset(offset interface{}) (Offset, error) { From 26a7daa129a00cf3e56ca7f144dac5f26a47e77f Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Fri, 16 Dec 2022 04:01:08 +0000 Subject: [PATCH 04/21] chore: update repo semaphore config From 128ee7897bdc5fc0f2b4c1871a10753e0a6bfdf1 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Fri, 16 Dec 2022 04:01:08 +0000 Subject: [PATCH 05/21] chore: update repo semaphore config From bc882917b106f9eeab14e8d8558c087ad7538058 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Fri, 16 Dec 2022 04:01:08 +0000 Subject: [PATCH 06/21] chore: update repo semaphore config From 36e34744e9947a321eca45b51b98cedff7a8f8c4 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Fri, 16 Dec 2022 04:01:08 +0000 Subject: [PATCH 07/21] chore: update repo semaphore config From de4d2945b9178136386ae28aa56d2571a1003bc8 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sat, 17 Dec 2022 03:59:13 +0000 Subject: [PATCH 08/21] chore: update repo semaphore config From 28e6cfdbb40c91db075d2a51971fecdecaecec2e Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sat, 17 Dec 2022 03:59:13 +0000 Subject: [PATCH 09/21] chore: update repo semaphore config From acf1ff396c94cd706b07645f5abf375555a63713 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sat, 17 Dec 2022 03:59:13 +0000 Subject: [PATCH 10/21] chore: update repo semaphore config From 116f42b4fc455c6a09fdff280947e17b7dca9288 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sat, 17 Dec 2022 03:59:13 +0000 Subject: [PATCH 11/21] chore: update repo semaphore config From f337ee61105061b3633a21a7aaa80493ecea05c1 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sun, 18 Dec 2022 04:00:00 +0000 Subject: [PATCH 12/21] chore: update repo semaphore config From 0b3418007517f243a12858871e6a81715d45dda7 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sun, 18 Dec 2022 04:00:00 +0000 Subject: [PATCH 13/21] chore: update repo semaphore config From 2ccb7e2557ad923391e003b0531d0f93abb44eeb Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sun, 18 Dec 2022 04:00:00 +0000 Subject: [PATCH 14/21] chore: update repo semaphore config From 43d972a770f6d47f5aeb7f500862da477deb8e51 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Sun, 18 Dec 2022 04:00:00 +0000 Subject: [PATCH 15/21] chore: update repo semaphore config From b8eca847f9c93a861124b31a6a1a1096dadaf115 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Mon, 19 Dec 2022 04:00:10 +0000 Subject: [PATCH 16/21] chore: update repo semaphore config From b4326f50a8f06909e4f5a6701c86c6125c6eef2b Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Mon, 19 Dec 2022 04:00:10 +0000 Subject: [PATCH 17/21] chore: update repo semaphore config From beeaf92a1fb483387ac93591aa7277c80ec73552 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Mon, 19 Dec 2022 04:00:10 +0000 Subject: [PATCH 18/21] chore: update repo semaphore config From 48685d27e4ccdd0d29e07289f4362af98144edb4 Mon Sep 17 00:00:00 2001 From: Confluent Jenkins Bot Date: Mon, 19 Dec 2022 04:00:10 +0000 Subject: [PATCH 19/21] chore: update repo semaphore config From 6a2fa3f3c326abad9f277eecc652a09566e3cbf3 Mon Sep 17 00:00:00 2001 From: PrasanthV454 Date: Fri, 17 Mar 2023 20:06:58 +0530 Subject: [PATCH 20/21] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe07d988..a1f8f3cc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ This is a feature release: * Added `SetRoundtripDuration` to the mock broker for setting RTT delay for a given mock broker (@kkoehler, #892). * Built-in support for Linux/ arm64. (#933). + * Support for Offset types on `offset.Set()` ### Fixes From cb1b99f7df24a4e864a39bc4f8401a8dafcafc4d Mon Sep 17 00:00:00 2001 From: prasanthV <40450906+PrasanthV454@users.noreply.github.com> Date: Mon, 20 Mar 2023 12:27:28 +0530 Subject: [PATCH 21/21] Update CHANGELOG.md Co-authored-by: Milind L --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1f8f3cc8..8163d4b4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ This is a feature release: * Added `SetRoundtripDuration` to the mock broker for setting RTT delay for a given mock broker (@kkoehler, #892). * Built-in support for Linux/ arm64. (#933). - * Support for Offset types on `offset.Set()` + * Support for Offset types on `Offset.Set()` ### Fixes