1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

2074 Commits

Author SHA1 Message Date
Martin Schwenke
2c3df58132 ctdb-tests: Add a test for version consistency checking
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:14 +00:00
Martin Schwenke
8c2ff3f2b5 ctdb-daemon: Add an environment variable to set version
This can be used to test the version checking logic.  Cache the
version to avoid re-checking the environment variable each time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:14 +00:00
Martin Schwenke
627a5cf1e7 ctdb-tests: Fix remaining common.sh ShellCheck hits
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:14 +00:00
Martin Schwenke
6555fbce99 ctdb-tests: Shell cleanups in wait_until() function
This file is included by local_daemons.sh, which is not a bash script
and wait_until() uses the "local" keyword.  Prefixing variable names
with '_' to indicate that they are local changes a lot of lines in
this function.  So, fix indentation, potential quoting problems and
other ShellCheck hits while touching this function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:14 +00:00
Martin Schwenke
2fce893b2c ctdb-tests: export CTDB_SCRIPTS_TOOLS_BIN_DIR
This isn't used anywhere that requires it to be exported, but the lack
of consistency will cause problems and confusion at some later stage.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:14 +00:00
Martin Schwenke
d9286701cd ctdb-tests: Add some testing for IPv4-mapped IPv6 address parsing
ctdb_sock_addr values are hashed in some contexts.  This means that
all of the memory used for the ctdb_sock_addr should be consistent
regardless of how parsing is done.  The first 2 cases are just sanity
checks but the 3rd case involving an IPv4-mapped IPv6 address is the
real target of this test addition.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13839

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:13 +00:00
Martin Schwenke
a215d2017f ctdb-tests: Build cluster mutex path manually
CTDB_CLUSTER_MUTEX_HELPER can't be depended on because it is only set
when the tests are not installed and setting it unconditionally for
this particular use would be wrong.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@samba.org>
2019-03-15 05:17:13 +00:00
Martin Schwenke
ebc082122f ctdb-tests: Add a test for configuring the recovery lock as a command
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-02-25 02:12:17 +01:00
Martin Schwenke
e74f5243fc ctdb-tests: Add -R option for local daemons to use recovery lock command
Under the covers, a command is always used.  However, there is no way
of testing of the code path where a command is explicitly configured.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-02-25 02:12:17 +01:00
Martin Schwenke
ce09d9c3e4 ctdb-tests: Force test failure if local daemon setup fails
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13800

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-02-25 02:12:17 +01:00
Christof Schmitt
92a9052437 ctdb-tests: Add test for ctdb_io.c
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13791

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Feb 22 03:51:37 CET 2019 on sn-devel-144
2019-02-22 03:51:37 +01:00
Andreas Schneider
23709cc351 ctdb: Use C99 initializer for poptOption in test_options
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:12 +01:00
Martin Schwenke
2e3ad8c20d ctdb-tests: Minimise chances of test interfering with itself
Checking that the database contains 0 records cause a traverse.  This
may take a lock and cause vacuuming to fail (or be deferred for a
particular record/chain).  Minimise the chance of this happening by
only checking for 0 records every 10 seconds.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-12-18 07:12:10 +01:00
Martin Schwenke
1ed91f0e10 ctdb-tests: Do not force TEST_VAR_DIR to be absolute
This can result in Unix domain socket names that are too long.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Dec 18 05:31:00 CET 2018 on sn-devel-144
2018-12-18 05:31:00 +01:00
Martin Schwenke
63a4c634a6 ctdb-tests: Force symbolic link targets to be absolute
If CTDB_BASE is relative then the symbolic link target will be
incorrect.

Don't force CTDB_BASE to be absolute because this can result in Unix
domain socket names that are too long.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-12-18 02:02:04 +01:00
Martin Schwenke
45f96c7346 ctdb-event: Force EVENTSCRIPTS_TESTS_VAR_DIR to be absolute
Event scripts (well, statd_callout) can change directory, causing
stubs to be unable to locate EVENTSCRIPTS_TESTS_VAR_DIR if it is
relative.

Don't force TEST_VAR_DIR to be absolute because this can result in
Unix domain socket names that are too long.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-12-18 02:02:04 +01:00
Martin Schwenke
ba83aa9d8b ctdb-event: Force script directory to be absolute
If TEST_VAR_DIR is relative then symbolic link targets will be
incorrect.

Don't force TEST_VAR_DIR to be absolute because this can result in
Unix domain socket names that are too long.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-12-18 02:02:03 +01:00
Martin Schwenke
c1dd6382e3 ctdb-tests: Make the debug hung script test cope with unreadable stacks
Ideally this would just involve using "test -r".  However, operating
system security features may mean that kernel stacks are not readable
even though they appear to be.

Instead, try reading that stack of a process on the test node.  If
that succeeds then so should reading the stack of the "stuck" sleep
process in the test.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13684

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>

Autobuild-User(master): Tim Beale <timbeale@samba.org>
Autobuild-Date(master): Thu Nov 15 08:15:32 CET 2018 on sn-devel-144
2018-11-15 08:15:32 +01:00
Andreas Schneider
2d512b278e debug: Use debuglevel_(get|set) function
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Nov  8 11:03:11 CET 2018 on sn-devel-144
2018-11-08 11:03:11 +01:00
Martin Schwenke
6e16e95f74 ctdb-daemon: Do not fork when CTDB_TEST_MODE is set
Explicitly background ctdbd instead.

This has the advantage of leaving stdin open.  ctdbd can then be
enhanced to exit when stdin closes, allowing better cleanup in a test
environment.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Nov  6 10:30:14 CET 2018 on sn-devel-144
2018-11-06 10:30:14 +01:00
Martin Schwenke
804bdf9719 ctdb-tests: Add local_daemons.sh onnode and socket commands
These aren't used by simple tests but they will be useful for
integrating ctdbd local daemons into other test suites and for
debugging.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:18 +01:00
Martin Schwenke
19de5f463d ctdb-tests: Use local_daemons.sh in local_daemons.bash
The etc-ctdb/ subdirectory containing the event script moves into the
top-level tests/ directory because the subdirectory is really now
owned by local_daemons.sh instead of simple/.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
46fd4f144e ctdb-tests: Add local_daemons.sh
This provides a separate script for handling local daemons.  It can be
used for testing outside of the CTDB simple test suite.  It is
installed as ctdb_local_daemons.

