fix(reply-test): fix reply test because msgs could come out of order

Fixes #3070
This commit is contained in:
Jonathan Rainville 2023-01-11 14:58:11 -05:00
parent 186454528b
commit 880a201037
1 changed files with 9 additions and 3 deletions

View File

@ -117,11 +117,17 @@ func (s *MessengerReplySuite) TestReceiveReply() {
) )
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Len(response.Messages(), 2) messages := response.Messages()
s.Require().Len(messages, 2)
//* Verify that the reply reponds to the original message //* Verify that the reply reponds to the original message
s.Require().True(response.Messages()[0].ResponseTo == messageID) messageToCheck := messages[0]
if messageToCheck.ResponseTo == "" || messageToCheck.ResponseTo != messageID {
// We need to use the second message in the response. They got out of order by accident
messageToCheck = messages[1]
}
s.Require().True(messageToCheck.ResponseTo == messageID)
// Verify that it's replied // Verify that it's replied
s.Require().True(response.Messages()[0].Replied) s.Require().True(messageToCheck.Replied)
s.Require().NoError(bob.Shutdown()) s.Require().NoError(bob.Shutdown())
} }