mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
02c9e7a63f
The current constant value doesn't respect CTDB_TEST_MODE/CTDB_BASE. Instead use the path module to allow automatic listening in test mode with local daemons. A single node can be tested with local daemons, using something like: $ tests/local_daemons.sh foo setup -n 1 -C "node address" $ grep "node address" foo/node.0/ctdb.conf # node address = 127.0.0.1 $ tests/local_daemons.sh foo start all $ tests/local_daemons.sh foo print-log 0 | grep -i chose ... node.0 ctdbd[24546]: ctdb chose network address 127.0.0.1:4379 The trick is that commenting out the node address in ctdb.conf means the chosen node address is the first one from the nodes file that allows bind/listen. In this case it is the only line. The following ensures that automatic listening works for a node that isn't the first: $ cat >mynodes 192.168.1.1 127.0.0.1 $ tests/local_daemons.sh foo setup -n 2 -N mynodes -C "node address" $ grep "node address" foo/node.1/ctdb.conf # node address = 127.0.0.1 $ tests/local_daemons.sh foo start 1 $ tests/local_daemons.sh foo print-log 1 | grep -i chose [...] node.1 ctdbd[22787]: ctdb chose network address 127.0.0.1:4379 Note that the first address isn't local on this host, so will always fail. So, doing the above and starting both nodes yields... ... $ tests/local_daemons.sh foo start 1 $ sleep 3; tests/local_daemons.sh foo start 0 $ tests/local_daemons.sh foo print-log all | grep -i 'chose\|bind' [...] node.1 ctdbd[26351]: ctdb chose network address 127.0.0.1:4379 [...] node.0 ctdbd[26438]: ctdb_tcp_listen_addr: Failed to bind() to socket - Address already in use (98) [...] node.0 ctdbd[26438]: Unable to bind to any node address - giving up ... as expected. It would be nice to add tests for this, but we don't really have infrastructure for that. At least manual testing shows, for the obvious cases, the previous commits didn't break anything. :-) Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org> |
||
---|---|---|
.. | ||
ctdb_tcp.h | ||
tcp_connect.c | ||
tcp_init.c | ||
tcp_io.c |