1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-18 08:23:51 +03:00

python/samba/tests: Remove DCs joined to test samba-tool behaviour

Otherwise we have the live DCs spamming the logs looking for the
long-gone test servers:

Failed to connect host fd00::5357:5f0b on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND
Failed to connect host fd00::5357:5f0b (6f44653d-18c8-4bf4-b2e7-6f85cf7b0f74._msdcs.addom.samba.example.com) on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND.
Failed to connect host 10.53.57.11 on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND
Failed to connect host 10.53.57.11 (6f44653d-18c8-4bf4-b2e7-6f85cf7b0f74._msdcs.addom.samba.example.com) on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND.
Failed to connect host 10.53.57.12 on port 135 - NT_STATUS_OBJECT_NAME_NOT_FOUND

This avoids spamming the GitLab pipeline logs with a lot of noise,
as there is a size limit to the output, as well as being cleaner.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett
2021-06-18 20:46:51 +12:00
committed by Gary Lockyer
parent 84de4eb19e
commit e9e6d1569b
4 changed files with 37 additions and 3 deletions

View File

@@ -21,6 +21,7 @@
#
# These can all be accesses via os.environ["VARIBLENAME"] when needed
import os
import random
import string
from samba.auth import system_session
@@ -150,3 +151,13 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase):
def assertWithin(self, val1, val2, delta, msg=""):
"""Assert that val1 is within delta of val2, useful for time computations"""
self.assertTrue(((val1 + delta) > val2) and ((val1 - delta) < val2), msg)
def cleanup_join(self, netbios_name):
(result, out, err) \
= self.runsubcmd("domain",
"demote",
("--remove-other-dead-server=%s " % netbios_name),
("-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"])),
("--server=%s" % os.environ["SERVER"]))
self.assertCmdSuccess(result, out, err)