franz-go icon indicating copy to clipboard operation
franz-go copied to clipboard

kgo: export the wrapped error from ErrGroupSession

Open sbuliarca opened this issue 1 year ago • 3 comments

We want to test in a unit test the behaviour exposed in this question: https://github.com/twmb/franz-go/issues/784, where we rely on this error type. So we need to create this kind of error, with another wrapped one inside it in the tests.

Would this change be ok? The only side efect of it is that clients of the lib would be able to create it too.

sbuliarca avatar Jul 24 '24 15:07 sbuliarca

Why not use Unwrap to get the inner error, rather than exposing the error?

twmb avatar Jul 24 '24 17:07 twmb

Why not use Unwrap to get the inner error, rather than exposing the error?

Our problem is that we want to create this error ourselves, in the test, to simulate a kgo.Fetches that contains this error. Something like:

egs := kgo.ErrGroupSession{Err: syscall.ECONNREFUSED}
fetch := kgo.Fetch{
			Topics: []kgo.FetchTopic{{
				Topic: "dummyTopic",
				Partitions: []kgo.FetchPartition{{
					Partition: 0,
					Err:       err,
				}},
			}}}

We currently can not do it, as the err is not exported in kgo.ErrGroupSession.

sbuliarca avatar Jul 25 '24 05:07 sbuliarca

Hey @twmb! Just a friendly reminder of the existence of this PR. Thanks!

sbuliarca avatar Aug 12 '24 09:08 sbuliarca

I haven't forgotten -- I'm primarily waiting until this weekend or next (or next) to set aside time to implement the three new KIPs that were released in Kafka 3.8.

That said -- I'm still not sure what value a test on this particular error provides? Stakes here are pretty low though, so I'm not really opposed either.

twmb avatar Aug 27 '24 05:08 twmb

I'm still not sure what value a test on this particular error provides?

For us, it allows to unit test the exact scenario described in the question https://github.com/twmb/franz-go/issues/784 , that we're not exiting the poll loop when we get such an error.

sbuliarca avatar Aug 27 '24 06:08 sbuliarca

Bit of a delay on my side... releasing this evening.

twmb avatar Oct 15 '24 00:10 twmb