From: Stefan Metzmacher Date: Wed, 23 Jan 2019 21:29:19 +0000 (+0100) Subject: selftest: use 10.53.57.0/8 instead of 127.0.0.1/8 X-Git-Tag: ldb-2.2.0~1174 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05d3a909d5a66ab2b9a6b00416b7087588dbdef9;p=thirdparty%2Fsamba.git selftest: use 10.53.57.0/8 instead of 127.0.0.1/8 This makes our testing much more realistic and allows the removal of some knowfail entries. It also means the testing with network namespaces on Linux can use the same addresses as our socket wrapper testing. Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/python/samba/tests/blackbox/mdfind.py b/python/samba/tests/blackbox/mdfind.py index e00af054007..5c1c0c3d155 100644 --- a/python/samba/tests/blackbox/mdfind.py +++ b/python/samba/tests/blackbox/mdfind.py @@ -67,7 +67,7 @@ class MdfindBlackboxTests(BlackboxTestCase): def setUp(self): super(MdfindBlackboxTests, self).setUp() - self.server = HTTPServer(('127.0.0.35', 8080), + self.server = HTTPServer(('10.53.57.35', 8080), MdssvcHTTPRequestHandler, bind_and_activate=False) diff --git a/python/samba/tests/dcerpc/mdssvc.py b/python/samba/tests/dcerpc/mdssvc.py index 68243aa4354..b0df509ddc7 100644 --- a/python/samba/tests/dcerpc/mdssvc.py +++ b/python/samba/tests/dcerpc/mdssvc.py @@ -77,7 +77,7 @@ class MdssvcTests(RpcInterfaceTestCase): self.pipe = mdssvc.mdssvc('ncacn_np:fileserver[/pipe/mdssvc]', self.get_loadparm()) - self.server = HTTPServer(('127.0.0.35', 8080), + self.server = HTTPServer(('10.53.57.35', 8080), MdssvcHTTPRequestHandler, bind_and_activate=False) diff --git a/python/samba/tests/param.py b/python/samba/tests/param.py index 0a7f86adad7..ae58074b80b 100644 --- a/python/samba/tests/param.py +++ b/python/samba/tests/param.py @@ -98,7 +98,7 @@ class LoadParmTestCase(samba.tests.TestCaseInTempDir): 'global', self.tempf)) content = open(self.tempf, 'r').read() - self.assertIn('127.0.0.', content) + self.assertIn('10.53.57.', content) def test_samdb_url(self): samba_lp = param.LoadParm() diff --git a/selftest/knownfail.d/dns b/selftest/knownfail.d/dns index 70a719a818a..bf563632472 100644 --- a/selftest/knownfail.d/dns +++ b/selftest/knownfail.d/dns @@ -6,7 +6,6 @@ samba.tests.dns.__main__.TestDNSUpdates.test_delete_record\(rodc:local\) samba.tests.dns.__main__.TestDNSUpdates.test_readd_record\(rodc:local\) samba.tests.dns.__main__.TestDNSUpdates.test_update_add_mx_record\(rodc:local\) samba.tests.dns.__main__.TestDNSUpdates.test_update_add_txt_record\(rodc:local\) -samba.tests.dns.__main__.TestInvalidQueries.test_one_a_query\(rodc:local\) samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_empty_txt_records\(rodc:local\) samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_hex_char_txt_record\(rodc:local\) samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_null_char_txt_record\(rodc:local\) @@ -18,7 +17,6 @@ samba.tests.dns.__main__.TestDNSUpdates.test_delete_record\(vampire_dc:local\) samba.tests.dns.__main__.TestDNSUpdates.test_readd_record\(vampire_dc:local\) samba.tests.dns.__main__.TestDNSUpdates.test_update_add_mx_record\(vampire_dc:local\) samba.tests.dns.__main__.TestDNSUpdates.test_update_add_txt_record\(vampire_dc:local\) -samba.tests.dns.__main__.TestInvalidQueries.test_one_a_query\(vampire_dc:local\) samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_empty_txt_records\(vampire_dc:local\) samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_hex_char_txt_record\(vampire_dc:local\) samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_null_char_txt_record\(vampire_dc:local\) @@ -63,12 +61,6 @@ samba.tests.dns.__main__.TestZones.test_static_record_dynamic_update\(vampire_dc samba.tests.dns.__main__.TestComplexQueries.test_cname_two_chain\(vampire_dc:local\) samba.tests.dns.__main__.TestComplexQueries.test_one_a_query\(vampire_dc:local\) -samba.tests.dns.__main__.TestSimpleQueries.test_one_a_query\(vampire_dc:local\) -samba.tests.dns.__main__.TestSimpleQueries.test_one_a_query_tcp\(vampire_dc:local\) -samba.tests.dns.__main__.TestSimpleQueries.test_qtype_all_query\(vampire_dc:local\) -samba.tests.dns.__main__.TestSimpleQueries.test_one_a_query\(rodc:local\) -samba.tests.dns.__main__.TestSimpleQueries.test_one_a_query_tcp\(rodc:local\) -samba.tests.dns.__main__.TestSimpleQueries.test_qtype_all_query\(rodc:local\) # The SOA override should not pass against the RODC, it must not overstamp samba.tests.dns.__main__.TestSimpleQueries.test_one_SOA_query\(rodc:local\) diff --git a/selftest/ns/README b/selftest/ns/README index a8ad1c0444f..896fe15fff7 100644 --- a/selftest/ns/README +++ b/selftest/ns/README @@ -26,10 +26,10 @@ selftest namespace (which itself is a child of whatever namespace you run How does it work? ================= -Normally when 'make test' is run, every testenv uses a 127.0.0.x IP address +Normally when 'make test' is run, every testenv uses a 10.53.57.x IP address and socket-wrapper passes the packets between them. -With namespaces, we can use real IP addresses and have the packets pass through +With namespaces, we also use 10.53.57.x IP addresses but have the packets pass through the kernel's IP stack normally, as it forwards them between namespaces. We use veth interfaces for this. veth is a type of virtual interface supported @@ -43,7 +43,7 @@ namespace, and the other end is added to a new namespace that we'll run samba in. E.g. selftest.pl veth21-br ------------------------ veth21 samba (ad_dc_ntvfs) - 10.0.0.11 10.0.0.21 + 10.53.57.11 10.53.57.21 Namespace 1 Namespace 2 However, we need to run multiple different testenvs and have them talk to @@ -52,11 +52,11 @@ up the namespaces, which essentially just acts as a hub. So connecting together multiple testenvs looks more like this: selftest.pl +-- veth21-br ------------------------ veth21 samba (ad_dc_ntvfs) - | 10.0.0.21 + | 10.53.57.21 selftest0 --+ Namespace 2 - 10.0.0.11 | + 10.53.57.11 | +-- veth22-br ------------------------ veth22 samba (vampire_dc) - 10.0.0.22 + 10.53.57.22 Namespace 1 Namespace 3 The veth interfaces are named vethX and vethX-br, where X is the @@ -114,7 +114,7 @@ sudo ip link set testenv-veth1 netns $SELFTEST_PID 4. Configure the veth end in the default namespace to be in the same subnet as the selftest network: sudo ip link set dev testenv-veth0 up -sudo ip addr add 10.0.0.63/24 dev testenv-veth0 +sudo ip addr add 10.53.57.63/24 dev testenv-veth0 5. Enter the selftest namespace, bring that end of the pipe up, and add it to to the main selftest0 bridge (that connects all the DCs together). We also need @@ -122,14 +122,14 @@ to add a default route from selftest back to your PC's default namespace. nsenter -t $SELFTEST_PID --net --user --preserve-credentials ip link set dev testenv-veth1 up ip link set testenv-veth1 master selftest0 -ip route add default via 10.0.0.63 +ip route add default via 10.53.57.63 logout Your Windows VM and samba testenv should now be able to talk to each other over IP! 6. The other step is to get DNS working. You probably need to add dns_hub -(10.0.0.64) as a nameserver (at least on your Windows VM). +(10.53.57.64) as a nameserver (at least on your Windows VM). This should work for using RSAT tools on samba, or joining Windows to Samba (depending on the schema version). Joining samba to Windows is a bit more diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 941943f0306..d14df92a11c 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -487,6 +487,7 @@ foreach (@opt_include) { # We give the selftest client 6 different IPv4 addresses to use. Most tests # only use the first (.11) IP. Note that winsreplication.c is one test that # uses the other IPs (search for iface_list_count()). +$ENV{SOCKET_WRAPPER_IPV4_NETWORK} = "10.53.57.0"; my $interfaces = Samba::get_interfaces_config("client", 6); my $clientdir = "$prefix_abs/client"; diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm index 50a81ff0490..e415110d8e7 100644 --- a/selftest/target/Samba.pm +++ b/selftest/target/Samba.pm @@ -576,13 +576,7 @@ sub get_ipv4_addr $swiface += $iface_num; } - if (use_namespaces()) { - # use real IPs if selftest is running in its own network namespace - return "10.0.0.$swiface"; - } else { - # use loopback IPs with socket-wrapper - return "127.0.0.$swiface"; - } + return "10.53.57.$swiface"; } sub get_ipv6_addr diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 3461ca26fc0..fe871af4573 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -1250,11 +1250,12 @@ sub setup_fileserver my $dropbox_sharedir="$share_dir/dropbox"; push(@dirs,$dropbox_sharedir); + my $ip4 = Samba::get_ipv4_addr("FILESERVER"); my $fileserver_options = " kernel change notify = yes rpc_server:mdssvc = embedded spotlight backend = elasticsearch - elasticsearch:address = 127.0.0.35 + elasticsearch:address = $ip4 elasticsearch:port = 8080 elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json @@ -2830,7 +2831,7 @@ sub wait_for_start($$$$$) } else { system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__"); system("$nmblookup $envvars->{CONFIGURATION} __SAMBA__"); - system("$nmblookup $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__"); + system("$nmblookup $envvars->{CONFIGURATION} -U 10.255.255.255 __SAMBA__"); system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}"); } $count++; @@ -3037,7 +3038,7 @@ sub provision_ctdb($$$$) my %node = (); my $server_name = "ctdb${i}"; my $pub_iface = Samba::get_interface($server_name); - my $ip = "127.0.0.${pub_iface}"; + my $ip = Samba::get_ipv4_addr($server_name); $node{NODE_NUMBER} = "$i"; $node{SERVER_NAME} = "$server_name"; diff --git a/source3/script/tests/test_async_req.sh b/source3/script/tests/test_async_req.sh index a92f9909911..fdbcb59f13d 100755 --- a/source3/script/tests/test_async_req.sh +++ b/source3/script/tests/test_async_req.sh @@ -5,6 +5,9 @@ incdir=`dirname $0`/../../../testprogs/blackbox failed=0 +SOCKET_WRAPPER_IPV4_NETWORK="127.0.0.0" +export SOCKET_WRAPPER_IPV4_NETWORK + testit "async_connect_send" $VALGRIND $BINDIR/async_connect_send_test || failed=`expr $failed + 1` diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 1a8116332b9..7d2ba5676eb 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -759,10 +759,10 @@ for env in ["chgdcpass", "ad_member"]: if have_heimdal_support: planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log", extra_args=['-U"$USERNAME%$PASSWORD"'], - environ={'CLIENT_IP': '127.0.0.11', + environ={'CLIENT_IP': '10.53.57.11', 'SOCKET_WRAPPER_DEFAULT_IFACE': 11}) planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log", extra_args=['-U"$USERNAME%$PASSWORD"'], - environ={'CLIENT_IP': '127.0.0.11', + environ={'CLIENT_IP': '10.53.57.11', 'SOCKET_WRAPPER_DEFAULT_IFACE': 11}) planoldpythontestsuite("ad_dc", "samba.tests.auth_log_pass_change", extra_args=['-U"$USERNAME%$PASSWORD"'])