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

453 Commits

Author SHA1 Message Date
Ronnie Sahlberg
bc208bc916 rename ctdb_set_message_handler to ctdb_client_set_message_handler
to avoid a colission with the function of the same name in libctdb

(This used to be ctdb commit 41dbdd4fc0ab560420fb0e24a3179ff7c94c5bb7)
2010-06-02 09:51:47 +10:00
Ronnie Sahlberg
761a075de9 rename ctdb_send_message to ctdb_client_send_message to resolve colission with the function of the same name in libctdb
(This used to be ctdb commit ac3292c12832484a22715f1d46aa23f3b7c8a6f6)
2010-06-02 09:45:21 +10:00
Ronnie Sahlberg
0d46488f6e Merge commit 'rusty/libctdb2'
(This used to be ctdb commit d41b802250ddc0a89581eb6285edfd66bdc7a78a)
2010-05-25 12:48:49 +10:00
Rusty Russell
d5f6026a22 libctdb: reorganize headers: remove ctdb.h, add ctdb_client.h and ctdb_protocol.h
ctdb_client.h is the existing internal client interface (which was mainly
in ctdb.h), and ctdb_protocol.h is the information needed for the wire
protocol only.

ctdb.h will be the new, shiny, libctdb API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 4bba6b8cd47b352f98d41f9f06258d5ac3c9adef)
2010-05-20 15:18:30 +09:30
Michael Adam
e0666edf6b tests:ctdb_bench: make send_start_messages() static - eliminates compile warning
Michael

(This used to be ctdb commit e1a16c23d7dbf011ad220572f1bf081331efa8f8)
2010-05-11 11:29:45 +02:00
Michael Adam
fd5a55cd22 tests: eliminate a floating point exception by requiring -n option to ctdb_bench
Michael

(This used to be ctdb commit 07823e1fe75c588b75f4e42c80b0a7bc974238f7)
2010-05-11 11:29:45 +02:00
Stefan Metzmacher
3419e9c4dd server: add "setup" event
This is needed because the "init" event can't use 'ctdb' commands.

metze

(This used to be ctdb commit 1493436b6b24eb05a23b7a339071ad85f70de8f4)
2010-02-23 10:38:49 +01:00
Martin Schwenke
a8508e8a96 Test suite: Make "ctdb ip" test backward compatible with older ctdb versions.
Recent updates to the test meant that it only worked with the latest
ctdb versions.  This changes things so that we never bother matching
the machine readable header, just the actual data in the output.  It
also takes a slightly more liberal approach in massaging the human
readable output to ensure it matches the machine readable output.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 11e72356e849ed4cb315c942e30e9bcadc624f42)
2010-02-11 10:08:46 +11:00
Stefan Metzmacher
179c098e86 server: start with disabled interfaces and let the event scripts enable the interfaces explicit
This makes sure that we don't get public addresses assigned during the
initial recovery and remove them again in the startup event.

metze

(This used to be ctdb commit f872e8c63a2f8979e6a0d088630575bdd4d7b4f1)
2010-01-20 11:11:01 +01:00
Stefan Metzmacher
a6437bc707 tools/ctdb: display interfaces in "ctdb ip" and "ctdb ip -Y" outputs
metze

(This used to be ctdb commit dffa2b05acce8b73c2fdd085311732bf57f01b7f)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
0054f0c54f tests: add a all_ips_on_node() helper function that wraps ctdb ip -Y
metze

(This used to be ctdb commit c24fbea156dfdc9154e94eace725526e44cbcdac)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
04d896a5fe tests/simple/11_ctdb_ip.sh: be more strict in checking ctdb ip -Y output
metze

(This used to be ctdb commit 27bde04966e22975777b4034dbaccfe158369110)
2010-01-20 11:11:00 +01:00
Stefan Metzmacher
fd06167caa server: add "init" event
This is needed because the "startup" event runs after the initial recovery,
but we need to do some actions before the initial recovery.

metze

(This used to be ctdb commit e953808449c102258abb6cba6f4abf486dda3b82)
2010-01-20 09:44:36 +01:00
Martin Schwenke
05dff92925 Merge commit 'origin/master'
(This used to be ctdb commit 82e1c5231c389bea935328a08ecf9b0b3a3979ef)
2009-12-18 14:44:25 +11:00
Martin Schwenke
d67f43fd50 Test suite: Add an optimisation in the getvar test.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d9105ea79df198a20c2bfe471c4793d1dbba886e)
2009-12-18 14:43:45 +11:00
Martin Schwenke
5e92afeb33 Test suite: allow settign of timeout triggers for all events not just monitor.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f319bd54369a2bc7d32c3bda7fc22f2ef1a51c3a)
2009-12-18 14:42:58 +11:00
Stefan Metzmacher
9a96ae0c97 server: only do the mkdir() calls for db_directory* once at the start
metze

(This used to be ctdb commit f30f33685db50860b6cd6fd1b6bdc3066620a78f)
2009-12-16 08:03:56 +01:00
Ronnie Sahlberg
fcd16342f6 Merge branch 'trans3'
(This used to be ctdb commit b765e12a5fb87a6121e49b349017b6a961929346)
2009-12-15 21:00:22 +11:00
Ronnie Sahlberg
3b53c02e34 add a new test tool that just locks and releases the same record over and over
(This used to be ctdb commit 24767be2eb9aed29704c2a4097bab5466cb6728f)
2009-12-15 12:14:49 +11:00
Ronnie Sahlberg
244bc5cc8f ctdb_fetch requires the number of nodes being specified.
Have it log an error and terminate if thie parameter was omitted

(This used to be ctdb commit 340be0179f55acfff77f8c3c8be958679227bde1)
2009-12-15 11:29:16 +11:00
Michael Adam
aea324336c tests: temporarily disable the transaction test tool.
Make it return success for make test.
This is temporarily disabled until the rewrite of the
transaction code (in samba and the daemon) using the global
lock feature has been ported to the ctdb client code.

Michael

(This used to be ctdb commit 78ca29352aa39f4ef4e41096b92d55cb2e0d348a)
2009-12-12 00:45:39 +01:00
Michael Adam
54b9a49e2e tests: remove the no_trans mode from ctdb_transaction.
Writes without transaction are not possible any more on
persistent databases.

Michael

(This used to be ctdb commit 59f46d7261dfdbdef900bf95dd9eb28ad22a46b2)
2009-12-09 22:04:48 +01:00
Michael Adam
332017925f tests: remove the persistent_unsafe writes test.
This is useless now that persistent write operations without
transaction are forbidden.

Michael

(This used to be ctdb commit b022863d44026c19d5aae54aa485b670bea0540e)
2009-12-09 21:57:00 +01:00
Michael Adam
aa6e42a4ba tests: remove persistent_safe write test.
This is useless now that persistent writes without transactions are forbidden.

Michael

(This used to be ctdb commit 9ac82311d796e1fab31f8de62b8ccc754445093c)
2009-12-09 21:56:59 +01:00
Michael Adam
c32ff2bbb0 test: add test 54_ctdb_transaction_recovery.sh
This is like the 53_ctdb_transaction test, but it additionally
runs a loop with recoveries while the transactions are running.

When called like this, the transaction loops run for 10 minutes:

CTDB_TEST_TIMELIMIT=600 tests/scripts/run_tests tests/simple/54_ctdb_transaction_recovery.sh

The default timelimit is 30 seconds.

Michael

(This used to be ctdb commit 2ff2679e8f3d50ebf735f2c420898a84268bdc95)
2009-12-09 21:56:59 +01:00
Michael Adam
edfc6a8c12 test: get value for --timelimit from environment var CTDB_TEST_TIMELIMIT in transaction test
Michael

(This used to be ctdb commit c13077ca64f6e6569c30ef7fcb044e5711dce1a3)
2009-12-09 21:56:59 +01:00
Michael Adam
814e3c501f tests:ctdb_transaction: print an extra counters when a commit fails
Michael

(This used to be ctdb commit 4113385865f53a57b18ea752a7dad8a08bed588e)
2009-12-04 11:30:21 +01:00
Michael Adam
0213cb4d0b tests: turn printfs into DEBUG statements in the ctdb_transaction test
Michael

