mirror of
https://github.com/samba-team/samba.git
synced 2025-12-24 04:23:53 +03:00
pytest:samba-tool dns: more robust clean-up
If setUp() fails (and here we have a big .setUp), .tearDown is not run, and that can leave the zone undeleted, breaking all the other tests who expect to be able to recreate it. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Douglas Bagnall
parent
b11ea9d7ad
commit
074f9e1486
@@ -40,6 +40,7 @@ class DnsCmdTestCase(SambaToolCmdTest):
|
||||
self.testip = "192.168.0.193"
|
||||
self.testip2 = "192.168.0.194"
|
||||
|
||||
self.addCleanup(self.deleteZone)
|
||||
self.addZone()
|
||||
|
||||
# Note: SOA types don't work (and shouldn't), as we only have one zone per DNS record.
|
||||
@@ -115,10 +116,6 @@ class DnsCmdTestCase(SambaToolCmdTest):
|
||||
"SRV": bad_srv
|
||||
}
|
||||
|
||||
def tearDown(self):
|
||||
self.deleteZone()
|
||||
super(DnsCmdTestCase, self).tearDown()
|
||||
|
||||
def resetZone(self):
|
||||
self.deleteZone()
|
||||
self.addZone()
|
||||
|
||||
Reference in New Issue
Block a user