summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/eventscripts/scripts/local.sh
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-eventscripts: CTDB_NATGW_PUBLIC_* optional on slave-only nodesMartin Schwenke2014-04-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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-261-0/+43
| | | | | | | 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 some tests for 11.natgw eventscriptMartin Schwenke2014-03-261-0/+58
| | | | | | | | | | | | | | 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: 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: 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>
* 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-221-0/+23
| | | | | | 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-111-0/+45
| | | | | | | | ... plus updates to test infrastructure to support. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 4a388fc6bf54636b7e1f6da8e6aa451cddd574f7)
* 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-141-8/+2
| | | | | | | | | | | | | | | | | | 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-141-11/+12
| | | | | | | | | | | | 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)
* eventscripts: kill_tcp_connections() should send connections to stdinMartin Schwenke2013-07-291-0/+3
| | | | | | | | | | | | | | | This avoids issuing multiple "ctdb killtcp" commands to terminate tcp connections, one per connection. This will considerably reduce the time when there is a large number of tcp connections. This also makes it possible to avoid calling "ctdb killtcp" when there are no connections. Add a couple of unit tests for killtcp and update eventscript unit test infrastructure to support. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit a20d94717d2e4ab866d8a002cdf39c0669b74c6a)
* tests/eventscripts: Add tests for monitoring of missing interfacesMartin Schwenke2013-07-191-0/+2
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 53e4eca74429f76adc81d98e3d11d1bd61194d71)
* tests/eventscripts: Add some rudimentary tests for 60.ganeshaMartin Schwenke2013-07-051-0/+14
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit e1cf1f728236d808bb41265e74bc65f54bf1c133)
* tests/eventscripts: New tests for 00.ctdb "init" eventMartin Schwenke2013-06-201-0/+8
| | | | | | | | | | | | | | | These test dropping of IPs and TDB checking. New stubs for date, tdbdump, tdbtool. Enhance ip stub to handle "ip addr show to ..." Tweak some infrastructure. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit aabf0bf41cb8ec344f06b69492fb6c2a27f9e900)
* tests/eventscripts: setup_ctdb() should always set $CTDB_PUBLIC_ADDRESSESMartin Schwenke2013-06-201-1/+2
| | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit c3e7a6e10d486ba0dbafdf110db540675b2317bc)
* tests/eventscripts: Unit tests for $CTDB_NFS_DUMP_STUCK_THREADSMartin Schwenke2013-06-141-1/+14
| | | | | | | | Includes minor test infrastructure updates. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit cd4358b01c6c3d413b431f5760029d2b163b9c03)
* tests/eventscripts: Fix -X tracing in iterate_test()Martin Schwenke2013-06-141-6/+5
| | | | | | | | ... and delete a bogus comment. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 0e2b5a8f89440a53f996482ac0c98b31a4f2cad3)
* tests/eventscripts: Add unit tests for $CTDB_MONITOR_NFS_THREAD_COUNTMartin Schwenke2013-06-141-0/+2
| | | | | | | | Includes minor test infrastructure updates. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit ce2ef2be8aa22c0baf868daac8d4cf27246baa14)
* eventscripts: 60.nfs uses nfs_check_rpc_services() to check NFS RPC servicesMartin Schwenke2013-05-071-42/+12
| | | | | | | | | | | | | | | | | | | * New directory nfs-rpc-checks.d/ replaces hardcoded rules in 60.nfs * Installation and packaging additions to handle nfs-rpc-checks.d/ * Unit test updates, including deleting 1 test that sanity checked test infrastructure * Test infrastructure changes to use nfs-rpc-checks.d/ Note that this removes support for $CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK in 60.nfs. To get the equivalent behaviour, edit 20.nfsd.check and remove/comment all lines. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 7e792d6768d9ca420ce3713cb122e63afd594b15)
* eventscripts: Simplify handling of $service name in "managed" functionsMartin Schwenke2013-05-061-11/+21
| | | | | | | | | | | | | | | | | | | | Complicated argument handling was introduced to deal with multiple services per eventscript. This was a failure and we split 50.samba. This simplifies several functions to use global $service_name unconditionally instead of having an optional argument. $service_name is no automatically longer set in the functions file. This means it needs to be explicitly set in 13.per_ip_routing because this script uses ctdb_service_check_reconfigure(). Eventscript unit test infrastructure needs to set $service_name during fake service setup, and policy routing tests need to be updated accordingly. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 27aab8783898a50da8c4bc887b512d8f0c0d842c)
* tests/eventscripts: add extra infrastructure for policy routing testsMartin Schwenke2012-10-111-0/+72
| | | | | | | | Less copying and pasting is a good thing... Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 7d4b8cce96f33fff647a0c9d259c121dfc8403e9)
* eventscripts: Auto-start/stop services in backgroundMartin Schwenke2012-10-031-2/+18
| | | | | | | | | | | If $CTDB_SERVICE_AUTOSTARTSTOP="yes" then service start/stop is done in the background with logging. Fix some unit tests for samba and winbind. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 3a3dae4cb5ec8b4b8381a4013adda25b87641f3a)
* Eventscripts: split 50.samba into 49.winbind and 50.sambaMartin Schwenke2012-10-031-11/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | winbind and samba can be separately managed. This makes the service starting and stopping code way too complicated, and even adds a small amount of complexity to the monitoring code. The sensible option is to split this eventscript in two. There are two potentially backward incompatible changes here: * Functionality has been removed that allowed 50.samba to manage winbind when CTDB_MANAGES_WINBIND was unset but the smb.conf "security" parameter was set to "ADS" or "DOMAIN". Maintaining this functionality would have required moving the testparm-related code to the functions file, deciding where the cache file should go, and then calling it from both 49.winbind and 50.samba. This feature wasn't of great value and asking administrators to set an extra variable in exchange for code simplicity seems like a reasonable deal. * External code will need to be changed if it calls 50.samba directly with winbind-related expectations. This is fairly obvious! Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 34535ae64420926b9a3bf7d453fed4e6f4c90115)
* tests/eventscripts: Tweak expected output for lockd:b restartMartin Schwenke2012-05-251-1/+1
| | | | | | | Commit 13acd58c41fba1a33894fbd654fed69ea0eac322 mades this test fail, since lockd:b and lockd:bs were incorrectly producing the same output. (This used to be ctdb commit fd3b73d7e634f16cbb99d7d5a548e12f00d1aadb)
* tests/eventscripts: $CTDB_BASE needs to be in $TEST_VAR_DIRMartin Schwenke2012-05-111-1/+2
| | | | | | | | | | | | | The policy routing tests write the configuration file into $CTDB_BASE, as per rcommended practice. Unless this is in $TEST_VAR_DIR this won't work sensible when the tests are installed. Things are done slightly different than for /etc. Here we use symlinks and we want them to be dereferenced. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 61c80f58a8cfbaca7e669ef8cd95b4f6b5dc66c7)
* tests/eventscripts: $CTDB_ETCDIR should be in $TEST_VAR_DIRMartin Schwenke2012-04-271-12/+12
| | | | | | | | | | | | | The policy routing tests modify /etc/iproute2/rt_tables, so this directory should not be in the installation area. Instead the contents of tests/eventscripts/etc are copied into a place under $TEST_VAR_DIR where the directory can be modified with gay abandon. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a0afb4195caab39891a304b8b4eadd94cab7c4a7)
* tests/eventscripts: Be more defensive about removing the var directoryMartin Schwenke2012-04-271-1/+2
| | | | | | | | | Could add -r but that might avoid error. The only time it doesn't exist is the 1st time a top-level var directory is used. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 047d97dc84a5943556efb31bb2856fd04835fffa)
* tests/eventscripts: Add sanity check to esnure events.d/ can be foundMartin Schwenke2012-04-271-0/+25
| | | | | | | | | If it can't, the installation is probably inconsistent, so a (hopefully) helpful message is printed. :-) Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit df732ca8e27f0f3417b4d5d259157bd0e0632124)
* tests: Unit tests should use $TEST_VAR_DIRMartin Schwenke2012-04-271-7/+2
| | | | | | | | | This directory is already guaranteed to be absolute, so no check is needed. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 78f6f209eb15102f4e8baa9106583df0ef4bb693)
* tests: Make run_tests -X more flexible - it now works with onnodeMartin Schwenke2012-04-271-1/+5
| | | | | | | | | Hardcoding "sh -x" is suboptimal because some scripts, like onnode, require bash. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 246809af64c03d26288abff5907ed46614e72b15)
* tests: More unit test factoring/rationalisation and bug fixesMartin Schwenke2012-04-181-127/+9
| | | | | | | | | | | | | | | | | Move some options from eventscripts/run_tests.sh to scripts/run_tests. Remove the former. Move some functions from eventscripts/scripts/local.sh to scripts/unit.sh. Both of these are modified during move so they are no longer eventscript-specific. Tweak */local.sh so that the new functions in unit.sh are used. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 7ff485687891732074c9fc9998502ca197663d02)
* tests/eventscripts: Share directories must be absolute in eventscript testsMartin Schwenke2012-04-181-0/+5
| | | | | | | | | | This fixes eventscripts/scripts/local.sh:setup_generic() so that directories listed in $FAKE_SHARES are absolute instead of potentially relative (and, therefore, ignored by the NFS share check). Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 8544162b7a4efa23c92bc0d2774df95bb7f0f463)
* tests/eventscripts - Restructure according to new conventionMartin Schwenke2012-04-161-0/+914
Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit eb13507713ba6732271b7c3024bfddbda6da5ffc)