From 880a20103763981a2d1326bc732ec3801e5fc96d Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 11 Jan 2023 14:58:11 -0500 Subject: [PATCH] fix(reply-test): fix reply test because msgs could come out of order Fixes #3070 --- protocol/messenger_reply_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/protocol/messenger_reply_test.go b/protocol/messenger_reply_test.go index e6897ed16..da28119f9 100644 --- a/protocol/messenger_reply_test.go +++ b/protocol/messenger_reply_test.go @@ -117,11 +117,17 @@ func (s *MessengerReplySuite) TestReceiveReply() { ) 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 - 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 - s.Require().True(response.Messages()[0].Replied) + s.Require().True(messageToCheck.Replied) s.Require().NoError(bob.Shutdown()) }