From e9ef552ca0965a4c0d6aeeccf35055b6f75fccbb Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 29 Jul 2020 14:18:13 +0100 Subject: [PATCH] Also test reserialisation --- syncapi/types/types.go | 2 +- syncapi/types/types_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/syncapi/types/types.go b/syncapi/types/types.go index 75a7c9f20..3bf2d19a7 100644 --- a/syncapi/types/types.go +++ b/syncapi/types/types.go @@ -129,7 +129,7 @@ func (t *StreamingToken) String() string { t.syncToken.String(), } for name, lp := range t.logs { - logStr := fmt.Sprintf("%s%d-%d", name, lp.Partition, lp.Offset) + logStr := fmt.Sprintf("%s-%d-%d", name, lp.Partition, lp.Offset) logStrings = append(logStrings, logStr) } // E.g s11_22_33|dl0-134|ab1-441 diff --git a/syncapi/types/types_test.go b/syncapi/types/types_test.go index d501ba55a..22d344330 100644 --- a/syncapi/types/types_test.go +++ b/syncapi/types/types_test.go @@ -46,6 +46,9 @@ func TestNewSyncTokenWithLogs(t *testing.T) { if !reflect.DeepEqual(got, *want) { t.Errorf("%s mismatch: got %v want %v", tok, got, want) } + if got.String() != tok { + t.Errorf("%s reserialisation mismatch: got %s want %s", tok, got.String(), tok) + } } }