tests: retry on correct LDAP exceptions for samba tests

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-01-27 17:59:38 +01:00
parent 3651fb5daf
commit 6e5ad60cea
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@
from typing import Any, Optional from typing import Any, Optional
from django.db.models import Q from django.db.models import Q
from ldap3.core.exceptions import LDAPSessionTerminatedByServerError
from authentik.blueprints.tests import apply_blueprint from authentik.blueprints.tests import apply_blueprint
from authentik.core.models import Group, User from authentik.core.models import Group, User
@ -37,7 +38,7 @@ class TestSourceLDAPSamba(SeleniumTestCase):
}, },
} }
@retry() @retry(exceptions=[LDAPSessionTerminatedByServerError])
@apply_blueprint( @apply_blueprint(
"system/sources-ldap.yaml", "system/sources-ldap.yaml",
) )
@ -68,7 +69,7 @@ class TestSourceLDAPSamba(SeleniumTestCase):
self.assertTrue(User.objects.filter(username="john").exists()) self.assertTrue(User.objects.filter(username="john").exists())
self.assertTrue(User.objects.filter(username="harry").exists()) self.assertTrue(User.objects.filter(username="harry").exists())
@retry() @retry(exceptions=[LDAPSessionTerminatedByServerError])
@apply_blueprint( @apply_blueprint(
"system/sources-ldap.yaml", "system/sources-ldap.yaml",
) )
@ -111,7 +112,7 @@ class TestSourceLDAPSamba(SeleniumTestCase):
) )
self.assertEqual(list(User.objects.get(username="harry").ak_groups.all()), []) self.assertEqual(list(User.objects.get(username="harry").ak_groups.all()), [])
@retry() @retry(exceptions=[LDAPSessionTerminatedByServerError])
@apply_blueprint( @apply_blueprint(
"system/sources-ldap.yaml", "system/sources-ldap.yaml",
) )