From 97af3f7e529188bf04b7716f337c28b53e513a8f Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Wed, 22 May 2024 19:45:21 +0200 Subject: [PATCH] fix_: flaky TestJoinCommunityAsMemberWithMemberAndAdminPermission `waitOnCommunitiesEvent` must be invoked before action that triggers the event. fixes: #4760 --- protocol/communities_messenger_token_permissions_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/protocol/communities_messenger_token_permissions_test.go b/protocol/communities_messenger_token_permissions_test.go index e81e42a72..ab8c103d1 100644 --- a/protocol/communities_messenger_token_permissions_test.go +++ b/protocol/communities_messenger_token_permissions_test.go @@ -959,14 +959,15 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) TestJoinCommunityAsMemberWit }, }, } - response, err = s.owner.CreateCommunityTokenPermission(&permissionRequestAdmin) - s.Require().NoError(err) - s.Require().Len(response.Communities(), 1) waitOnCommunityPermissionCreated = waitOnCommunitiesEvent(s.owner, func(sub *communities.Subscription) bool { return len(sub.Community.TokenPermissions()) == 2 }) + response, err = s.owner.CreateCommunityTokenPermission(&permissionRequestAdmin) + s.Require().NoError(err) + s.Require().Len(response.Communities(), 1) + err = <-waitOnCommunityPermissionCreated s.Require().NoError(err)