From 5d87df4b8e03b6957b7488999ee9b617ef43116a Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 27 Apr 2021 08:48:36 +0200 Subject: [PATCH] Return error if unknown hello session was received while waiting for joined events. --- testclient_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testclient_test.go b/testclient_test.go index f67890c..cc95077 100644 --- a/testclient_test.go +++ b/testclient_test.go @@ -535,11 +535,17 @@ func (c *TestClient) RunUntilJoined(ctx context.Context, hello ...*HelloServerMe if err := c.checkSingleMessageJoined(message); err != nil { return err } + found := false for idx, h := range hello { if err := c.checkMessageJoined(message, h); err == nil { hello = append(hello[:idx], hello[idx+1:]...) + found = true + break } } + if !found { + return fmt.Errorf("expected one of the passed hello sessions, got %+v", message.Event.Join[0]) + } } } return nil