The logic is copied from ctdb/tests/simple/scripts/local_daemons.bash.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
25efb924bf ctdb-tests: Allow use of setup_ctdb_base() outside of test cases
Always create an empty event script directory.  If $TEST_SUBDIR is
unset then don't use it to look for etc-ctdb/.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
aa0c7ccfc8 ctdb-tests: Move setting of ctdb_dir and top_dir
These are only used in script_install_paths.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
1d86fd537a ctdb-tests: Use $CTDB_SCRIPTS_TOOLS_BIN_DIR
Don't calculate this locally as _tools_dir.  Add it to PATH
unconditionally - this may result in duplicate entries in PATH but the
resulting code is simpler.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
7ac5e7ae44 ctdb-tests: Use $CTDB_SCRIPTS_TESTS_BINDIR
Don't calculate this locally as _test_bin_dir.  Just calculate
top_dir, source script_install_paths.sh and use
$CTDB_SCRIPT_TESTS_BINDIR.

Don't bother sanity checking if TEST_BIN_DIR is set.  It will go away
soon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
bde73c7a04 ctdb-tests: Add new variable CTDB_SCRIPTS_TESTS_BINDIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
2cb82ef453 ctdb-tests: Change all cluster setup to use ctdb_test_init()
ctdb_test_init() now passes any arguments to setup_ctdb().

Update tests that have custom local daemon configuration to call
ctdb_test_init() directly.  Remove the redundant, initial call to
ctdb_test_init() to avoid starting the cluster an extra time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
9a2910c60b ctdb-tests: Drop passing of test arguments to ctdb_test_init()
Arguments are currently ignored anyway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:17 +01:00
Martin Schwenke
d762e52e65 ctdb-tests: Drop ctdb_restart_when_done()
This no longer does anything.  Integration test cases now start and
shut down the cluster.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
79db138de5 ctdb-tests: Drop dependency on variable ctdb_test_restart_scheduled
The remainder of the scheduled restart logic is about to be removed,
so produce debugging information any time the cluster is not healthy.

While here, reindent and drop the else since there is already an early
return before it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
bc8df7191c ctdb-tests: Drop tests that only start and stop daemons
Integration test cases now start and shut down the cluster.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
412fb7b7d5 ctdb-tests: Move enabling of event scripts to setup_ctdb()
This is for the real cluster case.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
aa2ee4bea8 ctdb-tests: Improve signal handling trap
Interrupting a test run currently moves on to the next test.  It
should exit.

Follow the practice of exiting with 128 + signal number.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
92337234e5 ctdb-tests: Drop cleanup_handler()
Running testsuite-specific code here isn't a good option.

Daemons are now shut down in ctdb_test_exit(), even when testing is
interrupted.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
0e9ead8f28 ctdb-tests: Start daemons in ctdb_test_init(), stop them in ctdb_test_exit()
This makes tests self-contained.  They can also now be individually
looped, if necessary.

Most tests (all but 1 complex, more than 50% of simple) restart the
daemons anyway, so this simplification is worth it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
e733e4cb74 ctdb-tests: Ignore SIGPIPE during simple test cleanup
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
6d9c89bfa3 ctdb-tests: Drop setting of unused variable scriptname
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
520568051c ctdb-tests: Drop use of confusing testfailures variable
Exit on first test failure instead of setting a variable.  The bizarre
logic in ctdb_test_exit() makes this worth dropping.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
9ebcebe519 ctdb-tests: Drop useless "ctdb version" test
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:16 +01:00
Martin Schwenke
43c26e1e64 ctdb-tests: Rationalise tunable simple tests
These 3 tests duplicate various checks and can easily be handled as a
single test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:15 +01:00
Martin Schwenke
ba86eacb66 ctdb-tests: Rationalise ctdb stop/continue/disable/enable simple tests
The "continue" and "enable" tests are just extensions of the "stop"
and "disable" tests, so drop the latter 2.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:15 +01:00
Martin Schwenke
5fdac517fa ctdb-tests: Use wait_until_node_has_no_ips() in some tests
This strengthens those tests to ensure that released IPs aren't
replaced with others.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:15 +01:00
Martin Schwenke
eda1296d67 ctdb-tests: Add function wait_until_node_has_no_ips()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:15 +01:00
Martin Schwenke
1bbc4fad43 ctdb-tools: Detect unknown node number
If there aren't enough addresses in the list then the shift will
silently fail and the printed address will be the unshifted value of
$1, which is incorrect/unexpected.  So, sanity check the node number.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
08469408c3 ctdb-tests: README updates
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
4f4a835c34 ctdb-tests: Remove export of CTDB_SOCKET
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
d246b1dadf ctdb-tests: Use path_socket() in dummy client
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
3b1e5977d8 ctdb-tests: Drop incorrect comment, unused function
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
82e589e388 ctdb-tests: Drop setting of CTDB_SOCKET and CTDB_PIDFILE
The local daemons ssh stub doesn't need to do this because the ctdbd
and the ctdb tool now only need CTDB_TEST_MODE and CTDB_BASE for local
daemon tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
cd021596da ctdb-tests: Use path_socket() in test client tools
Just leak the memory allocated by path_socket().  This is only used in
short-lived test programs, so it isn't worth the hassle of plumbing a
talloc context through several layers to get here.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:14 +01:00
Martin Schwenke
38566780d2 ctdb-tests: Use ctdb-path for fake_ctdbd directory setup
This needs to be done before any of the code changes are made,
including updating the ctdb tool.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:13 +01:00
Martin Schwenke
d4a1f897af ctdb-tests: Use ctdb-path-like values for local daemons socket and PID file
However, don't use ctdb-path itself because some tests use nested
instances of onnode.  The outermost instance would set CTDB_SOCKET and
any inner instance would pick up that value, regardless of CTDB_BASE.

This is a temporary measure to avoid breaking testing while use of the
path functions is added to ctdbd and the ctdb tool.  When this is
complete these variables can be removed altogether because the code
will just depend on CTDB_TEST_MODE and CTDB_BASE.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-11-06 07:16:13 +01:00
Martin Schwenke
80f3f7c188 ctdb-tests: Improve counting of database records
Record counts are sometimes incomplete for large databases when
relevant tests are run on a real cluster.

