]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pytest/dns_aging: Correctly check that record is tombstoned
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 29 Aug 2023 05:31:14 +0000 (17:31 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 Aug 2023 02:15:29 +0000 (02:15 +0000)
We were passing in as the name parameter to assert_tombstoned() an NDR
Python object, rather than a string. This meant that the LDAP search
filter would look something like this:

(&(objectClass=dnsNode)(name=<dnsp.DnssrvRpcRecord talloc based object at 0x29abee0>))

and we would fail to find any records.

These searches should have a better chance of working if we pass in the
name of the record instead.

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

index 29c0d9516b0a02ede9e929e16b555e48fa9435a7..97c87d2b2f413fb8d0928bfa163948711a3cce82 100644 (file)
@@ -2162,7 +2162,7 @@ class TestDNSAging(DNSTest):
         self.assertEqual(r.ancount, 0)
         recs = self.ldap_get_records(D)
         self.assertEqual(len(recs), 1)
-        self.assert_tombstoned(recs[0])
+        self.assert_tombstoned(D)
 
         # others unchanged.
         atime = self.get_unique_txt_record(A, A).dwTimeStamp
@@ -2182,17 +2182,17 @@ class TestDNSAging(DNSTest):
         dsdb._dns_delete_tombstones(file_samdb)
         recs = self.ldap_get_records(D)
         self.assertEqual(len(recs), 1)
-        self.assert_tombstoned(recs[0])
+        self.assert_tombstoned(D)
 
         # Let's delete C using rpc, and ensure it survives dns_delete_tombstones
         self.rpc_delete_txt(C, C)
         recs = self.ldap_get_records(C)
         self.assertEqual(len(recs), 1)
-        self.assert_tombstoned(recs[0])
+        self.assert_tombstoned(C)
         dsdb._dns_delete_tombstones(file_samdb)
         recs = self.ldap_get_records(C)
         self.assertEqual(len(recs), 1)
-        self.assert_tombstoned(recs[0])
+        self.assert_tombstoned(C)
 
         # now let's wind A and B back to either side of the two week
         # threshold. A should survive, B should not.
@@ -2202,7 +2202,7 @@ class TestDNSAging(DNSTest):
 
         recs = self.ldap_get_records(A)
         self.assertEqual(len(recs), 1)
-        self.assert_tombstoned(recs[0])
+        self.assert_tombstoned(A)
 
         recs = self.ldap_get_records(B)
         self.assertEqual(len(recs), 0)