(This used to be ctdb commit 0e130d79ab71cf3aa65c40af91866823246a0283)
2009-12-04 11:30:20 +01:00
Martin Schwenke
4ea6069de4 Test suite: Make the CIFS tickle test wait until it sees the required tickle.
The test depended on the exit code of "ctdb gettickles", which always
succeeds.  This change wraps the command in a function that checks
whether the tickle we're interested in is registered.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c4b05a731e1bee8f5b46529773a4f5389b2b6064)
2009-11-19 14:54:05 +11:00
Martin Schwenke
386d23757b Test suite: Fix the NFS and CIFS tickle tests.
The NFS test sleeps for MonitorInterval to give CTDB time to record an
NFS tickle.  However, this isn't always long enough.  This changes the
test to wait until a monitor event has actually occurred.

The CIFS test assumes that Samba is able to register a tickle with
CTDB before it notices that netstat has registered the tickle and can
use onnode to ask CTDB about it.  That is an incorrect assumption -
sometimes we can get to the point of asking CTDB about the tickle
before Samba and CTDB have processed it.  This adds a timeout loop
that makes the CIFS test wait until the tickle has been registered or
fail after 10 seconds.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 20a9d35933d89dc7eb710075f360686a49d78609)
2009-11-13 09:44:34 +11:00
Martin Schwenke
9dabb86f3f Merge commit 'origin/master'
(This used to be ctdb commit ffb911896704ddf6bd5a66e43ba2ae8c382e68de)
2009-11-11 12:16:30 +11:00
Michael Adam
de875c7eec Revert "dont exit on a commit failure"
This reverts commit 4e9a3a5dc232bac12ab387ea0cf4f1b279bed5c1.

Transaction commit should not be allowed to fail.
This is a real error.

Michael

(This used to be ctdb commit 825c506da76d7afd0714b75b8c8727874183a618)
2009-10-30 22:01:53 +11:00
Martin Schwenke
8767c894a0 Test suite: Regression fix - wait_until should not run command in sub-shell.
Commit 25e82a8a667a54c6921ef076c63fdd738dd75d19 changed wait_until()
to protect the command it runs from "set -e" by running it in a
subshell.  This breaks uses where the command is expected to set
global variables.  For example, wait_until_get_src_socket lost the
value of $out from its call to get_src_socket().

The fix is to not be lazy and use a sub-shell!

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 39642e745254d93d74dde907787503854fe6ca4a)
2009-10-28 13:02:18 +11:00
Martin Schwenke
12798118a1 Test suite: Remove the disable/enable monitor tests - they are useless.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8264c42969d4be7fc6c5b4d56f8b5ef7c62b3bfb)
2009-10-21 21:47:06 +11:00
Martin Schwenke
f2a9ba6976 Test suite: Fix the timeouts on the skip share check tests.
The timeout for waiting for state changes isn't very predictable.  It
is "about" MonitorInterval seconds...  but can be longer given the
duration of eventscript runs and other things.  So, we change the
timeout to MonitorInterval + EventScriptTimeout, hoping it never takes
that long.

Move the eventscript installation/removal from the old fake-tests into
a function in the functions file.  Implement supporting functions to
create/remove/check-for various files that it handles.  Also add a
function that uses all of this that waits for the next monitor event
(but only if all other monitor events pass).

The final check in the skip share check tests uses the above and waits
for a monitor event, and then checks that the node is still healthy.

Also enhance the wait_until function to handle a command starting with
'!' (as a separate word) to make it easy to wait for a file not to
exist.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 25e82a8a667a54c6921ef076c63fdd738dd75d19)
2009-10-21 21:36:39 +11:00
Martin Schwenke
7b1e9267f2 Test suite: A timeout of MonitorInterval seconds sometimes isn't enough.
Monitor events sometimes happen a little bit more than MonitorInterval
seconds apart.  This changes some timeouts to MonitorInterval + 1
seconds.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 6ef4364b3349145b2fec23e0431cd6df6dcadd41)
2009-10-20 17:11:01 +11:00
Martin Schwenke
b84c2d3a6e Test suite: New tests for validating SKIP_SHARE_CHECK options.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f50d64a8ac91415ca297216d2103ff940076f02b)
2009-10-20 16:52:22 +11:00
Martin Schwenke
43780f5f57 Test suite: Update 99_ctdb_uninstall_eventscript.sh to use ctdb_init().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2b478b0f5f09dd06626592573f053706ac637edd)
2009-10-20 16:51:06 +11:00
Martin Schwenke
d79f7647e7 Test suite: Fix bug in node_has_status().
This function has been broken since it was updated to work with the
"stopped" state (probably commit
67c5bfb5f02c9d45a32d976021ede4fb2174dfe9).  Although ${var#:*:0}
removes the shortest matching prefix of $var, '*' can match substrings
that include ':' if '0' isn't where you expect.  So we were making
unexpected matches and incorrectly returning true for some cases.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 11137bc2d492a62a26ec9f9f62ff362e81643f66)
2009-10-20 16:45:29 +11:00
Martin Schwenke
469ee69363 Test suite: add -x option to ctdb_init() function.
This facilitates tracing of tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 1f906bd3476e7cebf217e35b5477d6a7bb615a0c)
2009-10-20 16:44:44 +11:00
Ronnie Sahlberg
2ab8f6a368 Merge commit 'martins/master'
(This used to be ctdb commit 9b206d96da3341836cc25aee5693f551f6f3a80e)
2009-10-01 15:46:01 +10:00
Martin Schwenke
3edf5532d5 Test suite: The ctdb ping test should allow time to go backwards.
Time can actually go backwards during this test if ntpd happens to
adjust it little bit.  So we should cope...

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 23ae9e9863ea90c6fb3f105403fd098041fa73f4)
2009-10-01 15:39:09 +10:00
Ronnie Sahlberg
dfc2500a1f dont exit on a commit failure
(This used to be ctdb commit 4e9a3a5dc232bac12ab387ea0cf4f1b279bed5c1)
2009-10-01 14:53:35 +10:00
Ronnie Sahlberg
63278ad040 Revert "Revert "allow the transaction commit to fail""
This reverts commit 74e416108df6934f45ca646d709785dd76ab3c35.

(This used to be ctdb commit d1d370033d5007ad1c2c34cd9eeac53001f4b13e)
2009-10-01 14:51:32 +10:00
Martin Schwenke
e976209996 Merge commit 'origin/master'
(This used to be ctdb commit 096cdc0c12d22d99f8405bee5cb9f05c616c8492)
2009-09-29 12:59:10 +10:00
Martin Schwenke
4948051bf4 Test suite: Print debug info on node status timeouts.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a083a1976d621c76121f1fa2c2f484cfa47267bd)
2009-09-25 18:00:17 +10:00
Michael Adam
d0289c650e Revert "dont check if commit failed, we do allow the commit to fail sometimes"
This reverts commit affa6f47432507e84b7e76b88a2c27fff8e6e2e4.

Transaction commit should not be allowed to fail.
This is a fatal error.

Michael

(This used to be ctdb commit 4364419a486c1995bea56dab603cc4960e7c8e7a)
2009-09-21 11:16:18 +02:00
Michael Adam
fcaca26ec4 Revert "allow the transaction commit to fail"
This reverts commit 7a6134e684c9ac4763bf198ef1410867b6082c94.

Transaction commit should not be allowed to fail.
This is a fatal error.

Michael

(This used to be ctdb commit 74e416108df6934f45ca646d709785dd76ab3c35)
2009-09-21 11:16:18 +02:00
Martin Schwenke
3d8fa9e9e3 Test suite: Update "complex" tests for wait_until_node_has_status() change.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 31216fd48117526c943e42d137ce24ef89fa0009)
2009-09-11 16:15:31 +10:00
Martin Schwenke
b8b28cb567 Test suite: wait_until_node_has_status() now uses "onnode any".
Many tests currently do this sort of thing:

  onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status 1 disconnected

In fact, they all use exactly the same "onnode 0 $CTDB_TEST_WRAPPER"
idiom.  This is both repetitious and dangerous, since node 0 might be
shutdown during a test.  Instead, we push "onnode any
$CTDB_TEST_WRAPPER" (which selects a connected node) into
wait_until_node_has_status() and just call that function directly in
tests, like this:

  wait_until_node_has_status 1 disconnected

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a2aaef03d4d6bbd4b42f50f732254935d4d3469c)
2009-09-11 15:55:53 +10:00
Martin Schwenke
7e09c07a34 Test suite: Rework the cluster (re)start code.
Make it possible to start on only 1 node - for tests that need to
restart a particular node.

