]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Allow bypassing cache when creating accounts
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 8 Oct 2021 02:41:35 +0000 (15:41 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Oct 2021 18:59:31 +0000 (18:59 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14642

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/kdc_base_test.py

index 8a5e12bbed45a82a5cbc2c5dcf2309f59b157f38..87160f675ae846477586b176ee17f55a0033e881 100644 (file)
@@ -610,7 +610,8 @@ class KDCBaseTest(RawKerberosTest):
 
     def get_cached_creds(self, *,
                          machine_account,
-                         opts=None):
+                         opts=None,
+                         use_cache=True):
         if opts is None:
             opts = {}
 
@@ -638,9 +639,13 @@ class KDCBaseTest(RawKerberosTest):
 
         cache_key = tuple(sorted(account_opts.items()))
 
-        creds = self.account_cache.get(cache_key)
-        if creds is None:
-            creds = self.create_account_opts(**account_opts)
+        if use_cache:
+            creds = self.account_cache.get(cache_key)
+            if creds is not None:
+                return creds
+
+        creds = self.create_account_opts(**account_opts)
+        if use_cache:
             self.account_cache[cache_key] = creds
 
         return creds