selftest: Disable all replication during most replication tests
authorAndrew Bartlett <abartlet@samba.org>
Mon, 18 Jul 2016 04:55:50 +0000 (16:55 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 Jul 2016 11:41:11 +0000 (13:41 +0200)
Rather than just disabling inbound replication, consider that there may be another server
in the test network, and ensure we do not replicate to or from it either.

replica_sync.py is omitted, as it tests some more subtle variations
of the DISABLE_INBOUND_REPL flag.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/torture/drs/python/delete_object.py
source4/torture/drs/python/drs_base.py
source4/torture/drs/python/repl_move.py
source4/torture/drs/python/repl_schema.py

index b7e5d19b58f956ee5f65a99c2816b38a761e8727..620a44659e71526aa66690b09f1d9d0942c2a449 100644 (file)
@@ -41,15 +41,15 @@ class DrsDeleteObjectTestCase(drs_base.DrsBaseTestCase):
     def setUp(self):
         super(DrsDeleteObjectTestCase, self).setUp()
         # disable automatic replication temporary
-        self._disable_inbound_repl(self.dnsname_dc1)
-        self._disable_inbound_repl(self.dnsname_dc2)
+        self._disable_all_repl(self.dnsname_dc1)
+        self._disable_all_repl(self.dnsname_dc2)
         # make sure DCs are synchronized before the test
         self._net_drs_replicate(DC=self.dnsname_dc2, fromDC=self.dnsname_dc1, forced=True)
         self._net_drs_replicate(DC=self.dnsname_dc1, fromDC=self.dnsname_dc2, forced=True)
 
     def tearDown(self):
-        self._enable_inbound_repl(self.dnsname_dc1)
-        self._enable_inbound_repl(self.dnsname_dc2)
+        self._enable_all_repl(self.dnsname_dc1)
+        self._enable_all_repl(self.dnsname_dc2)
         super(DrsDeleteObjectTestCase, self).tearDown()
 
     def _make_username(self):
index e97b065686a208a947123959555d899bf0364b19..aa0a7f69cf963379acbc2cf91b479fbc97d9594b 100644 (file)
@@ -129,3 +129,17 @@ class DrsBaseTestCase(SambaToolCmdTest):
         samba_tool_cmd = self._samba_tool_cmdline("options")
         # disable replication
         self.check_run("%s %s --dsa-option=+DISABLE_INBOUND_REPL" %(samba_tool_cmd, DC))
+
+    def _enable_all_repl(self, DC):
+        # make base command line
+        samba_tool_cmd = self._samba_tool_cmdline("options")
+        # disable replication
+        self.check_run("%s %s --dsa-option=-DISABLE_INBOUND_REPL" %(samba_tool_cmd, DC))
+        self.check_run("%s %s --dsa-option=-DISABLE_OUTBOUND_REPL" %(samba_tool_cmd, DC))
+
+    def _disable_all_repl(self, DC):
+        # make base command line
+        samba_tool_cmd = self._samba_tool_cmdline("options")
+        # disable replication
+        self.check_run("%s %s --dsa-option=+DISABLE_INBOUND_REPL" %(samba_tool_cmd, DC))
+        self.check_run("%s %s --dsa-option=+DISABLE_OUTBOUND_REPL" %(samba_tool_cmd, DC))
index 862defb5c0e63ad24cfae62cf48f394c6e43cf8d..a5f0e3b07fec97838477fbfd8cde80082cb4ddbe 100644 (file)
@@ -55,8 +55,8 @@ class DrsMoveObjectTestCase(drs_base.DrsBaseTestCase):
     def setUp(self):
         super(DrsMoveObjectTestCase, self).setUp()
         # disable automatic replication temporary
-        self._disable_inbound_repl(self.dnsname_dc1)
-        self._disable_inbound_repl(self.dnsname_dc2)
+        self._disable_all_repl(self.dnsname_dc1)
+        self._disable_all_repl(self.dnsname_dc2)
 
         # make sure DCs are synchronized before the test
         self._net_drs_replicate(DC=self.dnsname_dc2, fromDC=self.dnsname_dc1, forced=True)
@@ -94,8 +94,8 @@ class DrsMoveObjectTestCase(drs_base.DrsBaseTestCase):
                 pass
 
         self.ldb_dc1.delete(self.ou2_dn, ["tree_delete:1"])
-        self._enable_inbound_repl(self.dnsname_dc1)
-        self._enable_inbound_repl(self.dnsname_dc2)
+        self._enable_all_repl(self.dnsname_dc1)
+        self._enable_all_repl(self.dnsname_dc2)
         super(DrsMoveObjectTestCase, self).tearDown()
 
     def _make_username(self):
@@ -1830,8 +1830,8 @@ class DrsMoveBetweenTreeOfObjectTestCase(drs_base.DrsBaseTestCase):
     def setUp(self):
         super(DrsMoveBetweenTreeOfObjectTestCase, self).setUp()
         # disable automatic replication temporary
-        self._disable_inbound_repl(self.dnsname_dc1)
-        self._disable_inbound_repl(self.dnsname_dc2)
+        self._disable_all_repl(self.dnsname_dc1)
+        self._disable_all_repl(self.dnsname_dc2)
 
         # make sure DCs are synchronized before the test
         self._net_drs_replicate(DC=self.dnsname_dc2, fromDC=self.dnsname_dc1, forced=True)
@@ -1892,8 +1892,8 @@ class DrsMoveBetweenTreeOfObjectTestCase(drs_base.DrsBaseTestCase):
 
     def tearDown(self):
         self.ldb_dc1.delete(self.ou1_dn, ["tree_delete:1"])
-        self._enable_inbound_repl(self.dnsname_dc1)
-        self._enable_inbound_repl(self.dnsname_dc2)
+        self._enable_all_repl(self.dnsname_dc1)
+        self._enable_all_repl(self.dnsname_dc2)
         super(DrsMoveBetweenTreeOfObjectTestCase, self).tearDown()
 
     def _make_username(self):
index 0bc6d33651a13334623b2a1e24075f0ddf4e024b..eb508cb0c54ca1fa3b6c01aa8d26d9c4493ca7a5 100644 (file)
@@ -54,8 +54,8 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase):
         super(DrsReplSchemaTestCase, self).setUp()
 
         # disable automatic replication temporary
