fix_: flaky testReevaluateMemberPrivilegedRoleInClosedCommunity

`waitOnCommunitiesEvent` must be invoked before action that triggers
the event.

fixes: #4578
fixes: #4761
This commit is contained in:
Patryk Osmaczko 2024-05-23 18:29:46 +02:00 committed by osmaczko
parent d80db940d7
commit 709d75d69c
1 changed files with 7 additions and 7 deletions

View File

@ -1833,6 +1833,13 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivileg
PermissionID: tokenMemberPermission.Id,
}
waitOnReevaluation := waitOnCommunitiesEvent(s.owner, func(sub *communities.Subscription) bool {
if sub.Community == nil {
return false
}
return !checkRoleBasedOnThePermissionType(permissionType, &s.alice.identity.PublicKey, sub.Community)
})
response, err = s.owner.DeleteCommunityTokenPermission(deleteMemberTokenPermission)
s.Require().NoError(err)
s.Require().NotNil(response)
@ -1843,13 +1850,6 @@ func (s *MessengerCommunitiesTokenPermissionsSuite) testReevaluateMemberPrivileg
s.Require().NoError(err)
s.Require().Len(response.Communities()[0].TokenPermissions(), 0)
waitOnReevaluation := waitOnCommunitiesEvent(s.owner, func(sub *communities.Subscription) bool {
if sub.Community == nil {
return false
}
return !checkRoleBasedOnThePermissionType(permissionType, &s.alice.identity.PublicKey, sub.Community)
})
err = s.owner.communitiesManager.ForceMembersReevaluation(community.ID())
s.Require().NoError(err)