This probably has something to do with ssh, pipes and buffering, so
move the filtering and counting to the remote end.  This means that
only the count comes across the pipe, instead of all the record data.

Instead of explicitly excluding the key for persistent database
sequence numbers, just exclude any key starting with '_'.  Such keys
are not used in tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Oct  8 05:36:11 CEST 2018 on sn-devel-144
2018-10-08 05:36:11 +02:00
Martin Schwenke
52dcecbc92 ctdb-tests: Add extra debug to large database recovery test
This test sometimes fails, probably because the test is flakey.
Either the records aren't being added correctly or the counting of
records loses records.  Try to debug both possibilities.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:23 +02:00
Martin Schwenke
d67d8ed44a ctdb-tests: Shut down transaction_loop clients more cleanly
A transaction_loop client can exit with a transaction active when its
time limit expires.  This causes a recovery and causes problems with
the test cleanup, which detects unwanted recoveries and fails.

Set a flag when the time limit expires and exit cleanly before the
next transaction is started.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:23 +02:00
Martin Schwenke
6ac5124b01 ctdb-tests: Support closing of stdin in local daemons ssh stub
Not sure this is needed but this makes it behave the same as ssh.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:23 +02:00
Martin Schwenke
0dfb3c87b5 ctdb-tests: Be more careful when building public IP addresses
The goal is to allow more local daemons by expanding the address range
rather than generating invalid addresses.

For IPv6, use a separate address space instead of an offset for the
2nd address.

For IPv4, use the last 2 octets with addresses starting at
192.168.100.1 and 192.168.200.1.  Avoid addresses with 0 and 255 in
the last octet by using a maximum of 100 addresses per "subnet"
starting at .1.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:23 +02:00
Martin Schwenke
36eb738877 ctdb-tests: Be more careful when building node addresses
The goal is to allow more local daemons by expanding the address range
rather than generating invalid addresses.

For IPv6, use all 4 trailing hex digits.

For IPv4, use the last 2 octets.  Although 127.0.0.0 is a /8 network,
avoid unexpected issues due to 0 and 255 in the last octet.  Use a
maximum of 100 addresses per "subnet" starting at .1.  Keep the first
group of addresses in 127.0.0.0/24 to continue to allow a reasonable
number of nodes to be tested with socket-wrapper.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:23 +02:00
Martin Schwenke
03dddc37b5 ctdb-tests: Don't format IPv4 octets as hex digits
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
0eabac5295 ctdb-tests: Be more efficient about starting/stopping local daemons
Don't loop, just use onnode all.

For shutting down, use onnode -p all.  This results in a significant
time saving for stopping many deamons because "ctdb shutdown" is now
synchronous.

onnode -p all can be used to start daemons directly because they
daemonize.  However, this does not work under valgrind because the
valgrind process does not exit, so onnode will wait forever for it.
In this case, use onnode without the -p option.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
a9ac33015b ctdb-tests: Do not use ctdbd_wrapper in local daemon tests
Run the daemon directly and shut it down using ctdb shutdown.

The wrapper waits for ctdbd to reach >=FIRST_RECOVERY runstate within
a timeout period and shuts ctdbd down if that doesn't happen.  This is
only really used to ensure that ctdbd doesn't exit early after an
apparently successful start.  There are no known cases where ctdbd
will continue running but fail to reach >=FIRST_RECOVERY runstate.

When ctdbd is started in tests, the test code will wait until ctdbd is
in a healthy state on all nodes before proceeding, so there is
effectively no change in behaviour.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
8bde6fa09c ctdb-tests: Don't remove non-existent test database directory
This directory is no longer used.  Lack of removal doesn't seem to
cause a problem.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
f2e4a5e9fa ctdb-tests: Drop unused function maybe_stop_ctdb()
There are too many functions to start/stop daemons.  Simplify this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
2cd6a00399 ctdb-tests: Explicitly check for local daemons when shutting down
This is clearer if the logic is explicit...  and...

There are too many functions to start/stop daemons.  Simplify this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
90f6b0a1ed ctdb-tests: Drop functions daemons_start(), daemons_stop()
There are too many functions to start/stop daemons.  Simplify this.

Inline the functionality into ctdb_start_all() and ctdb_stop_all().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
f1ede41adf ctdb-tests: Don't used daemons_start()/daemons_stop() directly in tests
There are too many functions to start/stop daemons.  Simplify this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
4642a347d0 ctdb-tests: Rename _ctdb_start_all() -> ctdb_start_all()
There are too many functions to start/stop daemons.  Simplify this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:22 +02:00
Martin Schwenke
f57e5bbde7 ctdb-tests: Rename ctdb_start_all() -> ctdb_init()
There are too many functions to start/stop daemons.  Simplify this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:21 +02:00
Martin Schwenke
a66a96934a ctdb-tests: Drop ps_ctdbd()
This was used for debugging tests by ensuring that the arguments to
ctdbd were as expected.  It no longer outputs anything useful because
ctdbd is now started without arguments.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:21 +02:00
Amitay Isaacs
83b3c5670d ctdb-tests: Drop code for RECEIVE_RECORDS control
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-10-08 02:46:21 +02:00
Martin Schwenke
dcc9935995 ctdb-tests: Add recovery record resurrection test for volatile databases
Ensure that deleted records and vacuumed records are not resurrected
from recently inactive nodes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13641

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-10-08 02:46:20 +02:00
Martin Schwenke
b487979f89 ctdb-tests: Fix CTDB -O3 --picky-developer build on CentOS 7
gcc 4.8.5 complains:

[319/381] Compiling ctdb/tests/src/system_socket_test.c
../tests/src/system_socket_test.c: In function ‘test_tcp’:
../tests/src/system_socket_test.c:196:20: error: ‘rst_out’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  assert((rst != 0) == (rst_out != 0));
                    ^
