Skip to content

fix: fix sync test by use base enforcer's ClearPolicy and BuildRoleLink.#191

Merged
EmperorYP7 merged 1 commit into
apache:masterfrom
sheny1xuan:synctest
Mar 13, 2022
Merged

fix: fix sync test by use base enforcer's ClearPolicy and BuildRoleLink.#191
EmperorYP7 merged 1 commit into
apache:masterfrom
sheny1xuan:synctest

Conversation

@sheny1xuan
Copy link
Copy Markdown
Contributor

@sheny1xuan sheny1xuan commented Mar 10, 2022

Signed-off-by: stonex 1479765922@qq.com

Fixes #190

  • I think the reason these test can't work may be the deadlock of policyMutex (lock it twice) in load policy.
  • Use base enforcer's ClearPolicy and BuildRoleLink.

…nks.

Signed-off-by: stonex <1479765922@qq.com>
@casbin-bot
Copy link
Copy Markdown

@EmperorYP7 @divy9881 @noob20000405 please review

@hsluoyz
Copy link
Copy Markdown
Member

hsluoyz commented Mar 10, 2022

@EmperorYP7

Copy link
Copy Markdown
Contributor

@EmperorYP7 EmperorYP7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread casbin/enforcer.cpp
void Enforcer::LoadPolicy() {
this->ClearPolicy();
// must use base's LoadPolicy to avoid dead lock
Enforcer::ClearPolicy();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on debugging!

@EmperorYP7 EmperorYP7 merged commit dc1499d into apache:master Mar 13, 2022
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.49.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@sheny1xuan sheny1xuan deleted the synctest branch March 17, 2022 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test] Implementing unit tests for SyncedEnforcer

4 participants