From 8314f24d799cfde202fbe747bb1fd36b490cb5b4 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 28 Oct 2021 05:59:39 -0400 Subject: [PATCH] pubsub: Use distinct client IDs for test subscriptions. (#7178) (#7179) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #7176. Some of the benchmarks create a bunch of different subscriptions all sharing the same query. These were all using the same client ID, which violates one of the subscriber rules. Ensure each subscriber gets a unique ID. This has been broken as long as this library has been in the repo—I tracked it back to bb9aa85d and it was already failing there, so I think this never really worked. I'm not sure these test anything useful, but at least now they run. (cherry picked from commit 1fd706054227950190710e9b38f6f978a7c42274) Co-authored-by: M. J. Fromberger --- libs/pubsub/pubsub_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/pubsub/pubsub_test.go b/libs/pubsub/pubsub_test.go index 525415493..d3855be7a 100644 --- a/libs/pubsub/pubsub_test.go +++ b/libs/pubsub/pubsub_test.go @@ -518,7 +518,8 @@ func benchmarkNClientsOneQuery(n int, b *testing.B) { ctx := context.Background() q := query.MustParse("abci.Account.Owner = 'Ivan' AND abci.Invoices.Number = 1") for i := 0; i < n; i++ { - subscription, err := s.Subscribe(ctx, clientID, q) + id := fmt.Sprintf("clientID-%d", i+1) + subscription, err := s.Subscribe(ctx, id, q) if err != nil { b.Fatal(err) }