Skip to content

Commit

Permalink
Merge branch 'fix/public-chat-test' into 'develop'
Browse files Browse the repository at this point in the history
CHT-930.  PublicChatManagement test failed due to a posible race condition on API

See merge request megachat/MEGAchat!1643
  • Loading branch information
sergiohs84 committed Jun 26, 2023
2 parents 06fd9f8 + 79ee13e commit e1ccff0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/sdk_test/sdk_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,11 +1750,17 @@ TEST_F(MegaChatApiTest, PublicChatManagement)
ASSERT_EQ(chatroomListener->mConfirmedMessageHandle[a2], MEGACHAT_INVALID_HANDLE) << "Message confirmed, when it should fail";

// Autojoin chat link
bool* flagChatsUpdated1 = &mChatsUpdated[a1]; *flagChatsUpdated1 = false;
mChatListUpdated[a1].clear();
previewsUpdated = &chatroomListener->previewsUpdated[a1]; *previewsUpdated = false;
ChatRequestTracker crtAutojoin;
megaChatApi[a2]->autojoinPublicChat(chatid, &crtAutojoin);
ASSERT_EQ(crtAutojoin.waitForResult(), MegaChatError::ERROR_OK) << "Failed to autojoin chat-link. Error: " << crtAutojoin.getErrorString();
ASSERT_TRUE(waitForResponse(previewsUpdated)) << "Timeout expired for update previewers";
ASSERT_TRUE(waitForResponse(flagChatsUpdated1)) << "Failed to receive onChatsUpdate after " << maxTimeout << " seconds";
ASSERT_TRUE(isChatroomUpdated(a1, chatid)) << "Chatroom " << chatid << " is not included in onChatsUpdate";
mChatListUpdated[a1].clear();

MegaChatListItem *item = megaChatApi[a2]->getChatListItem(chatid);
ASSERT_EQ(item->getNumPreviewers(), 0u) << "Wrong number of previewers.";
delete item;
Expand Down

0 comments on commit e1ccff0

Please sign in to comment.