_ctdb_hack_options() attempts to see what options are being passed to
a daemon that is being run via the initscript.  It then sets a
corresponding environment variable that the initscript knows about.
Currently only the --start-as-stopped option is supported.  This is
extremely ugly but it seems like the only way...  :-(

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 407b3117dfc1072117abf681ec98b9e252d8744c)
2009-09-11 14:06:12 +10:00
Ronnie Sahlberg
724afb2402 allow the transaction commit to fail
(This used to be ctdb commit 7a6134e684c9ac4763bf198ef1410867b6082c94)
2009-09-09 12:50:55 +10:00
Ronnie Sahlberg
f9c1f632e0 Merge commit 'martins/master'
(This used to be ctdb commit 12e14a09dd28ed005c8eb8fca7cd38a96aab938e)
2009-09-09 12:50:21 +10:00
Ronnie Sahlberg
26f73e4504 dont check if commit failed, we do allow the commit to fail sometimes
(This used to be ctdb commit affa6f47432507e84b7e76b88a2c27fff8e6e2e4)
2009-09-09 12:48:21 +10:00
Martin Schwenke
9d03cfde3a Test suite: fix minor typo in complex/32_cifs_tickle.sh
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit cd65d8acb97aa9f83ff0d0585bf09caef2d2f3eb)
2009-08-27 12:35:52 +10:00
Martin Schwenke
1bde47212d Test suite: Fix debug code for unexpectedly unhealthy cluster.
The debug code should run "ctdb status" on a cluster node, not on the
test client.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 448cd8db1305c1e6dfab323f92eac4a576596e4e)
2009-08-27 12:32:16 +10:00
Martin Schwenke
bd98b6c699 Test suite: ctdb_persistent.c needs to use transactions.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 49de8429d2a996dc055370541a12ea36762abe94)
2009-08-14 20:47:38 +10:00
Martin Schwenke
7207e1b837 Merge commit 'origin/master'
(This used to be ctdb commit 0e9c3e0cf76dd33a24241f02709e56bc330f009a)
2009-08-12 08:48:03 +10:00
Michael Adam
6cf67b9bb0 tests: fix the 52_ctdb_fetch.sh test.
The parser for the output of the ctdb_fetch program
did not match the output that ctdb_fetch generates.
It seemed to rather come from the ctdb_bench test...

This patch adapts the parser to correctly interpret
the output of ctdb_fetch.

Michael

(This used to be ctdb commit 836b95f32724cf37e4f643f20653f78842613692)
2009-08-04 09:46:40 +02:00
Martin Schwenke
1cfed53659 Merge commit 'origin/master'
(This used to be ctdb commit abf4540bfb06de56b0a7b5976b5f1b2a24a8743d)
2009-07-31 11:04:37 +10:00
Martin Schwenke
7d1203e4c2 Test suite: Retrieval NFS_TICKLE_SHARED_DIRECTORY more defensively.
In complex/31_nfs_tickle.sh we run sed against a file that might not
exist, causing potential garbage from stderr in the output.  Check
that the file exists before running sed.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f9b71757f034732647228d4b8a8f00528028b6b0)
2009-07-30 14:10:34 +10:00
Martin Schwenke
d7981fdcda Test suite: Better diagnostics for recent change to complex/31_nfs_tickle.sh.
Add a -v so we see the output of the command that tries to get the
value of NFS_TICKLE_SHARED_DIRECTORY.  That way we can tell if a value
was retrived OK or if we're using the default.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c53353c6402f378f29200313d82f1f9262d628b1)
2009-07-30 14:03:44 +10:00
Martin Schwenke
aed71a760d Test suite: complex/31_nfs_tickle.sh should use NFS_TICKLE_SHARED_DIRECTORY.
Rather than hardcoding the location of the shared tickle directory,
attempt to use the value of NFS_TICKLE_SHARED_DIRECTORY from
/etc/sysconfig/nfs on node 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 878437a909ea44dfc3635f082e34741ee256e505)
2009-07-30 13:57:40 +10:00
Martin Schwenke
e47328742d Test suite: Ask CTDB about CIFS tickles registered for the actual test node.
This failed when node 0 had no public IPs because we would always run
"ctdb gettickles" on node.  We now ask node 0 for the tickles on the
test node.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8fcc4610de926f44e18ec85fb57ca5f7d3c28bd6)
2009-07-30 13:45:06 +10:00
Martin Schwenke
3d91b6442e Test suite: Turn off strict host key checking in the SSH failover test.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b7787255391eddef8458f81ff9b75d9116e2afd3)
2009-07-30 13:20:23 +10:00
Ronnie Sahlberg
690f1537f0 Merge commit 'martins/master'
(This used to be ctdb commit 32a69b0efa078b069802470be6488a4efe32961d)
2009-07-30 10:55:56 +10:00
Martin Schwenke
063bd6e278 Test suite: fix test file permissions in complex/44_failover_nfs_oneway.sh.
Something, perhaps root_squash, causing permission denied on the test
file after we copy it over with scp.  This sets the initial
permissions to be friendly and adds -p to the scp command to maintain
those friendly permissions.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 52f21f5a92eb14df7540a2ae9e212d936e646c06)
2009-07-30 10:47:36 +10:00
Martin Schwenke
73ca4b6c8b Test suite: fix the test suite's generic event script.
Add a "stopped" case to log events and stop the event script from
failing with an unknown event.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 7f67f7395e2233f0bba2e9662404aad49e13f645)
2009-07-29 18:10:05 +10:00
Martin Schwenke
48078dd24f Test suite: Fixes for node state parsing plus new stop/continue tests.
The parsing of "ctdb status -Y" output to determine various node
states was implemented very strictly.  Therefore, the parsing broke
due to the addition of the new "stopped" state to the output of "ctdb
status -Y".  This relaxes the parsing so that it should work for
versions prior to the introduction of the "stopped" state, as well as
future versions that add new states to the end of the list of bits in
output of "ctdb status -Y".

Similarly the check for cluster unhealthy (in _cluster_is_healthy())
now just checks for a single 1 in any bit in the "ctdb status -Y"
output, rather than checking for a particular number of 0s.

New tests
tests/simple/{41_ctdb_stop.sh,42_ctdb_continue.sh,43_stop_recmaster_yield.sh}
do rudimentary testing of the stop and continue functions.

Remove tests tests/simple/41_ctdb_ban.sh and
tests/simple/42_ctdb_unban.sh.  They were both unreliable.

tests/simple/21_ctdb_disablemonitor.sh now schedules a restart, since
one will be required.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 67c5bfb5f02c9d45a32d976021ede4fb2174dfe9)
2009-07-29 18:01:07 +10:00
Ronnie Sahlberg
cca0aae1f5 From Michael Adam:
Update the transaction test tool to the new api for transactions

(This used to be ctdb commit 4d9a53f142deba6ab578af2fc35bfa99c29c3a99)
2009-07-29 11:18:02 +10:00
Ronnie Sahlberg
366d413f2b new version 1.0.87
(This used to be ctdb commit d187eb8507f35a650ff3ffc50fa49110eebca0bd)
2009-07-17 13:01:11 +10:00
Martin Schwenke
d846eb78db Test suite: Fix debug code for unexpectedly unhealthy cluster.
The debug code should run "ctdb status" on a cluster node, not on the
test client.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 34e6f8a04b12f8879eb42d417f9741502ccccf0f)
2009-07-16 14:04:06 +10:00
Martin Schwenke
168ec02adf Test suite: new tests and code factoring.
* 2 new tests for NFS failover.

* Factor repeated code from tests into new functions
  select_test_node_and_ips(), gratarp_sniff_start() and
  gratarp_sniff_wait_show().  Use these new functions in existing and
  new tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit de0b58e18fcc0f90075fca74077ab62ae8dab5da)
2009-07-08 13:37:52 +10:00
Martin Schwenke
96b3517356 Test suite: better debug info when the cluster is unexpectedly unhealthy.
cluster_is_healthy() is now run locally in tests and internally causes
_cluster_is_healthy() to be run on node 0.  When it detects that the
cluster is unhealthy and $ctdb_test_restart_scheduled is not true,
debug information is printed.  This replaces the previous use of
$CTDB_TEST_CLEANING_UP.

