1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

tests/krb5: Remove accounts in reverse order of addition

This prevents problems if accounts are added as children of other
accounts.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Joseph Sutton 2022-02-01 20:54:39 +13:00 committed by Stefan Metzmacher
parent 26334df74f
commit 90e5802773

View File

@ -115,8 +115,8 @@ class KDCBaseTest(RawKerberosTest):
cls.account_base = f'{secrets.token_hex(4)}_'
cls.account_id = 0
# A set containing DNs of accounts created as part of testing.
cls.accounts = set()
# A list containing DNs of accounts created as part of testing.
cls.accounts = []
cls.account_cache = {}
cls.tkt_cache = {}
@ -137,7 +137,7 @@ class KDCBaseTest(RawKerberosTest):
except ldb.LdbError:
pass
for dn in cls.accounts:
for dn in reversed(cls.accounts):
delete_force(cls._ldb, dn)
if cls._rodc_ctx is not None:
@ -316,7 +316,7 @@ class KDCBaseTest(RawKerberosTest):
creds.set_spn(spn)
#
# Save the account name so it can be deleted in tearDownClass
self.accounts.add(dn)
self.accounts.append(dn)
self.creds_set_enctypes(creds)