cc1: all warnings being treated as errors

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-09-07 17:26:18 +02:00
Martin Schwenke
bc62182ff4 ctdb-tests: Check result of write() in ARP and TCP tests
CTDB -O3 --picky-developer build is failing.  Not sure how this
slipped through.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Sep  6 08:33:59 CEST 2018 on sn-devel-144
2018-09-06 08:33:59 +02:00
Martin Schwenke
30eb28818d ctdb-tests: Don't run valgrind or other tracing in simple_test_command()
This function is used to run a extra command to check a result.  This
command is usually a script (often a stub) or an external command, so
no need to trace it with valgrind or whatever else might be specified.
In the worst case the command being run is a shell function, which
valgrind won't be able to find.

There is little use running the event script tests under valgrind.
However, when the whole test suite is being run under valgrind then it
should work.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Sep  3 14:04:00 CEST 2018 on sn-devel-144
2018-09-03 14:04:00 +02:00
Martin Schwenke
8aacde3c5d ctdb-tests: Use known install paths in local daemon tests
The in-tree local daemons tests don't work from a top-level Samba
compile.  The simple test suite was the first test suite and things
have generally worked, so it has been slow to adopt general test
infrastructure changes.

Instead of re-calculating script and helper locations, use the paths
from script_install_paths.sh.  The bin/ directory is already added to
PATH in common.sh, so don't add it here.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-09-03 10:52:12 +02:00
Martin Schwenke
eed738a37a ctdb-tests: If bin/ isn't in ctdb/ then look one level higher
CTDB's test suite doesn't work from a top-level compile.  The first
step to fixing this is to correctly locate the bin/ directory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-09-03 10:52:11 +02:00
Martin Schwenke
4f1727fe0b ctdb-common: Process the whole config file even if an error occurs
At the moment multiple errors will be encountered one at a time, on
each load or validate.  Instead, allow all configuration errors to
printed in a single pass.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-09-03 10:52:11 +02:00
Martin Schwenke
920ed66ba7 ctdb-common: Avoid ENOENT for unknown conf options
Only use ENOENT for missing configuration file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-09-03 10:52:11 +02:00
Martin Schwenke
ebb28c57a1 ctdb-common: Log a message for unknown conf option
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-09-03 10:52:11 +02:00
Martin Schwenke
421d828f6c ctdb-common: Fix log message for conf option with unknown section
This covers both options that appear before a section and options in
unknown sections.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-09-03 10:52:11 +02:00
Martin Schwenke
43a2022596 ctdb-tests: Extend TCP packet test to also do packet extraction
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-30 04:48:59 +02:00
Martin Schwenke
a02cba1c8a ctdb-tests: Add tests for TCP packet marshalling
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-30 04:48:58 +02:00
Martin Schwenke
87088af6e4 ctdb-tests: Add tests for ARP and IPv6 NA marshalling
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-30 04:48:57 +02:00
Martin Schwenke
0927b38226 ctdb-tests: Add basic test to sanity check types in socket marshalling
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-30 04:48:57 +02:00
Martin Schwenke
6fb80cbffb ctdb-tests: Check that no IPs are assigned when failover is disabled
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Aug 24 14:13:12 CEST 2018 on sn-devel-144
2018-08-24 14:13:12 +02:00
Martin Schwenke
55893bf8d2 ctdb-tests: Add an extra conf loading test case
This shows that config file loading continues in spite of unknown keys
if ignore_unknown is true.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:22 +02:00
Martin Schwenke
929634126a ctdb-config: Switch tunable DisableIPFailover to a config option
Use the "failover:disabled" option instead.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:21 +02:00
Martin Schwenke
d003a41a9c ctdb-config: Integrate failover options into conf-tool
Update and add tests accordingly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:21 +02:00
Martin Schwenke
8e160d331a ctdb-tests: Drop DisableIPFailover simple test
This is about to become a config file option that can't be dynamically
changed at run-time, so drop this test for now.  This test will be added
once the tunable becomes a config file option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:21 +02:00
Martin Schwenke
914e9f22d8 ctdb-daemon: Pass DisableIPFailover tunable via environment variable
Preparation for obsoleting this tunable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:21 +02:00
Martin Schwenke
f42486e891 ctdb-config: Switch tunable TDBMutexEnabled to a config option
Use the "database:tdb mutexes" option instead.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:21 +02:00
Martin Schwenke
17068e756b ctdb-config: Change option "no realtime" option to "realtime scheduling"
Negative options can be confusing, so switch to a positive option.

This was supposed to be done months ago but was forgotten.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-08-24 10:59:20 +02:00
Martin Schwenke
5017325c2e ctdb-event: Implement event tool "script list" command
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 17:14:11 +02:00
Martin Schwenke
82e6248802 ctdb-common: Use script abstraction in run_event
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 17:14:11 +02:00
Martin Schwenke
a7a4ee439d ctdb-common: Factor out basic script abstraction
Provides for listing of scripts and chmod enable/disable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13551

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 17:14:11 +02:00
Amitay Isaacs
3047202ce7 ctdb-tests: Strip all spaces from od output
On freebsd, there are trailing spaces in od output.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
6f5ed2b8b8 ctdb-tests: Fix a typo
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
65cc36f24d ctdb-tests: Use errcode to translate ETIMEDOUT
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
22c3078c8b ctdb-tests: Replace md5sum with posix cksum
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
96d5c7de82 ctdb-scripts: date "+%N" is non-portable
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
68542dbb5a ctdb-tests: Simplify pattern matching for ctime output
On freebsd, sed does not accept multiple pattern strings.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
4152e98c0e ctdb-tests: Do not try to match pstree output in eventd tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
3bf753e830 ctdb-common: Add fd argument to ctdb_connection_list_read()
This makes testing easier.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
c7041b0faf ctdb-common: Add line based I/O
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
0273171c30 ctdb-tests: Porting tests should ignore unsupported features
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
23952c9165 ctdb-tests: Use sigcode to match signals
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:11 +02:00
Amitay Isaacs
b0028dd5bf ctdb-tests: Add signal code matching utility
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Amitay Isaacs
b7dbe9f306 ctdb-tests: Add ps output filter for freebsd
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Amitay Isaacs
e1236a855f ctdb-client: Switch to ETIMEDOUT instead of ETIME
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Amitay Isaacs
c8756ec17b ctdb-event: Switch to ETIMEDOUT instead of ETIME
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Amitay Isaacs
a42a723299 ctdb-common: Switch to ETIMEDOUT from ETIME
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Amitay Isaacs
e8a1b3db7a ctdb-tests: Add required_error() to match on error codes
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Amitay Isaacs
af8c31ead8 ctdb-tests: Add errno matching utility
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-28 03:50:10 +02:00
Martin Schwenke
f13824b291 ctdb-tests: Switch some test stubs to use /bin/sh
They don't use any bash features.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 03:50:10 +02:00
Martin Schwenke
2f2c35a1cb ctdb-tests: Improve portability by not using mktemp --tmpdir option
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 03:50:10 +02:00
Martin Schwenke
896c77df1c ctdb-tests: Avoid use of non-portable getopt in stubs
getopt is being used with non-portable options.  In most cases use
simpler, POSIX-compliant getopts instead.

