summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/eventscripts
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Check for readable, not executable, scriptMartin Schwenke2015-03-061-1/+1
| | | | | | | | | | | | | Scripts in eventscript unit tests are run under an explicitly specified shell so they do not need to be executable. Checking that the script is executable breaks on scripts that are installed without the execute bit set, such as disabled eventscripts. 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 Mar 6 04:40:07 CET 2015 on sn-devel-104
* ctdb-tests: Correctly cascade test failures from the end of pipesAmitay Isaacs2015-03-051-3/+3
| | | | | | | | | | | | | Some eventscript unit test failures get lost because _passed=false is set in the tail of a pipe. Add a new function test_fail() and call it when necessary to ensure the value of _passed is set correctly. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Mar 5 07:16:54 CET 2015 on sn-devel-104
* ctdb-scripts: Add a 'rm' stub so statd-callout tests work correctlyAmitay Isaacs2015-03-051-0/+6
| | | | | | | | | | statd-callout tries to remove global files from /var/lib/nfs/statd and this causes errors in tests. Add an rm stub that ignores attempts to remove these files but invokes /bin/rm for anything else. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-scripts: Change statd-callout to be more scalableMartin Schwenke2015-03-047-2/+28
| | | | | | | | | | | | | | | | Updating ctdb.tdb on each add-client, del-client and each delete during notify was too ambitious. Persistent transactions do not perform well enough to do this. Revert to having add-client and del-client create touch files. Each monitor event calls "statd-callout update" to convert touch files into ctdb.tdb records. Update testcases to do the "update" and add an extra test. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Unit tests for statd-calloutMartin Schwenke2015-03-0410-12/+194
| | | | | | | | | With improvements to unit test infrastructure to support. This includes linking the real statd-callout into etc-ctdb/ in place of the placeholder script. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make setup of public addresses more obviousMartin Schwenke2015-03-041-11/+28
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend eventscript unit test infrastructure for other scriptsMartin Schwenke2015-03-041-6/+19
| | | | | | | | There's so much infrastructure here that it would be a shame not to use it for testing things like statd-callout. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Support testing scripts that change directoryMartin Schwenke2015-03-041-0/+4
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend ctdb stub to support "ip" with and without -XMartin Schwenke2015-03-041-8/+20
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend ctdb stub to support "ptrans", "pdelete", "catdb"Martin Schwenke2015-03-041-14/+87
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Improve messages about invalid tunables during "setup"Martin Schwenke2015-02-181-1/+2
| | | | | | | | 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 Feb 18 08:03:33 CET 2015 on sn-devel-104
* ctdb-tool: Print a warning when setting an obsolete tunable variableMartin Schwenke2015-02-182-0/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: New tests for 00.ctdb "setup" event - set tunables from configMartin Schwenke2015-02-187-0/+109
| | | | | | | Unit test infrastructure tweaks to support. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Call iptables/ip6tables directly from iptables_wrapperMartin Schwenke2015-01-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | Drops the iptables() and ip6tables() functions and, hence, the hardcoding of paths /sbin/iptables and /sbin/ip6tables. The latter avoids problems on openSUSE where (for example) /usr/sbin/iptables is used instead. This means that locking around ip*tables commands is only done when iptables_wrapper is called directly. This is fine because the only conflict is when "releaseip" or "takeip"/"updateip" events are run in parallel. The other uses in 11.natgw and 70.iscsi are in events where there will be no collisions. Making 11.natgw support IPv6 is unnecessary. Just put a static IPv6 address on each interface - they're plentiful. 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 Jan 28 08:29:55 CET 2015 on sn-devel-104
* ctdb-scripts: Make 10.interface IPv6-safeMartin Schwenke2014-12-051-4/+1
| | | | | | | | | | | | | | | | | | | Add checking to "releaseip" and "updateip" to ensure that the given IP address is really on the given interface with the given netmask. If reality doesn't match the given arguments then believe reality. Use new function iptables_wrapper() instead of calling iptables() directly. Use new function flush_route_cache() instead of doing IPv4-specific /proc magic. Remove setting of otherwise unused variable "failed". Fix a test for which the error message has changed. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Update eventscripts to use ctdb -X instead of ctdb -YMartin Schwenke2014-12-052-14/+14
| | | | | | | Also update associated eventscript unit tests and ctdb stub. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Try to restart statd after every 10 failuresMartin Schwenke2014-11-182-1/+72
| | | | | | | | | Also add and update tests for statd stack dumps. Update the existing 60.ganesha statd test to do more iterations. Duplicate the result as a new test for 60.nfs. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Dump stack traces for hung mountd, rquotad, statd processesMartin Schwenke2014-11-183-1/+27
| | | | | | | Add a corresponding new unit test for statd. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Factor out new function program_stack_traces()Martin Schwenke2014-11-181-1/+1
| | | | | | | In the process, fix a bug where an extra trace would be printed. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: New option CTDB_LOGGING, remove CTDB_LOGFILE, CTDB_SYSLOGMartin Schwenke2014-10-281-2/+3
| | | | | | | | | | | | Remove --logfile and --syslog daemon options and replace with --logging. Modularise and clean up logging initialisation code. The initialisation API includes an app_name argument that is currently unused - this will be used in extensions to the syslog backend. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-test: Remove unused function check_ctdb_logfile()Martin Schwenke2014-10-281-13/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-eventscripts: Remove NAT gateway "monitor" eventMartin Schwenke2014-07-294-4/+4
| | | | | | | | | | | | | | | | | | This event was introduced to handle misconfiguration. For example, where all nodes where configured as NAT gateway slaves. However, this event can fail when there are performance issues and capabilities can't be retrieved from a remote node. The problem is most likely with the remote node, so marking the local node UNHEALTHY is probably a mistake. Having a NAT gateway master node only matters in "ipreallocated", so leave it to do the checking. Given that a node will run "ipreallocated" as part of the first recovery, this should cause misconfigurations to be detected nice and early. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-eventscripts: Add check for invalid policy routing configurationMartin Schwenke2014-05-052-0/+28
| | | | | | | | | | | | | The range CTDB_PER_IP_ROUTING_TABLE_ID_LOW..CTDB_PER_IP_ROUTING_TABLE_ID_HIGH should not include 253-255. Otherwise policy routing may overwrite the default system routing tables. Add some corresponding tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-eventscripts: CTDB_NATGW_PUBLIC_* optional on slave-only nodesMartin Schwenke2014-04-147-12/+131
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 4ee4925d416a86341bd76c11fa99ec9173682a1d forgot about CTDB_NATGW_SLAVE_ONLY so it introduces an incorrect failure when this is set, and CTDB_NATGW_PUBLIC_IFACE or CTDB_NATGW_PUBLIC_IP is unset. Relax the sanity check to see if CTDB_NATGW_SLAVE_ONLY is set. Update the documentation to explicitly state that CTDB_NATGW_PUBLIC_IFACE and CTDB_NATGW_PUBLIC_IP are optional and unused if CTDB_NATGW_SLAVE_ONLY is set. It would be possible to insist that CTDB_NATGW_PUBLIC_IFACE and CTDB_NATGW_PUBLIC_IFACE should be unset in that case. However, it is more reasonable to allow consistent configuration across nodes except with some nodes configured slave-only. Add tests, update infrastructure and fix a thinko in the stub's "natgwlist" implementation. 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 Apr 14 06:06:49 CEST 2014 on sn-devel-104
* ctdb-tests: Add NAT gateway eventscript unit tests for static routesMartin Schwenke2014-03-266-0/+207
| | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Mar 26 06:24:01 CET 2014 on sn-devel-104
* ctdb-tests: Add a test for NAT gateway sanity checkingMartin Schwenke2014-03-261-0/+24
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Add some tests for 11.natgw eventscriptMartin Schwenke2014-03-269-18/+376
| | | | | | | | | | | | | | This includes adding support for: * Configuring fake NATGW state in the eventscript unit tests * "natgwlist" and "setnatgwstate" in ctdb command stub * ip command stub to default to "main table" when no table specified, allow routes to be added without "dev" option (just add a default dev), support "metric" option Signed-off-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests-eventscripts: Testing support for promote_secondariesMartin Schwenke2014-02-132-2/+12
| | | | | | | | | Just enable this behaviour by default in the ip command stub, since 10.interface assumes/sets it. The rc.local replacement for set_proc() doesn't do anything... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/tests/eventscripts: Avoid errors on broken pipeMartin Schwenke2014-01-311-3/+3
| | | | | | | | | | | ctdb_get_my_public_addresses() attempts to echo things and this causes an error if head has taken the first line and the pipe is closed. 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 Jan 31 05:30:38 CET 2014 on sn-devel-104
* ctdb/tests/eventscripts: Improve ip command stub secondary handlingMartin Schwenke2014-01-311-22/+59
| | | | | | | | It should support primary and secondaries per network instead of per interface. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/eventscripts: Print a count if killing TCP connections times outMartin Schwenke2014-01-171-1/+1
| | | | | | | Also update related test Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/eventscripts: Reconfigure lock should be released quicklyMartin Schwenke2014-01-173-3/+3
| | | | | | | | | | | | | | | Currently the lock is held until the corresponding eventscript completes, since the process still exists. If the regular part of an eventscript hangs then the lock might unnecessarily be held for a long time. The pathological case is when a monitor event gets stuck in D-wait state and the script times out but can't be killed so the lock is still held. This can cause an unwanted monitor replay. Change this so that the lock is released immediately after the reconfiguration is complete. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/eventscripts: Do not reconfigure in "monitor" eventsMartin Schwenke2013-12-174-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "monitor" events can be cancelled. If a reconfigure action does a service restart then the "monitor" event can be cancelled at the inconvenient moment after the service is stopped. In this case the service stays down and the node may become unhealthy (depending on whether there are any repair actions in the monitor event). A long time ago we did service reconfiguration in "monitor" events following failovers. Service reconfiguration was then moved to the "ipreallocated" event. However, reconfiguration in "monitor" events has been kept as a last resort in case an "ipreallocate" event does not occur. The only important case that this covers is "ctdb deleteip", where "releaseip" events are generated without a corresponding "ipreallocated". Therefore, IPs can be deleted without running the required service reconfiguration. The supported way of removing IP addresses is now via "ctdb reloadips", which always causes a takeover run with a corresponding "ipreallocate" event. This means that service reconfiguration in "monitor" events is no longer required and should be removed because it is unsafe. Also update the associated tests. Make the first confirm that the monitor event no longer does reconfiguration. Change the others to test that monitor status is correctly replayed when something else is doing a reconfigure and currently holds the reconfigure lock. 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 17 06:32:35 CET 2013 on sn-devel-104
* ctdb:tests: in the stub "ip link show" command use echo instead of catMichael Adam2013-11-281-4/+2
| | | | | | | | | | | | This case of "ip link show" does not break autobuild with "Broken pipe" messages, but let's be consistent. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Nov 28 09:23:03 CET 2013 on sn-devel-104
* ctdb:tests: in the stub ip command, avoid broken pipe by using echo instead ↵Michael Adam2013-11-281-9/+3
| | | | | | | | | | | | of cat This fixes running "make autotest" from autobuild, since it prevents irritating error output in delete_ip_from_iface() when calling ip addr list ... | grep -Fq "inet ..." . Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: add path of ip command to extra output in the error caseMichael Adam2013-11-281-0/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:tests: Rework unit test result filteringMartin Schwenke2013-11-271-5/+1
| | | | | | | Using a variable is too fragile, so use a function instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb:tests: remove unused setup_nmap_output_filter()Martin Schwenke2013-11-271-5/+0
| | | | | | | The tests that used it have gone. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* eventscripts: Rewrite the smb.conf cache file handlingMartin Schwenke2013-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The background update is never guaranteed to complete before the cache is used, so don't bother trying it at the beginning. Instead, put a timeout on a foreground update. If the foreground update fails: * If there's no available cache file then die. * If there is a previous cache file then use it and log a warning. * Do a background update at the end of the monitor event. Also remove commas in the "smb ports" list before use, since (newer?) testparm seem to insert commas into the default value. Update the associated test to add a comma. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 8c6f511254ecb0381a609b37e3a0ee6e5ec5d562)
* eventscripts: Remove TCP port checks other than the built-in CTDB oneMartin Schwenke2013-10-224-96/+0
| | | | | | | | | | | "ctdb checktcpport" is no longer experimental so the other checkers are no longer required. Remove tests related to the removed checkers. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 50e330d0679614bee2e7bab028436e929f74ca50)
* tests/eventscripts: Run scripts under sh by defaultMartin Schwenke2013-10-221-6/+10
| | | | | | | | | | Some scripts are disabled by default so are no executable. Explicitly running them under sh allows them to be run without having to mess around and make them executable or similar. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 9437d4809bfbbb5c6a32a610665333d2f641881d)
* tests/eventscripts: New tests for 20.multipathdMartin Schwenke2013-10-226-0/+110
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 212d4b201c30804f69cffe4b7150d4b74bf2e54f)
* eventscripts: Deprecate NFS_SERVER_MODE, use CTDB_NFS_SERVER_MODE insteadMartin Schwenke2013-10-221-1/+1
| | | | | | | | All CTDB configuration variables should start with CTDB_. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit f12658aff125996ae45eea23241d8c3d0567b893)
* tests/eventscripts: Tests for memory checking in 00.ctdbMartin Schwenke2013-09-1110-2/+166
| | | | | | | | ... plus updates to test infrastructure to support. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 4a388fc6bf54636b7e1f6da8e6aa451cddd574f7)
* eventscripts: Become unhealthy faster on nfsd failureMartin Schwenke2013-08-143-12/+3
| | | | | | | | | | | | | | | | | Anecdotal evidence suggests that most nfsd RPC check failures are due to cluster filesystem or storage problem. Apparently these are rarely helped by attempting to restart the NFS service because the restart tends to hang. Fail after 2 nfsd RPC check failures, instead of waiting for 6 failures. Restart on every 10th failure to try to bring the node back to good health. Update unit tests to match. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit e9ef93f7b6dad59eabaa32124df81f3e74c651ef)
* eventscripts: Print a message when waiting for TCP connections to be killedMartin Schwenke2013-08-141-0/+3
| | | | | | | | This makes the gaps in the logs more obvious. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 11fbf4789d783dd0bac22754b374dd9ea4b03bad)
* eventscripts: Add modulo (%) operator to ctdb_check_counter()Martin Schwenke2013-08-141-1/+11
| | | | | | | | Also add it to the corresponding eventscript unit test infrastructure. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit f4ef83a256f59eeb00b9a5bc10c28347e1ad1031)
* eventscripts: Separate out RPC service restart codeMartin Schwenke2013-08-142-10/+4
| | | | | | | | | | | | | | | | | | While doing this: * Explicitly assign RPC program and version information in _nfs_check_rpc_common(). This is more lines of code but is easier to read. * Don't print the options when starting a service. Trying to print it makes the code messy for little benefit. Update the eventscript unit testing code and a Ganesha test to reflect this. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit e8b531405665885196c95fe1608db33a255bf761)
* tests/eventscripts: Override background_with_logging(), just prepend "&"Martin Schwenke2013-08-146-31/+34
| | | | | | | | | | | | That is, output that goes through background_with_logging() just gets "&" prepended to each line. This is cleaner than having the tests grovel through logs. Update some 49.winbind/50.samba tests to deal with this. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 3ba933d806106d12bc48b83b22d0f314d9d1e5e5)
* eventscripts: Remove support for RPC service 'q' and 's' restart flagsMartin Schwenke2013-08-141-6/+2
| | | | | | | | They're hard to maintain and provide very little benefit. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 1a1be43f8466d46913dcdfe6dcedb94316cd28ad)