Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2022

Conversation

sheny1xuan
Copy link
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
Member

@EmperorYP7 @divy9881 @noob20000405 please review

@hsluoyz
Copy link
Member

hsluoyz commented Mar 10, 2022

@EmperorYP7

Copy link
Member

@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!

@@ -390,12 +390,13 @@ void Enforcer::ClearPolicy() {

// LoadPolicy reloads the policy from file/database.
void Enforcer::LoadPolicy() {
this->ClearPolicy();
// must use base's LoadPolicy to avoid dead lock
Enforcer::ClearPolicy();
Copy link
Member

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 casbin:master Mar 13, 2022
@github-actions
Copy link

🎉 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