In the case of the ctdb test stub command, options can appear after
other arguments, so this requires an additional nested loop.

In the case of smnotify, there are no short options, so handle the
long options manually.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 03:50:10 +02:00
Martin Schwenke
56ffca3e79 ctdb-tests: Avoid use of non-portable getopt in run_tests.sh
getopt is being used with non-portable options.  Use simpler,
POSIX-compliant getopts instead.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 03:50:10 +02:00
Martin Schwenke
dd9d8a20aa ctdb-tests: Improve portability by not using /bin/bash directly
FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash"
for better flexibility.

There are still many integration tests that use /bin/bash but this at
least lets FreeBSD start running tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-28 03:50:10 +02:00
Martin Schwenke
4a1fb7296c ctdb-protocol: Add function ctdb_sock_addr_mask_from_string()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-27 05:45:20 +02:00
Martin Schwenke
359e52187f ctdb-tests: Loosen match against pstree output in simple test
As per previous commit, pstree can truncate output if it gets too
wide.  Instead of matching against the script's full path and
arguments, just match against the script name.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13531

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Jul 18 14:53:39 CEST 2018 on sn-devel-144
2018-07-18 14:53:39 +02:00
Martin Schwenke
da115efd2b ctdb-tests: Simplify pstree output in eventd unit tests
pstree truncates output when it exceeds a maximum width - the default
is 132 columns.  A couple of recent
commits (12fd8d7a5c,
b23f3f9960) lengthened the command
string in the output so that it is more likely to exceed this limit
and be truncated, as below:

==================================================
Running "cat /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/debug_script.log"
--------------------------------------------------
Output (Exit status: 0):
--------------------------------------------------
02.enabled.scri,PID /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/events/random/02.enabled.script ...
  `-sleep,PID 99
01.disabled          DISABLED
02.enabled           TIMEDOUT   DATETIME
  OUTPUT: Sleeping for 99 seconds
--------------------------------------------------
Required output (Exit status: 0):
--------------------------------------------------
02.enabled.scri,PID /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/events/random/02.enabled.script verbosetimeout
  `-sleep,PID 99
01.disabled          DISABLED
02.enabled           TIMEDOUT   DATETIME
  OUTPUT: Sleeping for 99 seconds

FAILED

It isn't clear that the above example exceeds 132 characters, given
that the PID has been filtered into a fixed string, but it certainly
goes close.  Whether or not it is truncated probably depends on the
width of the PID in the unfiltered output.  This would explain why the
test flaps.

Avoid the output truncation by dropping the -a and -p options to
simplify the pstree output.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13531

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-18 11:51:14 +02:00
Martin Schwenke
451c6b668f ctdb-tests: Drop residual CTDB_MANAGED_<service> variables
These no longer do anything.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:39 +02:00
Martin Schwenke
c08c95c9e5 ctdb-tests: Drop event script tests where CTDB_MANAGED_<service>=no
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:39 +02:00
Martin Schwenke
a757e07600 ctdb-tests: Ensure some event scripts are enabled for cluster tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:39 +02:00
Martin Schwenke
06be1c8593 ctdb-build: Install event scripts in CTDB_DATADIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
a3610d1cbc ctdb-tests: Clean up define_test() for event scripts
Factor out a little bit of common code.  More coming.

Most of this is whitespace changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
f029e2a76d ctdb-tests: Drop an unused case
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
19071ac8ad ctdb-tests: New install path CTDB_SCRIPT_DATA_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
6742bf6cf6 ctdb-event: Update event tool to handle symbolic links
Supports the case when scripts are installed in the data directory and
are linked to when enabled.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
3bebc5d8a0 ctdb-common: Add path support for datadir
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
7c4848a4b3 ctdb-daemon: Drop the noiphost "node flags" bitmap
This is no longer needed because inactive/disabled nodes no longer
report any available public IP addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
709ef6b7cc ctdb-daemon: Stop inactive/disabled nodes from reporting available IPs
This can be done now that NoIPHostOnAllDisabled is gone and will allow
the public IP address failover logic to be simplified.

In the test code, still filter available IP addresses by node state.
This code can't currently read information about available IP
addresses but that will change in future

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
fda0591083 ctdb-daemon: Drop plumbing for obsolete tunable NoIPHostOnAllDisabled
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
070469beb8 ctdb-daemon: Mark NoIPHostOnAllDisabled tunable as obsolete
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:38 +02:00
Martin Schwenke
d0739b2ea8 ctdb-daemon: Change default for tunable NoIPHostOnAllDisabled to 1
Defaulting to host public IP addresses when all nodes are unhealthy
does not obey the principle of least surprise.  It has caused much
confusion over the years.  It often leads to problems when all nodes
are unhealthy due to something like a cluster filesystem being
unmounted.

Change the default value for this tunable as the first step of
completely removing this behaviour.

Remove tests that set NoIPHostOnAllDisabled=1 and update the expected
result for other tests where no nodes are healthy.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:37 +02:00
Martin Schwenke
b20c917316 ctdb-tests: Setup public addresses in 60.nfs unit tests
Even the monitor event runs update_tickles(), which needs public IP
addresses and FAKE_CTDB_NUMNODES to be initialised.  Currently this
works by default but soon we'll need FAKE_CTDB_NUMNODES in another
context.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:37 +02:00
Martin Schwenke
1061f48d03 ctdb-tests: Replace hardcoded IP address in test results
Parameterise them with a variable instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:37 +02:00
Ralph Boehme
93f61639a6 ctdb: close the correct pipe fd in a test
This was discovered in an autobuild with a patched tevent that used the
"poll" backend by default. Test failure:

