samba-tool/tests: Check that dns cleanup does not spuriously remove entries
authorGarming Sam <garming@catalyst.net.nz>
Wed, 31 Jan 2018 03:13:14 +0000 (16:13 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 8 Feb 2018 09:00:12 +0000 (10:00 +0100)
This might happen in the multi-record case.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb  8 10:00:13 CET 2018 on sn-devel-144

python/samba/tests/samba_tool/dnscmd.py

index 780af4f8bd064798288b4e3308cfdbc8c0bbacfe..bcd2c73981bfee42571abe127a6c658f8215d95b 100644 (file)
@@ -800,7 +800,7 @@ class DnsCmdTestCase(SambaToolCmdTest):
             base="DC=DomainDnsZones,{}".format(self.samdb.get_default_basedn()),
             scope=ldb.SCOPE_SUBTREE,
             expression="(&(objectClass=dnsNode)(name={}))".format(srv_name),
             base="DC=DomainDnsZones,{}".format(self.samdb.get_default_basedn()),
             scope=ldb.SCOPE_SUBTREE,
             expression="(&(objectClass=dnsNode)(name={}))".format(srv_name),
-            attrs=['dnsRecord'])
+            attrs=['dnsRecord', 'dNSTombstoned'])
 
         # dnsRecord for host1 should be deleted
         self.assertEqual(len(records[0]['dnsRecord']), 1)
 
         # dnsRecord for host1 should be deleted
         self.assertEqual(len(records[0]['dnsRecord']), 1)
@@ -813,6 +813,10 @@ class DnsCmdTestCase(SambaToolCmdTest):
         dnshostname2 = 'host2.{}'.format(self.zone.lower())
         self.assertEqual(dns_record_obj.data.nameTarget, dnshostname2)
 
         dnshostname2 = 'host2.{}'.format(self.zone.lower())
         self.assertEqual(dns_record_obj.data.nameTarget, dnshostname2)
 
+        # assert that the record isn't spuriously tombstoned
+        self.assertTrue('dNSTombstoned' not in records[0] or
+                        str(record['dNSTombstoned']) == 'FALSE')
+
     def test_dns_wildcards(self):
         """
         Ensure that DNS wild card entries can be added deleted and queried
     def test_dns_wildcards(self):
         """
         Ensure that DNS wild card entries can be added deleted and queried