To avoid spurious debug on expected restarts, added scheduled
restarts to several tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ee7caae3a55a64fb50cd28fa2fd4663c5dd83b4f)
2009-07-06 17:52:11 +10:00
Martin Schwenke
d90d54ea3e Make ctdbd restarts in tests more reliable.
This works around potential race conditions in the init script where
the restart operation is not necessarily reliable.  It just wraps the
actual restart in a loop and tries for a successful restart up to 5
times.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 1cac8a0ad429f29d1508158c7f7c42a2f1a22945)
2009-07-06 16:40:31 +10:00
Martin Schwenke
35f998346e When testing make the time taken for some operations more obvious.
If wait_until() does not timeout, print the time taken for the command
to succeed.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bdb856ee22816ae1f6b8d15856555f488054f489)
2009-07-06 16:39:08 +10:00
Martin Schwenke
5d67aa2332 New tests for different aspects of failover.
3 separate tests:

* Check that gratuitous ARPs are received and take effect.

* Check that ping still works after failover.

* Check, via SSH, that the hostname changes after failover.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 92011cc05bbdb517ec6a4573f5cb9f6f21c3059e)
2009-07-03 20:55:02 +10:00
Martin Schwenke
613341d150 Updates to TCP tickle tests and supporting functions.
* Removed a race from tpcdump_start().  It seems impossible to tell
  when tcpdump is actually ready to capture packets.  So this function
  now generates some dummy ping packets and waits until it sees them
  in the output file.

* tcpdump_start() sets $tcpdump_filter.  This is the default filter
  for tcpdump_wait() and tcpdump_show(), but other filters may be
  passed to those functions.

* New functions tcptickle_sniff_start() and
  tcptickle_sniff_wait_show() handle capturing TCP tickle packets.
  These are used by complex/31_nfs_tickle.sh and
  complex/32_cifs_tickle.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8e2a89935a969340bfead8ed040d74703947cb81)
2009-07-03 20:44:55 +10:00
Martin Schwenke
7b3abce684 Add an extra ctdb recovery to test function restart_ctdb().
There are still very rare cases where IPs haven't been reallocated
before the beginning of the next test, so this adds a sleep and an
extra call to "ctdb recover" to restart_ctdb().

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c2bdb77d91761c003e2f0e6918a27c54150f6030)
2009-07-03 18:01:29 +10:00
Martin Schwenke
dba6c1ca77 Fix the run_tests script so that the number of columns is never 0.
Sometimes "stty size" reports 0, for example when running in a shell
under Emacs.  In this case, we just change it to 80.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e309cb3f95efcf6cff7d7c19713d7b161a138383)
2009-07-03 17:58:38 +10:00
Martin Schwenke
0d425a07d4 Separate test cleanup code in output and clean up ctdb restart code.
* ctdb_restart_when_done() now schedules a restart by setting an
  explicit variable that is respected in ctdb_test_exit(), rather than
  adding a restart to $ctdb_test_exit_hook.  This means that restarts
  are all done in one place.

* ctdb_test_exit() turns off "set -e" to make sure that all cleanup
  happens.

* ctdb_test_exit() now prints a clear message indicating where the
  test ends and the cleanup begins.  This message also includes the
  return code of the test.

* Add debug in cluster_is_healthy to try to capture information about
  unexpected unhealthiness when a test starts.

* Simplify simple/07_ctdb_process_exists.sh so that the exit code is
  generated more obviously.

* Remove redundant calls to ctdb_test_exit at the end of tests, since
  they're done automatically via a trap.  Also remove any preceding
  warnings of restarts or final hints about test success/failure.

* Allow multi-digit debug levels in simple/12_ctdb_getdebug.sh and
  simple/13_ctdb_setdebug.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b6fa044a1364cbb3008085041453ee4885f7ced1)
2009-07-03 17:40:16 +10:00
Martin Schwenke
62871fbcd5 Clean up handling the of CTDB restarts in testcases.
Glitches during restarts of the CTDB cluster have been causing some
tests to fail.  This is because restarts are initiated in the body of
many tests.  This adds a simple function ctdb_restart_when_done, which
schedules a restart using an existing hook in the test exit code.
This function is now used in tests that need to restart CTDB.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d440e83bb4f0c19c085915d0f0e87cc0dabbc569)
2009-06-19 11:40:09 +10:00
Martin Schwenke
ffff61c13b New tests for NFS and CIFS tickles.
New tests/complex/ subdirectory contains 2 new tests to ensure that
NFS and CIFS connections are tracked by CTDB and that tickle resets
are sent when a node is disabled.

Changes to ctdb_test_functions.bash to support these tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 31cc46eb157ca1301312f14879e4fb4da7d81088)
2009-06-16 12:47:59 +10:00
Martin Schwenke
ad3c89095e Make 51_ctdb_bench.sh more tolerant.
Limit the allowable difference in message counts in either direction
around the ring to 5% (up from 2%).  There is something environmental
making this blow out to 3% very occasionally when there's no obvious
problem with ctdb.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d6e6909ac629212b3028e13b958e1a17c64bee8c)
2009-06-10 16:15:09 +10:00
Sumit Bose
887046352d fix re pattern to accept the new recovery lock times in the statistics output
(This used to be ctdb commit ba44aae7307b4fa56f7b2da2cd9d4a7ccd0a135e)
2009-05-25 11:15:00 +10:00
Ronnie Sahlberg
26e1486db7 Whitespace changes and using the CTDB_NO_MEMORY() macro changes to
the previous patch.

(This used to be ctdb commit d623ea7c04daa6349b42d50862843c9f86115488)
2009-05-21 11:49:16 +10:00
Sumit Bose
2fcedf6dac add missing checks on so far ignored return values
Most of these were found during a review by Jim Meyering <meyering@redhat.com>

(This used to be ctdb commit 3aee5ee1deb4a19be3bd3a4ce3abbe09de763344)
2009-05-21 11:22:21 +10:00
Martin Schwenke
2a09b4bad3 In 51_ctdb_bench.sh now allows a 2% difference between positive and
negative.  ctdb_bench.c checks to ensure the timer has advanced from 0
before dividing.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 723413f246399b25166462d2018237920515655f)
2009-05-12 14:45:46 +10:00
Martin Schwenke
d59cd199e4 Avoid floating point divide by 0 in ctdb_fetch.c's bench_fetch().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3c67e164eb92591f8763883430490805c1dfa9ed)
2009-05-12 14:45:14 +10:00
Martin Schwenke
7c7c5b3489 Bug fixes for tests: simple/12_ctdb_getdebug.sh and scripts/test_wrap.
simple/12_ctdb_getdebug.sh now recognises output with multi-digit node
numbers.

Sharing the ctdb directory via NFS and testing on a real cluster by
setting CTDB_TEST_REAL_CLUSTER didn't work by default.  The fix is to
hack scripts/test_wrap so that it tries to find a valid bin directory
next to the directory containing it is in.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ea2ca769e1d1068fbbad843750b19acfd87360e0)
2009-05-12 14:44:30 +10:00
Martin Schwenke
9666d7bf0a Use ctdb_fetch_lock rather than ctdb_call.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5f3d2e29a446972ac244e20a08e48f4c2f4ffef4)
2009-05-12 08:55:36 +10:00
Andrew Tridgell
a0c86e4013 Merge commit 'ronnie/master'
(This used to be ctdb commit 1a110993af1706e0c5df500fa7d14e16c0668372)
2009-02-09 10:53:47 +11:00
Michael Adam
b183acf467 add a simple test script to test ctdb_check_tcp_ports
Michael