$ bin/sock_daemon_test /dev/shm/sock_daemon_test.pid /dev/shm/sock_daemon_test.sock 5
test5[28011]: daemon started, pid=28011
test5[28011]: listening on /dev/shm/sock_daemon_test.sock
sock_daemon_test: ../ctdb/tests/src/sock_daemon_test.c:980: test5: Assertion `ret == i+1' failed.
Abgebrochen (Speicherabzug geschrieben)
metze@SERNOX14:~/devel/samba/4.0/master4-test$ test5[28011]: PID 28010 gone away, exiting
test5[28011]: Shutting down
sock_daemon_test: ../ctdb/tests/src/sock_daemon_test.c:964: test5:
Assertion `ret == EINTR' failed.

After an epic debugging session we spotted the problem.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-07-10 20:31:13 +02:00
Amitay Isaacs
a30ac853ff ctdb-tests: Avoid segfault by initializing logging
This is in addition to af69700853.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jul  5 15:22:16 CEST 2018 on sn-devel-144
2018-07-05 15:22:16 +02:00
Amitay Isaacs
dda99e49e3 ctdb-tests: Switch to using new event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jul  5 09:39:33 CEST 2018 on sn-devel-144
2018-07-05 09:39:33 +02:00
Amitay Isaacs
8250072a81 ctdb-protocol: Remove protocol for old event daemon
This breaks the build.  The new eventd protocol cannot be introduced without
removing the old eventd protocol.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:44 +02:00
Amitay Isaacs
99fa3a343f ctdb-tests: Remove tests for old event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
26b1940162 ctdb-tools: Switch to using new event daemon tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
6eaef8491e ctdb-event: Add tests for event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
f9104d4659 ctdb-tests: Rename eventd testsuite to ctdb_eventd
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
281bc84912 ctdb-event: Add event daemon protocol
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
f42106fb49 ctdb-common: Add client pid to connect callback in sock_daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
5586e035f2 ctdb-tests: Separate testing code for basic data types
This will be used for testing other daemons' protocol code.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-05 06:52:43 +02:00
Amitay Isaacs
af69700853 ctdb-tests: Avoid segfault by initializing logging
Setting DEBUGLEVEL before calling debug_init() causes segmentation
violation with gcc8.  DEBUGLEVEL_CLASS is statically initialized to
debug_class_list_initial which is defined as const.  Only after
debug_init() is called, DEBUGLEVEL_CLASS becomes a talloc'd array.

So before modifying DEBUGLEVEL, ensure debug_init() is called via
setup_logging().  (debug_init is a static function.)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-04 23:56:42 +02:00
Martin Schwenke
0b4a071ed1 ctdb-tests: Teach strace packet parser about non-octal escapes
strace output also encodes characters 7 to 13 as \a, \b, \t, \n, \v,
\f, \r.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Jul  2 11:30:29 CEST 2018 on sn-devel-144
2018-07-02 11:30:29 +02:00
Martin Schwenke
ec72fadecd ctdb-tests: Add a simple test for database traverses
This tests that volatile databases traverse correctly, including the
case where a record was updated on a non-lmaster node.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:22 +02:00
Martin Schwenke
4b008556d6 ctdb-tests: Add check for non-lmaster node status in integration tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:22 +02:00
Martin Schwenke
ff181a82f2 ctdb-tests: Switch 90_debug_hung_script.sh to be a simple test
This test only runs against local daemons.  Configuration is done via
script.options, which simplifies things quite a bit.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:22 +02:00
Martin Schwenke
dfd39c9cd7 ctdb-tests: Enable event script debugging in local daemon tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:22 +02:00
Martin Schwenke
9f09579a5c ctdb-tests: Support CTDB_RUN_TIMEOUT_MONITOR=yes in simple tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:22 +02:00
Martin Schwenke
9e1cbd922e ctdb-tests: Clean up startup event in 00.test event script
Rewrite interface initialisation to avoid an error when there are no
interfaces configured.  Re-indent case label.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:22 +02:00
Martin Schwenke
673b0e78e1 ctdb-tests: Add generic logging of event details in 00.test event script
No need for a separate case for each event just to log details.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Martin Schwenke
8888711e57 ctdb-tests: Drop unnecessary code in 00.test event script
This script is only used with local daemons.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Martin Schwenke
acd10a5d47 ctdb-tests: Clean up argument validation in 00.test event script
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Martin Schwenke
23adbaad99 ctdb-tests: Drop check for invalid event in 00.test event script
This isn't necessary and complicates the code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Amitay Isaacs
40a8ab1ce0 ctdb: Fix build on AIX
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-02 08:51:21 +02:00
Martin Schwenke
05a908d71c ctdb-tests: Switch fake_ctdbd to use ctdb_get_peer_pid()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Martin Schwenke
8fcd12ba29 ctdb-common: Move ctdb_system_check_iface_exists() to system.[ch]
The system_<os>.c files contain a lot of duplication, making
maintenance difficult.  These functions are being merged into
system_socket.[ch] and system.[ch].

