From 6e4e914c76c209f30892b2a6a2b448c344df385f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 8 Jul 2016 12:54:40 +1200 Subject: [PATCH] selftest: Add more tests for samba-tool drs replicate Signed-off-by: Andrew Bartlett Reviewed-by: Andreas Schneider Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Fri Jul 8 13:39:01 CEST 2016 on sn-devel-144 --- python/samba/tests/blackbox/samba_tool_drs.py | 45 +++++++++++++++++++ source4/selftest/tests.py | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/python/samba/tests/blackbox/samba_tool_drs.py b/python/samba/tests/blackbox/samba_tool_drs.py index 6056645e267..afaa4afb869 100644 --- a/python/samba/tests/blackbox/samba_tool_drs.py +++ b/python/samba/tests/blackbox/samba_tool_drs.py @@ -103,6 +103,51 @@ class SambaToolDrsTests(samba.tests.BlackboxTestCase): self.assertTrue("Replicate from" in out) self.assertTrue("was successful" in out) + def test_samba_tool_replicate_local_online(self): + """Tests 'samba-tool drs replicate --local-online' command.""" + + # Output should be like 'Replicate from to was successful.' + nc_name = self._get_rootDSE(self.dc1)["defaultNamingContext"] + out = self.check_output("samba-tool drs replicate --local-online %s %s %s" % (self.dc1, + self.dc2, + nc_name)) + self.assertTrue("Replicate from" in out) + self.assertTrue("was successful" in out) + + def test_samba_tool_replicate_local_machine_creds(self): + """Tests 'samba-tool drs replicate --local -P' command (uses machine creds).""" + + # Output should be like 'Replicate from to was successful.' + nc_name = self._get_rootDSE(self.dc1)["defaultNamingContext"] + out = self.check_output("samba-tool drs replicate -P --local %s %s %s" % (self.dc1, + self.dc2, + nc_name)) + self.assertTrue("Replicate from" in out) + self.assertTrue("was successful" in out) + + def test_samba_tool_replicate_local(self): + """Tests 'samba-tool drs replicate --local' command (uses machine creds).""" + + # Output should be like 'Replicate from to was successful.' + nc_name = self._get_rootDSE(self.dc1)["defaultNamingContext"] + out = self.check_output("samba-tool drs replicate --local %s %s %s %s" % (self.dc1, + self.dc2, + nc_name, + self.cmdline_creds)) + self.assertTrue("Replicate from" in out) + self.assertTrue("was successful" in out) + + def test_samba_tool_replicate_machine_creds(self): + """Tests 'samba-tool drs replicate -P' command with machine creds.""" + + # Output should be like 'Replicate from to was successful.' + nc_name = self._get_rootDSE(self.dc1)["defaultNamingContext"] + out = self.check_output("samba-tool drs replicate -P %s %s %s" % (self.dc1, + self.dc2, + nc_name)) + self.assertTrue("Replicate from" in out) + self.assertTrue("was successful" in out) + def test_samba_tool_drs_clone_dc(self): """Tests 'samba-tool drs clone-dc-database' command.""" server_rootdse = self._get_rootDSE(self.dc1) diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index f3fe5546831..de7ef232160 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -635,7 +635,7 @@ plantestsuite("samba4.blackbox.renamedc.sh", "none", ["PYTHON=%s" % python, os.p for env in ['vampire_dc', 'promoted_dc']: # DRS python tests - planoldpythontestsuite(env, "samba.tests.blackbox.samba_tool_drs", + planoldpythontestsuite("%s:local" % env, "samba.tests.blackbox.samba_tool_drs", environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) planoldpythontestsuite("%s:local" % env, "replica_sync", -- 2.47.3