(This used to be ctdb commit 2634f1bd216ce18f061a282a53314cb1650dbd05)
2009-01-30 22:49:17 +01:00
Martin Schwenke
1b61a149f4 Make message in 62_ctdb_persistent_unsafe.sh more informative.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4777b74b1e2eebe54cf27f3303f60e49023e7f6a)
2009-01-16 15:50:33 +11:00
Martin Schwenke
fc1f71ce0f 23_ctdb_moveip.sh sanity checks the list of IPs/nodes instead of
looping forever on older versions of CTDB.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 03dfcf9f284c9926479a8dd4e5acf1f5d2b964aa)
2009-01-16 15:12:40 +11:00
Martin Schwenke
7c6153e6aa Remove the sorts from 06_ctdb_getpid.sh - the PIDs should be listed in
node order.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4b97bdba3bc4df20efb1aae7d89a1e3430d35ca3)
2009-01-13 17:02:59 +11:00
Martin Schwenke
5038a0d08a Use $CTDB_TEST_WRAPPER in other tests that need it.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2912c1ade5db1e20bfa3a8017a702cc8a7da36f1)
2009-01-13 14:55:31 +11:00
Martin Schwenke
cb09075891 Use $CTDB_TEST_WRAPPER in 51_ctdb_bench.sh.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 44ec4c57bf9928ef5d5cc117a6c2d92495dac489)
2009-01-13 14:51:40 +11:00
Martin Schwenke
38593aa3e1 For now, make tests/run_tests.sh runs the new test suite. Add
tests/TODO.  Remove tests/start_daemons.sh - no longer used.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5cdbef46b74e6a5ba2383ef025e69fe605fa4f6e)
2009-01-12 15:47:12 +11:00
Martin Schwenke
2e87ed4e9d Test binaries now go in tests/bin and ctdb_test_env now adds this
directory to $PATH if local daemons are being used.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a497010f67d6a8e68f4d6d7e516b88d2261b1062)
2009-01-09 18:15:06 +11:00
Martin Schwenke
91972a6bfc Add tests/README. ctdb_test_env and, therefore, run_tests can now be
run from the tests subdirectory... and most other sensible places.
Rename $CTDB_TEST_REMOTE_SCRIPTS_DIR to $CTDB_TEST_REMOTE_DIR since it
is now intented that this directory can contain test binaries too.
daemons_start() now passes a full path to the events.d directory when
starting ctdbd.  Also fixed the path to ctdbd.  41_ctdb_ban.sh and
42_ctdb_unban.sh fail immediately if they fail to select a test node.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3ecce31d3a3f72b9fa851ac99291865c119e551e)
2009-01-09 17:52:38 +11:00
Martin Schwenke
a70327ce1a Delete some unstructured tests ({fetch,peristent,transaction}.sh) and
replace them with new simple tests (52_ctdb_fetch.sh,
53_ctdb_transaction.sh, 61_ctdb_persistent_safe.sh,
62_ctdb_persistent_unsafe.sh).  Remove "_simple" from some test
filenames in the simple subdirectory - that's redundant.  Always run
ctdb as $CTDB to allow $VALGRIND magic to be used.  Use pgrep/pkill to
detect/kill local daemons so those running under valgrind can be found
too - to support this, always run local daemons with the full path to
the executable.  run_tests now supports -s option to print sumamry
when done - with more and more tests, it is getting hard to follow
progress.  Sort the output of commands in 06_ctdb_getpid.sh to make
sure they compare nicely and also allow the processes' executables to
be called "memcheck" to catch those running under valgrind.  Remove
redundant calls to onnode in commands run from calls
try_command_on_node in some tests.  41_ctdb_ban.sh and
42_ctdb_unban.sh avoid banning the recmaster, since this causes the
recmaster to be reassigned and all nodes to be unbanned.  Minor
cleanups.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 33cdf3e4bcfadf8e20822ca352babf7acca16821)
2009-01-08 17:12:03 +11:00
Martin Schwenke
6ad847b9ac Remove old ctdbd.sh test script. Remove unneeded nodes.txt and
public_addresses files - these are now created in tests/var as needed.
09_ctdb_ping.sh now recognises new "node disconnected" message.
Replace custom recovery detection code (which could not have been
working) with a call to "ctdb recover" in 32_ctdb_enable_simple.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 486ed3b5b483f1c12c2d978ec6564bd33a2c6aee)
2008-12-18 14:25:07 +11:00
Martin Schwenke
c572c11d3a Remove bench.sh test and replace with new test 51_ctdb_bench.sh.
Function try_command_on_node node passes any options other than -v to
onnode.  Minor update to 14_ctdb_statistics.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e627f8e5fe8e2e3ea423b7dbd12d74597fb4983b)
2008-12-18 11:28:43 +11:00
Martin Schwenke
fae7e15114 Bug fixes for ctdb_bench from Ronnie.
(This used to be ctdb commit 2c055831f0d56e42d055e1d72fb6f0db5f71def1)
2008-12-18 09:45:49 +11:00
Martin Schwenke
12c16dd9b0 ctdb_test_env now sets $CTDB_TIMEOUT. Fixed
26_ctdb_config_check_error_on_unreachable_ctdb.sh to work with new
generic error message when trying to talk to disconnected node.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 33afe9bae732e62994e5957ee143a9c49571898b)
2008-12-17 16:59:23 +11:00
Martin Schwenke
a6fb2c35b4 New test 26_ctdb_config_check_error_on_unreachable_ctdb.sh.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a99204ad8bd4d3b15c8219762442682a3d1285cf)
2008-12-17 15:04:35 +11:00
Martin Schwenke
331f39d340 Finish 24_ctdb_getdbmap.sh. New test 25_dumpmemory.sh.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f5aeab0390b735291ee82359f50d508619211623)
2008-12-16 17:22:22 +11:00
Martin Schwenke
b3dbc3f3aa 3 new tests. 24_ctdb_getdbmap.sh is only 1/2 implemented but does
something vaguely useful.  ctdb_test_exit unsets $ctdb_test_exit_hook.
Fix bug in 17_ctdb_config_delete_ip.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f90f6e19952d58b8590fe550ecf2308bd9b065dc)
2008-12-15 17:52:12 +11:00
Martin Schwenke
3e1e589e58 Add a recovery to ctdb_test_exit to improve test stability.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b7be3de004cb05dad05704096e2a75e128952b18)
2008-12-12 18:44:21 +11:00
Martin Schwenke
6c6fd47528 Rename $CTDB_NUM_NODES to $CTDB_TEST_NUM_DAEMONS and only set it if
$CTDB_TEST_REAL_CLUSTER is not set.  After a ctdb restart, force a
recovery to attempt to help tests that follows.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 497c40f69e06776861a780500da1952eb7ea8fc1)
2008-12-12 17:25:38 +11:00
Martin Schwenke
0d2c4e181e Add message about restart to 18_ctdb_freeze.sh.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2a069118fee169460bdf68b9a639b0e96ac85266)
2008-12-11 18:14:17 +11:00
Martin Schwenke
ceefb6a029 With local daemons the sockets are now numbered starting from 0. Fix
setup of local daemons so that it correctly assigns no public IPs to a
single node each time.  Separate out daemon_setup so that the
selection of the node with no public IPs is only done once at the
beginning of testing.  Clean up all current tests, mostly with a view
to ensuring that a node selected for testing some kind of failover
actually has public addresses assigned.  Reenabled 01_ctdb_version.sh
- it now passes if rpm doesn't do anything useful on the node.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 86807e8b7b179cbe87e559fb3b1f02c8b1990dc4)
2008-12-10 16:13:42 +11:00
Martin Schwenke
60f86400ac Added use of $ctdb_test_exit_hook to function ctdb_test_exit. Removed
sleeps from ban/unban tests.  Now expect "ctdb ping" to return false
if it fails, so made relevant change to 09_ctdb_ping.sh.  New
functions install_eventscript and uninstall_eventscript.  New
setup/cleanup tests 00_ctdb_install_eventscript.sh and
99_ctdb_uninstall_eventscript.sh.  New test 21_ctdb_disablemonitor.sh,
which is incredibly complex.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 23bffef2295772f5b795236d60b7fb6ea754b7fb)
2008-12-09 18:20:11 +11:00
Martin Schwenke
c9ca8ccc23 When running with local daemons, provided there is more than 2 of
them, randomly pick a single node that will not have any public IPs
assigned.  This will make life a bit more interesting and will
simulate what happens on real clusters with a management node.  Some
tests were disabling a node to implicitly trigger a ctdb restart - now
use an explicit restart of ctdb when it is required.
17_ctdb_config_delete_ip.sh now randomly chooses a public IP on any
node to disable - this works around a problem where the hardcoded node
might not have any public addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3d59783c0e9478f4766c380945d6200fc654f5d9)
2008-12-08 08:15:18 +11:00
Martin Schwenke
805c5bf1f3 New test for getmonmode. Overload node_has_status some more to
support checking the monitoring mode.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4e1c079deb0aafb99d4114bb6504ff5ba1cbdeb4)
2008-12-04 17:19:51 +11:00
Martin Schwenke
9a4f7e4f4c ctdb_test_init now contains a trap to force ctdb_test_exit to be run
if the shell exits and ctdb_test_exit cancels this trap.  This means
that a testcase executing under set -e will call ctdb_test_exit on
failure, allowing the cluster to be restarted if necessary so that
following tests can complete successfully.  ctdb_test_exit now
respects $?, so a test will fail if the last thing executed before
ctdb_test_exit failed - this probably means the above trap was
triggered.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 805a426aaee5ecfc5bd1c097069fe58f8241dfe2)
2008-12-03 18:08:21 +11:00
Martin Schwenke
3cdc0cb708 $PATH only inludes $CTDB_DIR/bin if we're using local sockets. Rename
$TEST_WRAP to $CTDB_TEST_WRAPPER - value now set using
$CTDB_TEST_REMOTE_SCRIPTS_DIR if that is set.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a69545d7dec78eefb85a1598e5db4667cc210bf9)
2008-12-03 15:48:24 +11:00
Martin Schwenke
a04094659c 4 new tests. Hacked function node_has_status to support
frozen/unfrozen via ctdb statistics command.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e040a989096cf7d5c0cdece1713ff903cb7568f8)
2008-11-27 18:11:22 +11:00
Martin Schwenke
0b6da4f7ec 4 new tests. Marked more ctdbd.sh tests as done - will remove this
file soon.  Simplify 06_ctdb_getpid.sh by using -v option to
try_command_on_node.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c6fc68db9061547e73ec2b811e260bd7da7f58fa)
2008-11-25 17:53:28 +11:00
Martin Schwenke
5d50f5a91c New test 09_ctdb_ping.sh. Add documentation and command-line
processing to all tests.  New script ctdb_test_env sets up environment
for tests, is now sourced by run_tests, and can also take a test on
the command-line, complete with options.  Various cleanups and
improvements.  Document tests that have been properly implemented in
ctdbd.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 826e85fe5291067b8d0b9c22918d63024aa6141c)
2008-11-24 17:47:09 +11:00
Martin Schwenke
734f3ada52 Move tests/*.c to tests/src/*.c and adjust Makefile.in accordingly.
Move setting of $CTDB_NODES_SOCKETS to tests/scripts/run_tests and
make it only happen if $CTDB_TEST_REAL_CLUSTER is not set.  Bugfix in
function ips_are_on_nodeglob.  New/proper implementations of functions
stop_daemons and start_daemons, now called by function restart_ctdb.
In start_daemons.sh, add public addresses file generation/usage, use
new option --nopublicipcheck to ctdbd to avoid crazy behaviour and
kill ctdbd more carefully to avoid killing real daemons on a real
cluster - this should be able to coexist on a node of a real cluster.
start_daemons.sh is temporarily incompatible with start_daemons
function, but expecting to replace that script with function calls
very soon anyway...

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4c54772c5c2fa7d2a25963379b5b96caf0c2521c)
2008-11-21 19:01:48 +11:00
Martin Schwenke
d741559fa6 Add some simple tests that can be run from within the tree.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit eacb2ef82ea4809d874158756db973dd1e3fc8fc)
2008-11-20 20:40:01 +11:00
Ronnie Sahlberg
07d35c754f add a CTDB_SOCKET variable that can be used to override the default
/tmp/ctdb.socket

(This used to be ctdb commit b75e2263c565c21ecbbd98fbd2c10787e467bf5c)
2008-11-11 14:49:30 +11:00
Ronnie Sahlberg
d83fc7e389 when we collect all ip addresses and sort them for the "ctdb ip -n all" output we must look at more than just the first 4 bytes of the sockaddr address or ipv6 wont work
(This used to be ctdb commit 4dfbfb4618433d9ed79ca1bdb1e2e51d96d4ee62)
2008-08-22 09:09:08 +10:00
Ronnie Sahlberg
37234887d9 fix the ipv6 checksum calculation for pseudoheader so that it actually works
add support to send ipv6 "gratious arp" aka neighbor solicitation packets from ctdb

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>

(This used to be ctdb commit 0a38ea11af9237501f2951fee698a59b46f8750d)
2008-08-19 18:24:08 +10:00
Ronnie Sahlberg
342408d75e remove a file we dont need
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>

(This used to be ctdb commit bf6effef0cc9e5f2eeeb38fce855a90624a76239)
2008-08-19 14:58:57 +10:00
Ronnie Sahlberg
ef997d344f initial ipv6 patch
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>

(This used to be ctdb commit 1f131f21386f428bbbbb29098d56c2f64596583b)
2008-08-19 14:58:29 +10:00
Andrew Tridgell
ae2b9ee17f fixed some warnings
(This used to be ctdb commit fe55bfc8fb6dc628f72f220843e829a251d09936)
2008-07-30 19:59:54 +10:00
Andrew Tridgell
446295f257 fixed a warning
(This used to be ctdb commit 3a71844cfdb9fe69208030432ddb547b0e215726)
2008-07-30 19:59:42 +10:00
Andrew Tridgell
5e969d7a6c cleanup of the old persistent db test
(This used to be ctdb commit 306af4ccef132ea023f1f01e11f877a3a742ee4c)
2008-07-30 19:59:34 +10:00
Andrew Tridgell
bc1aed395c added a new persistent transaction test program
(This used to be ctdb commit d5dcb46e182466e4b51c106f2491178c23babd8d)
2008-07-30 19:55:54 +10:00
Andrew Tridgell
bf32a8e6c3 cleanup on SIGINT
(This used to be ctdb commit 008533d971aec9c28c6e4750ef4677dd943633ff)
2008-07-30 13:21:02 +10:00
Andrew Tridgell
b7e9d0dccf - cleanup persistent db at start
- catch SIGINT and kill daemons

(This used to be ctdb commit d3f5d75665a78ae0081fda57e58384b27a6ae396)
2008-07-30 13:20:47 +10:00
Andrew Tridgell
9c10147fc1 - show pids during test
- don't use first_time, as it is not safe for multiple 
  clients on a node

(This used to be ctdb commit 22f737be0e70fc043affaa4f953f60d852b7999a)
2008-07-30 13:20:24 +10:00
Ronnie Sahlberg
1c88f422d5 add a parameter for the tdb-flags to the client function
ctdb_attach()   so that we can pass TDB_NOSYNC when we attach to
a persistent database and want fast unsafe writes instead of
slow but safe tdb_transaction writes.

enhance the ctdb_persistent test suite to test both safe and unsafe writes

(This used to be ctdb commit 4948574f5a290434f3edd0c052cf13f3645deec4)
2008-06-04 10:46:20 +10:00
Ronnie Sahlberg
a594ac1e91 run the persistent write test with 4 nodes by default
use the timelimit argument to the persistent writer to run the test for
30 seconds by default

(This used to be ctdb commit 181318fea6886c40d0aff02d0de777f28ffeddce)
2008-06-03 18:19:48 +10:00
Ronnie Sahlberg
fba38a5325 redesign the test of persistent writes
so that we have n persistent writers on n nodes,
all writers writing persistently to the same record.

each writer on a node has its own "counter" in this record that is incremented by one in each iteration.
the persistent writer on node 0 also checks that all the counters in the record are increasing monotonically and if they are not, flagging it as an ERROR.

(This used to be ctdb commit 00006222ece63ae3b7f3477646232ae5bbeee6f4)
2008-06-03 18:18:28 +10:00
Ronnie Sahlberg
a8cf6e7914 create the nodes file in a 'test' subdirectory and not the current directory
delete all persistent databases when the test starts
(the tests only uses test databases in a special test directory)

do not set up any public addresses in the tests

wait until there are no disconnected or unhealthy nodes when starting the
test daemons instead of waiting for the recovery mode to change.
we do want to wait until the system has recovered and ALL nodes are ok.

(This used to be ctdb commit dfe0c44c1e8e9dab790686c5ba798986d04bf218)
2008-06-03 18:14:54 +10:00
Andrew Tridgell
f6e53f433b merge from ronnie
(This used to be ctdb commit e7b57d38cf7255be823a223cf15b7526285b4f1c)
2008-02-04 20:07:15 +11:00
Andrew Tridgell
146d4b0db7 merge async recovery changes from Ronnie
(This used to be ctdb commit 576e317640d25f8059114f15c6f1ebcee5e5b6e2)
2008-01-29 13:59:28 +11:00
Andrew Tridgell
3777346629 partial merge from ronnie
(This used to be ctdb commit fd316deb8a9e0545c8efa1bfc8ad83962b310405)
2008-01-29 11:39:06 +11:00
Andrew Tridgell
b62b7fcde8 added syslog support, and use a pipe to catch logging from child processes to the ctdbd logging functions
(This used to be ctdb commit 1306b04cd01e996fd1aa1159a9521f2ff7b06165)
2008-01-16 22:03:01 +11:00
Andrew Tridgell
fae327d471 report the store rate in ctdb_randrec
(This used to be ctdb commit da3fb053d91da76122b12f0efb1d31e085b59574)
2008-01-09 17:45:13 +11:00
Andrew Tridgell
5b6486c35b allow delete percentage to be specified on the command line
(This used to be ctdb commit 1177b48067a92cbf013e19027d4122327c620361)
2008-01-09 15:32:18 +11:00
Andrew Tridgell
10bc8a4c92 added ctdb_randrec test tool
(This used to be ctdb commit be59e7f3db992667664a631433b99ff19f4313f0)
2008-01-04 09:41:04 +11:00
Andrew Tridgell
bb06e831a0 more optimisations to recovery
(This used to be ctdb commit 9a41ad0a842cd4f3792d6e84b5c809b7ff6f342e)
2008-01-02 22:44:46 +11:00
Andrew Tridgell
fa965dee8f quick fix for timeout in recovery
(This used to be ctdb commit 9205c681a819782d061bb41637191c130e91b100)
2008-01-02 12:04:07 +11:00
Andrew Tridgell
4608fcc3a4 need public_addresses for test suite
(This used to be ctdb commit 6d79994eace4802ab72dda2793028264c47d2d56)
2007-11-18 15:01:26 +11:00
Andrew Tridgell
0943fba979 make it easier to test starting large numbers of virtual nodes
(This used to be ctdb commit cf61bf8b8806d29772985c904d5ee15c24d4d767)
2007-11-13 10:28:06 +11:00
Andrew Tridgell
b87ddd9148 no longer wait at startup for services to become available, instead
set the node initially unhealthy and let the status monitoring bring the node online.
This fixes a problem with winbindd, where it refused to start because secrets.tdb was not populated
but we could not populate ctdbd, because the net command would not run while ctdbd was still doing startup
and thus frozen
(This used to be ctdb commit 3a001b793dd76fb96addf1e2ccb74da326fbcfbc)
2007-09-24 10:00:14 +10:00
Andrew Tridgell
c60988325d added support for persistent databases in ctdbd
(This used to be ctdb commit 3115090a0d882beca9d70761130b74bb0821f201)
2007-09-21 12:24:02 +10:00
Ronnie Sahlberg
583b6e6ba6 change ctdb_get_vnn to ctdb_get_pnn
(This used to be ctdb commit 1e19930198c2bcc7ccb755e0ee51555fb823029a)
2007-09-04 10:18:44 +10:00
Ronnie Sahlberg
8fd3df2553 hang the ctdb_req_control structure off the ctdb_client_control_state
struct  so that if we timeout a control we can print debug info such as 
what opcode failed and to which node

we dont need the *status parameter to ctdb_client_control_state

create async versions of the getrecmaster control

pass a memory context to getrecmaster

(This used to be ctdb commit 558b680c82f830fba82c283c78c2de8a0b150b75)
2007-08-23 13:00:10 +10:00
Andrew Tridgell
95f6328678 merge from volker
(This used to be ctdb commit 7007e4f2292aa96287b899d6b9e82c7b597ef58f)
2007-08-22 17:16:01 +10:00
Andrew Tridgell
46639ac19e merged new event script calling code from ronnnie
(This used to be ctdb commit bbacad61b3eee4276ffe44ed2a23949aca8152cf)
2007-08-20 11:10:30 +10:00
Andrew Tridgell
f2fb717402 merge from ronnie
(This used to be ctdb commit 0a91fe52f34d997c1a3cde0fa356deaaf290a4a9)
2007-08-15 11:48:03 +10:00
Ronnie Sahlberg
e0957ba4a4 add a function to return the first entry that is stored in a tree where
the key is an array of uint32_t

(This used to be ctdb commit 99553397aade4f1c4d17ef14dad406934958c80a)
2007-08-15 10:57:21 +10:00
Ronnie Sahlberg
9c6e37fea4 enhanced tests to verify the tree integrity when adding/removing nodes
(This used to be ctdb commit 7885a4fa6e4ac50081e440ed6c82101ec807999f)
2007-08-13 14:29:19 +10:00
Ronnie Sahlberg
a405cc32d9 remove an extra blankline
(This used to be ctdb commit c71f237e384b33e3c560af3329c615bda613ca04)
2007-08-09 16:11:11 +10:00
Ronnie Sahlberg
adb49f02f0 change the mem hierarchy for trees. let the node be owned by the data
we store in the tree and use a node destructor so that when the data is 
talloc_free()d we also remove the node from the tree.

(This used to be ctdb commit b8dabd1811ebd85ee031563e95085f720a2fa04d)
2007-08-09 14:08:59 +10:00
Ronnie Sahlberg
5332b61c4f run the test for 60 seconds if that is what we claim
(This used to be ctdb commit ff0c0526e21c35fe7a599e61cd0f84352c7f6ad6)
2007-08-08 17:49:08 +10:00
Ronnie Sahlberg
22e8064ae9 add more extensive test cases and verify that we are not losing any
memory inside the tree

(This used to be ctdb commit 838376b52d65af509532a141d83b51975c7cc881)
2007-08-08 17:26:40 +10:00
Ronnie Sahlberg
203306400e add helpers to traverse a tree where the key is an array of uint32
(This used to be ctdb commit d328c66827cafff6356e96df2a782930274fe139)
2007-08-08 13:50:18 +10:00
Ronnie Sahlberg
9525b010aa add helpers to add/lookup/delete nodes in a tree where the key is an
array of uint32

(This used to be ctdb commit b7e0996e7735c8629d07453b9d335990c2dbc3db)
2007-08-08 12:30:12 +10:00
Ronnie Sahlberg
c1bfda5772 add a tree insert function that takes a callback fucntion to populate
the data of the tree.
this callback makes it more convenient to manage cases where one might 
want to insert multiple entries into the tree with the same key

rename the tree->tree pointer to tree->root  since this is supposed to 
point to the root of the tree

add a small test utility

(This used to be ctdb commit f6313bed9c53e0d1c36c9e08ac707e88e2a4fcd5)
2007-08-08 11:21:18 +10:00
Ronnie Sahlberg
64f61364a7 add a small tool to compare rb tree with a timeval_compare()+add an
entry to the end of the list DLIST (worst case insert)

(This used to be ctdb commit dcdf4a1f1c6675ae11ab26726c867d7782954fc6)
2007-07-30 10:50:35 +10:00
Andrew Tridgell
32de198fd3 update lib/replace from samba4
(This used to be ctdb commit f0555484105668c01c21f56322992e752e831109)
2007-07-10 15:29:31 +10:00
Andrew Tridgell
732353de5f - merged ctdb_store test from ronnie
- added DatabaseHashSize tunable
- added logging of events inside recovery (for timing)

(This used to be ctdb commit 3593cdb928b91e217faf1b3c537fa28dc82cdace)
2007-06-17 23:31:44 +10:00
Ronnie Sahlberg
cddf988961 add a small test tool that can be used to create a massive amount of
records in the test database.

the tool first creates the number of records requested, then it will 
loop infinitely reading the records out again.

(This used to be ctdb commit dca2497097a9cdff268b1e5d446f6feb71bfb389)
2007-06-17 11:13:42 +10:00
Andrew Tridgell
2b91099585 support up takeover in testing when root
(This used to be ctdb commit df409156e685373ea98986511149c9fba3a8c812)
2007-06-09 21:47:06 +10:00
Andrew Tridgell
b50096c835 more code rearrangement
(This used to be ctdb commit 2bcf3b16163041f03add2e5bf9f1f5fb3599ec24)
2007-06-07 22:16:48 +10:00
Andrew Tridgell
2ed57a9ae1 implement a scheme where nodes are banned if they continuously caused the cluster
to start a recovery session. The node is banned from the cluster for the RecoveryBanPeriod (default of 5 minutes)

(This used to be ctdb commit 4ad43dd07f526b6002477177fbf55483246c2c0c)
2007-06-07 15:18:55 +10:00
Andrew Tridgell
cafddf76dc - fixed flags display in logs
- added monitor handler to test event script

(This used to be ctdb commit a4c18dddee169df49e5d77d9a94ce9329f169319)
2007-06-06 11:13:24 +10:00
Andrew Tridgell
dbb2ec43dd added tunables settable using ctdb command line tool
(This used to be ctdb commit 73d440f8cb19373cfad7a2f0f0ca4f963c57ff29)
2007-06-04 19:53:19 +10:00
Andrew Tridgell
f1d81386e6 - start moving tunable variables into their own structure
- fixed the test scripts to use a separate dbdir

(This used to be ctdb commit 396752e8908c48373564e915e2d49cfc9ff61eba)
2007-06-04 17:46:37 +10:00
Andrew Tridgell
a57991c0eb remove some cruft thats not needed any more
(This used to be ctdb commit c4308805b997740b77e058c1a14b84cb400a7c30)
2007-06-04 17:23:55 +10:00
Andrew Tridgell
90158f7ad7 removed some old cruft
(This used to be ctdb commit 44040d5ecabcd32ee26c0285e3786dfb9b4f8126)
2007-06-02 19:23:48 +10:00
Andrew Tridgell
c5e4ce360a make test now works again
(This used to be ctdb commit 439d87bbb9840f82937e51aff4fe2b80160878c6)
2007-06-02 13:31:36 +10:00
Andrew Tridgell
68963d865a first step towards fixing "make test" with the new daemon system
(This used to be ctdb commit f95f7e4c93dea482e6cf0614b5415229a7c9f3fb)
2007-06-02 13:16:11 +10:00
Andrew Tridgell
ebf12646cf - make specification of a recovery lock file compulsory
- die if someone other than the recmaster can get the recovery lock

(This used to be ctdb commit a827d0d0e430ca8ad5d521367e45097185492869)
2007-06-02 11:36:42 +10:00
Andrew Tridgell
b5890ad2c1 split out events for each subsystem separately
(This used to be ctdb commit 03c629a72f234dcc783fa1085e7edba09597c241)
2007-06-01 20:54:26 +10:00
Andrew Tridgell
869d70d9c9 convert ctdbd.sh tests to use an event script
(This used to be ctdb commit b3eff804fe59238ed37cd692cc04785089a89dc3)
2007-06-01 19:04:51 +10:00
Andrew Tridgell
bf3b740a1b ctdb is GPL not LGPL
(This used to be ctdb commit 8624378010d1c2a1438e1e701339dfba7276f960)
2007-05-31 13:50:53 +10:00
Andrew Tridgell
2d9e0ad56a use /etc/services for ctdb
(This used to be ctdb commit 64bf6964ff33320c5351337c7f8ed4da5bd71275)
2007-05-29 15:15:00 +10:00
Andrew Tridgell
ccf4d78e04 - renamed ctdb_control utility to ctdb
- use -n to specify node number in ctdb utility

- change 'ctdb status' to 'ctdb statistics'

- added 'ctdb status' which shows status

- added netmask to public IPs, so you don't try a takeover on a
  foreign network

- cleaned up tools/ctdb_control.c a lot

- generate usage message at runtime

(This used to be ctdb commit 28de71c03ace7d32a9fd9882fabbd5d668b97656)
2007-05-29 12:16:59 +10:00
Andrew Tridgell
a5198559c9 moved the recovery daemon into the main ctdbd and enable it by default
(This used to be ctdb commit 2a7d42124731f43d013cb76a798525eab4cc1ee0)
2007-05-15 15:13:36 +10:00
Andrew Tridgell
682df74d59 separate the wire format and internal format for the vnn_map
(This used to be ctdb commit 9a71718d87c5162f1423d85c2e86a01f6771925e)
2007-05-10 08:13:19 +10:00
Ronnie Sahlberg
6929739b7f add a command line flag to ctdbd to start a recovery daemon.
update the recovery test script to start all ctdb daemons with a 
recovery daemon

(This used to be ctdb commit 47794e16df285cacefc30208d892d931a6e46b96)
2007-05-09 09:59:23 +10:00
Ronnie Sahlberg
c6bd23ee11 update to rhe recovery daemon
ctdb_ctrl_ calls are timedout due to nodes arriving or leaving the 
cluster it crashes the recovery daemon afterwards with a SEGV but no 
useful stack backtrace

(This used to be ctdb commit cd3abc7349e86555ccd87cd47a1dcc2adad2f46c)
2007-05-06 06:58:01 +10:00
Ronnie Sahlberg
60d4b0e8b4 in the recover test
start the daemons with explicit socketnames and explicit ip address/port

remove all --socket=  from all ctdb_control calls since they are not 
needed anymore

(This used to be ctdb commit 593a959d428f5b4a913117a9b5c8fe65a3eb950e)
2007-05-06 06:06:39 +10:00
Ronnie Sahlberg
7bbcc964f2 add support in catdb to dump the content of a specific nodes tdb instead
of traversing the full cluster.
this makes it easier to debug recovery

update the test script for recovery to reflect the newish signatures to
ctdb_control



the catdb control does still segfault however when there are missing 
nodes in the cluster   as there are toward the end of the recovery test

(This used to be ctdb commit 8de2a97c14a444f817ceb36461314f10c9601ecc)
2007-05-06 05:53:15 +10:00
Ronnie Sahlberg
25edbc9a50 add a control to get the pid of a daemon.
this makes it possible to kill a specific daemon in the recover test 
script

(This used to be ctdb commit 2fa394b4c80988cb1a6d04b236ec64cc9d9e8a40)
2007-05-06 04:31:22 +10:00
Ronnie Sahlberg
508cafd17e merge from tridge
(This used to be ctdb commit 6c8b90cedc67daa89d54db5268fde18bfc20abaf)
2007-05-04 17:05:28 +10:00
Ronnie Sahlberg
418cb36d32 remove a exit from the test script
(This used to be ctdb commit 4adb61f8270dbd15732bc458d49a66138dd240cc)
2007-05-04 15:25:57 +10:00
Ronnie Sahlberg
7dfdab1b9d recovery daemon
this program is a client to the local ctdb daemon

every second it pulls all vnnmap and nodemaps from all nodes that are 
available and checks if a recovery is required

a recovery is required if :
* all nodes do NOT have an identical vnnmap and generation
* all nodes do NOT have an identical nodemap
* there are active nodes that are NOT in the nodemap
* there are nodes in the nodemap that are NOT active

During recovery,  the recovery tool will also make sure that all nodes 
know about and have created all databases.

(This used to be ctdb commit 2f2650467bac7e8954de7c17cb34f46b0bdbcd26)
2007-05-04 15:21:40 +10:00
Andrew Tridgell
f2fd53056d nicer interface to ctdb traverse
(This used to be ctdb commit e5ce866dcc5037b5069e42bf1e168b646f007b01)
2007-05-04 12:18:39 +10:00
Andrew Tridgell
e752f3bd97 - changed the REQ_REGISTER PDU to be a control
- allow controls to know which client invoked them

- added a client_id to clients, so they can be identified remotely

- added the ability to remove registered srvids

- in the list_keys code, register a temp srvid, then remove it afterwards

(This used to be ctdb commit 29603c51cc6d81362532cd8e50f75c8360c5f5ef)
2007-05-04 11:41:29 +10:00
Andrew Tridgell
648e3835b3 merge from ronnie
(This used to be ctdb commit cf23175526d8fde1ef145605fb545584384b6cec)
2007-05-04 10:43:39 +10:00
Andrew Tridgell
60b42276eb first version of traverse is working
(This used to be ctdb commit ecac90cee389a6fa0e9b1efba521e098a24d323f)
2007-05-03 17:12:23 +10:00