This function doesn't need ctdb_sock_addr so put it with general
system utilities.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-02 08:51:21 +02:00
Amitay Isaacs
e84b5020a4 ctdb-common: Correctly handle conf->reload()
Configuration reload should reset the values of configuration options
missing from the config file to default.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Jun 29 15:12:37 CEST 2018 on sn-devel-144
2018-06-29 15:12:37 +02:00
Carlos O'Donell
b6b1226d39 ctdb: Improve robust mutex test
This avoids some of the undefined behaviour, like initializing the same mutex
twice which happens when the low and high priority processes start (both
do the initialization and that's dangerous.) Instead now we start an
"init" process to start the shared memory segment, and then everything
else just uses it without truncation or unlinking (same mutex).

Signed-off-by: Carlos O'Donell <codonell@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Jun 29 06:47:00 CEST 2018 on sn-devel-144
2018-06-29 06:47:00 +02:00
Amitay Isaacs
366f6703e7 ctdb-common: Add support to run events through failure
Usually run_event will stop executing event scripts on first failure.
Optionally it can continue to run events even on failure(s).

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-06-05 22:34:19 +02:00
Amitay Isaacs
a3591ed5de ctdb-common: Return script_list for zero scripts
When an event script directory is empty, do not return script_list as
NULL.  Instead return empty script_list with zero scripts.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-06-05 22:34:19 +02:00
Amitay Isaacs
4d27c11ce2 ctdb-common: Rename run_event_script_list to run_event_list
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-06-05 22:34:18 +02:00
Amitay Isaacs
a883f8b092 ctdb-common: Do not initialize run_proc inside run_event
Allowing run_event_init() to take run_proc_context as an argument allows
to create multiple run_event instances with a single run_proc_context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-06-05 22:34:18 +02:00
Martin Schwenke
f2e8ab3f02 ctdb-tests: Continue running if a testcase is not executable
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jun  5 20:37:15 CEST 2018 on sn-devel-144
2018-06-05 20:37:15 +02:00
Martin Schwenke
f1d07908e2 Revert "ctdb-tests: Continue running if a testcase is not executable"
This reverts commit 36e7043fb1.

An recent change broke this and I forgot to test before posting. :-(

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-06-05 17:47:27 +02:00
Martin Schwenke
b23f3f9960 ctdb-scripts: Event scripts must end with ".script" suffix
Preparation for recommending configuration for each script next to the
actual script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-06-05 17:47:26 +02:00
Martin Schwenke
12fd8d7a5c ctdb-scripts: Move event scripts to events/legacy/ directory
This is the initial location that will be used by the new
multi-component aware event daemon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-06-05 17:47:26 +02:00
Volker Lendecke
ca01643c92 ctdb: Fix CID 1435740 Unchecked return value
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-05-24 00:43:51 +02:00
Martin Schwenke
b184761829 ctdb-tests: Switch local daemons to use new style configuration file
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:32 +02:00
Martin Schwenke
60811d62e5 ctdb-tests: Clean up tests to not expose script options
The tests still use the script options but the event scripts no longer
see them exported from the test infrastructure.  Testing now depends
on the event scripts successfully fetching the options from the
configuration file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
ad82b8abc3 ctdb-tests: Add ctdb-config wrapper stub for event script tests
Create a shim helper around that simply invokes ctdb-config via its
real location.

This is needed because the event script tests set CTDB_HELPER_BINDIR
to the stubs directory because all other helpers used by event script
testing are currently stubs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
7c33f5ec2d ctdb-tests: Add setup of ctdb.conf recovery lock setting
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
ff3d0e70b6 ctdb-tests: Add setup of ctdb.conf database directory settings
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
25f05ced2f ctdb-tests: Add new variable CTDB_SCRIPTS_HELPER_BINDIR
This will always find a binary helper, as opposed to a script helper,
which currently lives under tools/ in the source tree.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
b42dbadbef ctdb-tools: Add legacy config options to config tool
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
65d9d1e743 ctdb-tools: Add database config options to config tool
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:31 +02:00
Martin Schwenke
dbdd49da23 ctdb-tools: Add cluster config options to config tool
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:30 +02:00
Amitay Isaacs
5eec5e7c1f ctdb-tools: Add event daemon config options to config tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-05-17 04:04:30 +02:00
Martin Schwenke
344e6eecb2 ctdb-tests: Create database directories for local daemons
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-17 04:04:30 +02:00
Amitay Isaacs
fcda17cb42 ctdb-tools: Add logging config options to config tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sat May 12 15:01:32 CEST 2018 on sn-devel-144
2018-05-12 15:01:32 +02:00
Amitay Isaacs
e96e1defba ctdb-common: Add config options tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-05-12 12:06:28 +02:00
Amitay Isaacs
702504118f ctdb-common: Add config file parsing code
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-05-12 12:06:28 +02:00
Amitay Isaacs
cb64a7ca75 ctdb-tests: Setup $CTDB_BASE/{run,var} directories
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-05-12 12:06:28 +02:00
Amitay Isaacs
b2eaacaa14 ctdb-common: Add path tool
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-05-12 12:06:28 +02:00
Amitay Isaacs
356dacc6d7 ctdb-common: Add command line processing abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-05-12 12:06:28 +02:00
Martin Schwenke
ac1c12b5a2 ctdb-scripts: Use load_script_options() in miscellaneous scripts
Some of these just aim to load the generic script.options file while
others target more specific files.

For NFS configuration, always use 60.nfs.options - even for 06.nfs.
This could be carefully documented but will change a lot before
release so there is no need.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-12 06:11:17 +02:00
Martin Schwenke
02444e5f47 ctdb-scripts: Allow load_script_options() to specify an event script
This allows other scripts to use the given options for a particular
event script.  One interesting example is that the ctdb_natgw tool
should look for configuration in events.d/11.natgw.options.

In the future this will be something like
events/failover/11.natgw.options, so require the component to be
specified even though it isn't yet used.

Test support is also updated.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-12 06:11:17 +02:00
Martin Schwenke
31f26e9700 ctdb-tests: Separate support script for 06.nfs
Including 60.nfs was too simple a hack, since we will want to do some
magic to use the configuration from 60.nfs for 06.nfs.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-12 06:11:17 +02:00
Martin Schwenke
36e7043fb1 ctdb-tests: Continue running if a testcase is not executable
At the moment the whole test run aborts without printing a summary of
results but inexplicably succeeds.  Instead, generate a clear failure
for a non-executable testcase.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-12 06:11:17 +02:00
Martin Schwenke
eb7ec16a96 ctdb-daemon: Change default volatile database directory
Volatile databases now have their own subdirectory.  This makes things
easier if we later recommend mounting a tmpfs on the volatile database
directory, rather than supporting the current CTDB_DBDIR=tmpfs magic.

No need to create database directories for local daemon tests.  ctdbd
will do that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:21 +02:00
Martin Schwenke
8ea7fa57f4 ctdb-tests: CTDB_DBDIR_PERSISTENT should not depend on CTDB_DBDIR
Add new variable CTDB_DBDIR_BASE, just for event script unit tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:20 +02:00
Martin Schwenke
eba893f06c ctdb-tests: Fix location of persistent databases
Always use CTDB_DBDIR_PERSISTENT, which is setup by the test
infrastructure.  The persistent database directory is
not (necessarily) relative to the volatile one.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:20 +02:00
Martin Schwenke
f4fe768ca3 ctdb-docs: Move remaining test options to README
Test options do not belong in the user documentation.  Move them to
the README file in the tests/ subdirectory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:19 +02:00
Martin Schwenke
5081cec49e ctdb-tests: Make local daemon tests depend on CTDB_TEST_MODE
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:18 +02:00
Martin Schwenke
3c7b766e5a ctdb-daemon: Add testing environment variable CTDB_TEST_MODE
This is a generic indicator that tests are being run.

For local daemons, this will replace --sloppy-start and
--nopublicipcheck - it also does --nosetsched, which isn't being
removed at this point.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:18 +02:00
Martin Schwenke
7e9dd3fd3c ctdb-tests: Ensure notify.sh is available to local daemons
Changes to notification configuration are coming, so ensure notify.sh
is always "installed" for local daemons.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-05-01 13:31:18 +02:00
Martin Schwenke
a23d805475 ctdb-tests: Fix a typo
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Apr 30 14:26:43 CEST 2018 on sn-devel-144
2018-04-30 14:26:43 +02:00
Martin Schwenke
693ca7b99e ctdb-tests: Simplify a test
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-04-30 11:41:22 +02:00
Martin Schwenke
4e0cf2fa76 ctdb-tests: Delete unused fake /etc/sysconfig/ctdb file
The only remaining item is a setting of CTDB_DEBUGLEVEL, which is not
required.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Mar 28 07:27:58 CEST 2018 on sn-devel-144
2018-03-28 07:27:58 +02:00
Martin Schwenke
02fc52d69b ctdb-scripts: Tunables are now loaded from ctdb.tunables
Using CTDB_SET_TunableVariables in the main configuration file is no
longer supported.

The only subtlety is an unexpected order change in one of the unit
test results.  This is because the old implementation implicitly
sorted the tunable variables via the set command.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:21 +02:00
Martin Schwenke
1db96ce26e ctdb-tests: Rename setup_config() to setup_tunable_config()
Drop the "CTDB_SET_" prefix from variable names and add it back for
now.  When there is a better way of setting tunables then this
function will support that.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:21 +02:00
Martin Schwenke
66cfddc61c ctdb-tests: Script options into per-script file
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:21 +02:00
Martin Schwenke
e0c2b3a1e1 ctdb-tests: Use setup_script_options() in 91.lvs tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:21 +02:00
Martin Schwenke
a48bd34246 ctdb-tests: Use setup_script_options() in 60.nfs (and 06.nfs) tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
96ed6c34ba ctdb-tests: Use setup_script_options() in 50.samba tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
ecda38c894 ctdb-tests: Use setup_script_options() in 49.winbind tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
3944fc4ae3 ctdb-tests: Use setup_script_options() in 41.httpd tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
17b8f12d1c ctdb-tests: Use setup_script_options() in 40.vsftpd tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
051458feb0 ctdb-tests: Use setup_script_options() in 31.clamd tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
a16eb657d1 ctdb-tests: Use setup_script_options() in 20.multipathd tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
ef98333d6a ctdb-tests: Use setup_script_options() in 13.per_ip_routing tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
6b88a8188b ctdb-tests: Use setup_script_options() in 11.natgw tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
87cd76e0c6 ctdb-tests: Use setup_script_options() in 10.interface tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
45de2b1d9b ctdb-tests: Use setup_script_options() in 05.system tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
3712640d47 ctdb-tests: New function setup_script_options()
Currently exports the variable assignment on each line.  Later this
can be changed to handle actual per-script configuration.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:20 +02:00
Martin Schwenke
6c5f7c0003 ctdb-tests: Remove unused functions and stubs
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
58db0dbeda ctdb-tests: statd-callout script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
8ee51d2f2d ctdb-tests: 91.lvs event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
042a5101fc ctdb-tests: 60.nfs (and 06.nfs) event script setup modularisation
Includes gratuitous changes to get lines below 80 columns.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
ab5bc195c4 ctdb-tests: 50.samba event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
34eba35c61 ctdb-tests: 49.winbind event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
29eb410f26 ctdb-tests: 41.httpd event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
99c3fd3460 ctdb-tests: 40.vsftpd event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
3172dc7244 ctdb-tests: 31.clamd event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
0bc1b4b27e ctdb-tests: 20.multipathd event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
0ca1cfcf61 ctdb-tests: 13.per_ip_routing event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
a63c456080 ctdb-tests: 11.natgw event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
8c81fb9d9a ctdb-tests: 10.interface event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:19 +02:00
Martin Schwenke
d8232476ed ctdb-tests: 05.system event script setup modularisation
Do initial test setup using setup() function.  Rename usage setting
functions to make them more obvious.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
7cddc88d03 ctdb-tests: 01.reclock event script setup modularisation
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
db5c604152 ctdb-tests: 00.ctdb testing setup modularisation
Switch to generic setup() function and set variables there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
5815c32d01 ctdb-tests: Define generic setup() function
Create default setup() function that aborts.  This function will be
redefined by each support script and used to do the setup.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
9038759259 ctdb-tests: statd-callout.sh simple 80 column fixups
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
44b29982f4 ctdb-tests: 60.nfs.sh simple 80 column fixups and reordering
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
b526968bcf ctdb-tests: 20.multipathd.sh 80 column fixups
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
4430e22d0c ctdb-tests: 11.natgw.sh simple 80 column fixups
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
bfd2d70fc4 ctdb-tests: 10.interface.sh simple 80 column fixups
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
b6cde6ff9f ctdb-tests: 05.system.sh simple 80 column fixups
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
0f78e0b4c4 ctdb-tests: Create statd-callout.sh
Contains testing support used only by tests for statd-callout script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
0f080cebef ctdb-tests: Create 91.lvs.sh
Contains testing support used only by tests for 91.lvs event scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
7d91de549b ctdb-tests: Create 60.nfs.sh and 06.nfs.sh
Contains testing support used only by tests for 60.nfs and 06.nfs
event scripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00
Martin Schwenke
32d8483b07 ctdb-tests: Create 50.samba.sh
Contains testing support used only by tests for 50.samba event script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-28 02:57:18 +02:00