1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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 <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-01-23 22:29:19 +01:00 committed by Andreas Schneider
parent 83f6ff9006
commit 05d3a909d5
10 changed files with 23 additions and 32 deletions

View File

@ -67,7 +67,7 @@ class MdfindBlackboxTests(BlackboxTestCase):
def setUp(self): def setUp(self):
super(MdfindBlackboxTests, self).setUp() super(MdfindBlackboxTests, self).setUp()
self.server = HTTPServer(('127.0.0.35', 8080), self.server = HTTPServer(('10.53.57.35', 8080),
MdssvcHTTPRequestHandler, MdssvcHTTPRequestHandler,
bind_and_activate=False) bind_and_activate=False)

View File

@ -77,7 +77,7 @@ class MdssvcTests(RpcInterfaceTestCase):
self.pipe = mdssvc.mdssvc('ncacn_np:fileserver[/pipe/mdssvc]', self.get_loadparm()) 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, MdssvcHTTPRequestHandler,
bind_and_activate=False) bind_and_activate=False)

View File

@ -98,7 +98,7 @@ class LoadParmTestCase(samba.tests.TestCaseInTempDir):
'global', 'global',
self.tempf)) self.tempf))
content = open(self.tempf, 'r').read() content = open(self.tempf, 'r').read()
self.assertIn('127.0.0.', content) self.assertIn('10.53.57.', content)
def test_samdb_url(self): def test_samdb_url(self):
samba_lp = param.LoadParm() samba_lp = param.LoadParm()

View File

@ -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_readd_record\(rodc:local\)
samba.tests.dns.__main__.TestDNSUpdates.test_update_add_mx_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__.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_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_hex_char_txt_record\(rodc:local\)
samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_null_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_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_mx_record\(vampire_dc:local\)
samba.tests.dns.__main__.TestDNSUpdates.test_update_add_txt_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_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_hex_char_txt_record\(vampire_dc:local\)
samba.tests.dns.__main__.TestRPCRoundtrip.test_update_add_null_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_cname_two_chain\(vampire_dc:local\)
samba.tests.dns.__main__.TestComplexQueries.test_one_a_query\(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 # The SOA override should not pass against the RODC, it must not overstamp
samba.tests.dns.__main__.TestSimpleQueries.test_one_SOA_query\(rodc:local\) samba.tests.dns.__main__.TestSimpleQueries.test_one_SOA_query\(rodc:local\)

View File

@ -26,10 +26,10 @@ selftest namespace (which itself is a child of whatever namespace you run
How does it work? 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. 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. 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 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. samba in. E.g.
selftest.pl veth21-br ------------------------ veth21 samba (ad_dc_ntvfs) 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 Namespace 1 Namespace 2
However, we need to run multiple different testenvs and have them talk to 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: multiple testenvs looks more like this:
selftest.pl +-- veth21-br ------------------------ veth21 samba (ad_dc_ntvfs) selftest.pl +-- veth21-br ------------------------ veth21 samba (ad_dc_ntvfs)
| 10.0.0.21 | 10.53.57.21
selftest0 --+ Namespace 2 selftest0 --+ Namespace 2
10.0.0.11 | 10.53.57.11 |
+-- veth22-br ------------------------ veth22 samba (vampire_dc) +-- veth22-br ------------------------ veth22 samba (vampire_dc)
10.0.0.22 10.53.57.22
Namespace 1 Namespace 3 Namespace 1 Namespace 3
The veth interfaces are named vethX and vethX-br, where X is the 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 4. Configure the veth end in the default namespace to be in the same subnet
as the selftest network: as the selftest network:
sudo ip link set dev testenv-veth0 up 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 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 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 nsenter -t $SELFTEST_PID --net --user --preserve-credentials
ip link set dev testenv-veth1 up ip link set dev testenv-veth1 up
ip link set testenv-veth1 master selftest0 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 logout
Your Windows VM and samba testenv should now be able to talk to each Your Windows VM and samba testenv should now be able to talk to each
other over IP! other over IP!
6. The other step is to get DNS working. You probably need to add dns_hub 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 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 (depending on the schema version). Joining samba to Windows is a bit more

View File

@ -487,6 +487,7 @@ foreach (@opt_include) {
# We give the selftest client 6 different IPv4 addresses to use. Most tests # 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 # only use the first (.11) IP. Note that winsreplication.c is one test that
# uses the other IPs (search for iface_list_count()). # 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 $interfaces = Samba::get_interfaces_config("client", 6);
my $clientdir = "$prefix_abs/client"; my $clientdir = "$prefix_abs/client";

View File

@ -576,13 +576,7 @@ sub get_ipv4_addr
$swiface += $iface_num; $swiface += $iface_num;
} }
if (use_namespaces()) { return "10.53.57.$swiface";
# 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";
}
} }
sub get_ipv6_addr sub get_ipv6_addr

View File

@ -1250,11 +1250,12 @@ sub setup_fileserver
my $dropbox_sharedir="$share_dir/dropbox"; my $dropbox_sharedir="$share_dir/dropbox";
push(@dirs,$dropbox_sharedir); push(@dirs,$dropbox_sharedir);
my $ip4 = Samba::get_ipv4_addr("FILESERVER");
my $fileserver_options = " my $fileserver_options = "
kernel change notify = yes kernel change notify = yes
rpc_server:mdssvc = embedded rpc_server:mdssvc = embedded
spotlight backend = elasticsearch spotlight backend = elasticsearch
elasticsearch:address = 127.0.0.35 elasticsearch:address = $ip4
elasticsearch:port = 8080 elasticsearch:port = 8080
elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json elasticsearch:mappings = $srcdir_abs/source3/rpc_server/mdssvc/elasticsearch_mappings.json
@ -2830,7 +2831,7 @@ sub wait_for_start($$$$$)
} else { } else {
system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__"); system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__");
system("$nmblookup $envvars->{CONFIGURATION} __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}"); system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}");
} }
$count++; $count++;
@ -3037,7 +3038,7 @@ sub provision_ctdb($$$$)
my %node = (); my %node = ();
my $server_name = "ctdb${i}"; my $server_name = "ctdb${i}";
my $pub_iface = Samba::get_interface($server_name); 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{NODE_NUMBER} = "$i";
$node{SERVER_NAME} = "$server_name"; $node{SERVER_NAME} = "$server_name";

View File

@ -5,6 +5,9 @@ incdir=`dirname $0`/../../../testprogs/blackbox
failed=0 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 || testit "async_connect_send" $VALGRIND $BINDIR/async_connect_send_test ||
failed=`expr $failed + 1` failed=`expr $failed + 1`

View File

@ -759,10 +759,10 @@ for env in ["chgdcpass", "ad_member"]:
if have_heimdal_support: if have_heimdal_support:
planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log", extra_args=['-U"$USERNAME%$PASSWORD"'], 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}) 'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log", extra_args=['-U"$USERNAME%$PASSWORD"'], 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}) 'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
planoldpythontestsuite("ad_dc", "samba.tests.auth_log_pass_change", planoldpythontestsuite("ad_dc", "samba.tests.auth_log_pass_change",
extra_args=['-U"$USERNAME%$PASSWORD"']) extra_args=['-U"$USERNAME%$PASSWORD"'])