From: Joseph Sutton Date: Tue, 29 Aug 2023 05:31:14 +0000 (+1200) Subject: pytest/dns_aging: Correctly check that record is tombstoned X-Git-Tag: tevent-0.16.0~771 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=472d80c1c9f24bd352cd1cb41b0d66dde418ce91;p=thirdparty%2Fsamba.git pytest/dns_aging: Correctly check that record is tombstoned 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=)) 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 Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/dns_aging.py b/python/samba/tests/dns_aging.py index 29c0d9516b0..97c87d2b2f4 100644 --- a/python/samba/tests/dns_aging.py +++ b/python/samba/tests/dns_aging.py @@ -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)