From 0b3f2c659ab85bb5a6b48ec96f0f34cb109d12f0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 18 Jul 2016 16:55:50 +1200 Subject: [PATCH] selftest: Disable all replication during most replication tests 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 Reviewed-by: Douglas Bagnall --- source4/torture/drs/python/delete_object.py | 8 ++++---- source4/torture/drs/python/drs_base.py | 14 ++++++++++++++ source4/torture/drs/python/repl_move.py | 16 ++++++++-------- source4/torture/drs/python/repl_schema.py | 12 ++++++------ 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/source4/torture/drs/python/delete_object.py b/source4/torture/drs/python/delete_object.py index b7e5d19b58f..620a44659e7 100644 --- a/source4/torture/drs/python/delete_object.py +++ b/source4/torture/drs/python/delete_object.py @@ -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): diff --git a/source4/torture/drs/python/drs_base.py b/source4/torture/drs/python/drs_base.py index e97b065686a..aa0a7f69cf9 100644 --- a/source4/torture/drs/python/drs_base.py +++ b/source4/torture/drs/python/drs_base.py @@ -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)) diff --git a/source4/torture/drs/python/repl_move.py b/source4/torture/drs/python/repl_move.py index 862defb5c0e..a5f0e3b07fe 100644 --- a/source4/torture/drs/python/repl_move.py +++ b/source4/torture/drs/python/repl_move.py @@ -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): diff --git a/source4/torture/drs/python/repl_schema.py b/source4/torture/drs/python/repl_schema.py index 0bc6d33651a..eb508cb0c54 100644 --- a/source4/torture/drs/python/repl_schema.py +++ b/source4/torture/drs/python/repl_schema.py @@ -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) -- 2.47.3