From: Tim Beale Date: Tue, 12 Mar 2019 21:18:41 +0000 (+1300) Subject: tests: Make IPv4 assumption explicit X-Git-Tag: talloc-2.2.0~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fb01c5b11fe4acfe1178f42cccb24136ae938e5;p=thirdparty%2Fsamba.git tests: Make IPv4 assumption explicit This test is asserting the expected number of *IPv4* addresses, not any interface address (including IPv6). It works currently because the selftest client doesn't have an IPv6 address in its smb.conf. This patch makes the IPv4 assumption explicit by importing interface_ips_v4() from the provision code. We need to tweak this to pass through an 'all_interfaces' flag, otherwise it filters out the loopback IP addresses that the testenv is using. Signed-off-by: Tim Beale Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 1b7762eb12b..0a3a7b89cb7 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -1853,9 +1853,9 @@ def checksysvolacl(samdb, netlogon, sysvol, domainsid, dnsdomain, domaindn, direct_db_access) -def interface_ips_v4(lp): +def interface_ips_v4(lp, all_interfaces=False): """return only IPv4 IPs""" - ips = samba.interface_ips(lp, False) + ips = samba.interface_ips(lp, all_interfaces) ret = [] for i in ips: if i.find(':') == -1: diff --git a/python/samba/tests/join.py b/python/samba/tests/join.py index 09a102e26af..e0ad34e1e74 100644 --- a/python/samba/tests/join.py +++ b/python/samba/tests/join.py @@ -24,6 +24,7 @@ from samba.tests.dns_base import DNSTKeyTest from samba.join import DCJoinContext from samba.dcerpc import drsuapi, misc, dns from samba.credentials import Credentials +from samba.provision import interface_ips_v4 def get_logger(name="subunit"): @@ -92,7 +93,7 @@ class JoinTestCase(DNSTKeyTest): questions.append(q) # Get expected IPs - IPs = samba.interface_ips(self.lp) + IPs = interface_ips_v4(self.lp, all_interfaces=True) self.finish_name_packet(p, questions) (response, response_packet) = self.dns_transaction_tcp(p, host=self.server_ip) @@ -132,7 +133,7 @@ class JoinTestCase(DNSTKeyTest): updates = [] # Delete the old expected IPs - IPs = samba.interface_ips(self.lp) + IPs = interface_ips_v4(self.lp, all_interfaces=True) for IP in IPs[1:]: if ":" in IP: r = dns.res_rec()