-        self._disable_inbound_repl(self.dnsname_dc1)
-        self._disable_inbound_repl(self.dnsname_dc2)
+        self._disable_all_repl(self.dnsname_dc1)
+        self._disable_all_repl(self.dnsname_dc2)
 
         # make sure DCs are synchronized before the test
         self._net_drs_replicate(DC=self.dnsname_dc2, fromDC=self.dnsname_dc1, forced=True)
@@ -66,8 +66,8 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase):
             DrsReplSchemaTestCase.obj_prefix = "DrsReplSchema-%s" % t
 
     def tearDown(self):
-        self._enable_inbound_repl(self.dnsname_dc1)
-        self._enable_inbound_repl(self.dnsname_dc2)
+        self._enable_all_repl(self.dnsname_dc1)
+        self._enable_all_repl(self.dnsname_dc2)
         super(DrsReplSchemaTestCase, self).tearDown()
 
     def _make_obj_names(self, base_name):
@@ -217,8 +217,8 @@ class DrsReplSchemaTestCase(drs_base.DrsBaseTestCase):
         This ensures that the server
         """
         # disable automatic replication temporary
-        self._disable_inbound_repl(self.dnsname_dc1)
-        self._disable_inbound_repl(self.dnsname_dc2)
+        self._disable_all_repl(self.dnsname_dc1)
+        self._disable_all_repl(self.dnsname_dc2)
 
        # add new attributeSchema object
         (a_ldn, a_dn) = self._schema_new_attr(self.ldb_dc1, "attr-OU-S", 3)