Return error if unknown hello session was received while waiting for joined events.

This commit is contained in:
Joachim Bauch 2021-04-27 08:48:36 +02:00
parent 9cf796640c
commit 5d87df4b8e
No known key found for this signature in database
GPG Key ID: 77C1D22D53E15F02
1 changed files with 6 additions and 0 deletions

View File

@ -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