1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
Commit Graph

256 Commits

Author SHA1 Message Date
Martin Schwenke
a8dd716146 eventscripts: kill_tcp_connections() should send connections to stdin
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)
2013-07-29 15:53:06 +10:00
Martin Schwenke
363315aca5 tests/eventscripts: Add tests for monitoring of missing interfaces
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 53e4eca74429f76adc81d98e3d11d1bd61194d71)
2013-07-19 15:37:14 +10:00
Martin Schwenke
f92e49f6f8 tests/eventscripts: Add some rudimentary tests for 60.ganesha
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e1cf1f728236d808bb41265e74bc65f54bf1c133)
2013-07-05 15:52:34 +10:00
Martin Schwenke
3b2f7330cc tests/eventscripts: New tests for 00.ctdb "init" event
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)
2013-06-20 13:01:10 +10:00
Martin Schwenke
2ceed3b0c8 tests/eventscripts: setup_ctdb() should always set $CTDB_PUBLIC_ADDRESSES
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit c3e7a6e10d486ba0dbafdf110db540675b2317bc)
2013-06-20 13:01:10 +10:00
Martin Schwenke
27ba5b44b6 tests/eventscripts: Unit tests for $CTDB_NFS_DUMP_STUCK_THREADS
Includes minor test infrastructure updates.

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

(This used to be ctdb commit cd4358b01c6c3d413b431f5760029d2b163b9c03)
2013-06-14 15:15:07 +10:00
Martin Schwenke
d82c0ef923 tests/eventscripts: Fix -X tracing in iterate_test()
... and delete a bogus comment.

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

(This used to be ctdb commit 0e2b5a8f89440a53f996482ac0c98b31a4f2cad3)
2013-06-14 15:15:07 +10:00
Martin Schwenke
02dd1bf00f tests/eventscripts: Add unit tests for $CTDB_MONITOR_NFS_THREAD_COUNT
Includes minor test infrastructure updates.

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

(This used to be ctdb commit ce2ef2be8aa22c0baf868daac8d4cf27246baa14)
2013-06-14 15:15:07 +10:00
Martin Schwenke
434f9e8594 eventscripts: 60.nfs uses nfs_check_rpc_services() to check NFS RPC services
* 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)
2013-05-07 12:55:09 +10:00
Martin Schwenke
6e2863a4f9 eventscripts: Clean up ctdb_check_command()
* Command is now multiple arguments, preserving quoting
* $service_name no longer printed, no longer an argument
* Debug output from failed command

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

(This used to be ctdb commit 9e25fb261447a196de05937052779b36e75e7215)
2013-05-06 15:45:10 +10:00
Martin Schwenke
e9abc9c070 eventscripts: Simplify handling of $service name in "managed" functions
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)
2013-05-06 15:45:10 +10:00
Martin Schwenke
100a0eed90 scripts: Use $CTDB_SCRIPT_DEBUGLEVEL instead of something more complex
The current logic is horrible and creates an unnecessary file.  Let's
make the script debug level independent of ctddb's debug level.

* Have debug() use $CTDB_SCRIPT_DEBUGLEVEL directly

* Remove ctdb_set_current_debuglevel()

* Remove the "getdebug" command from ctdb stub in eventscript unit
  tests

* Update relevant eventscript unit tests to use
  $CTDB_SCRIPT_DEBUGLEVEL

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

(This used to be ctdb commit 85efa446c7f5c5af1c3a960001aa777775ae562f)
2013-04-19 13:13:36 +10:00
Martin Schwenke
e2306dd82b tests/eventscripts: Ratchet down debug level for ctdb_takeover_tests
The default IP allocation algorithm used by ctdb_takeover_tests
changed from "non-deterministic IPs" to "LCP2".  The latter generates
a lot more debug output.  ctdb_takeover_tests is used by the ctdb tool
stub to calculate IP address changes for failovers.  This resulted in
unexpected debug output that caused tests to fail.  Since eventscript
tests don't care how IP allocations are arrived at, the best solution
is to turn down the debug level.

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

(This used to be ctdb commit 3cc596d2b459d834f9785b3a98027e46431ff2b9)
2013-01-08 10:53:28 +11:00
Martin Schwenke
3d408ca1e1 Eventscripts: Do not restart NFS on reconfigure
It looks like this restart was accidentally reintroduced in commit
fc0678d351187cfa4c71123f97c0f493aacd5d16 when $service_reconfigure
became unset so the default action of restarting the service would
occur.  From there cleanups have explicitly reintroduced it and
carried it through the code.

Also update the unit tests affected by this change.

The restart was originally removed in commit
bc481c3f1a44c50648488c4f8a7f15ec395d446f.

The default reconfigure action of restarting a service is clearly
suboptimal and will be addressed in a separate patch.

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

(This used to be ctdb commit 2629de72e1f37b5e46772c2ef8d8d0012fc4ed37)
2013-01-07 10:35:39 +11:00
Martin Schwenke
66d0aba85b Revert "Eventscripts - add facility to 10.interface to delete unmanaged IPs"
This reverts commit 88f88d86b0d08240f749fb721b8c401c2eeb1099.

This is dangerous and, on reflection, I can't see it being useful.
There are often permanent IPs on interfaces that CTDB shares with its
public IPs.

(This used to be ctdb commit 16aba4eb620844626a1c71c58b51658caf44dea6)
2012-10-18 20:05:42 +11:00
Martin Schwenke
8e7facc5d3 tests/eventscripts: add unit tests for policy routing reconfigure
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bd4ff176387372b1c233373c0bc8ced523fc9670)
2012-10-11 12:10:45 +11:00
Martin Schwenke
cfef702363 tests/eventscripts: add extra infrastructure for policy routing tests
Less copying and pasting is a good thing...

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

(This used to be ctdb commit 7d4b8cce96f33fff647a0c9d259c121dfc8403e9)
2012-10-11 12:10:45 +11:00
Martin Schwenke
2d719e5c84 eventscripts: Auto-start/stop services in background
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)
2012-10-03 08:48:23 +10:00
Martin Schwenke
f3ae31e741 Eventscripts: split 50.samba into 49.winbind and 50.samba
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)
2012-10-03 08:46:32 +10:00
Martin Schwenke
7d971f4fe7 tests/eventscripts: New policy routing test with invalid table ID
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 93c97c3ba3ff714dfa0d056a91ff45010a6e2d66)
2012-09-11 12:52:22 +10:00
Martin Schwenke
3d6865150b tests/eventscripts: Modify ip stub to simulate invalid table ID
This involves refactoring ip_route_check_table() into a new function
ip_check_table() which tables the operation type (i.e. rule/route) as
an argument.

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

(This used to be ctdb commit acdaa04079a9827885f32a7bc078d3365c89b474)
2012-09-11 12:52:22 +10:00
Martin Schwenke
f6f711ee4d tests/eventscript: unit test for 13.per_ip_routing bogus route removal
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 6d41208074f0e9b56c585bca7eb39aaed653c4ca)
2012-09-11 12:52:22 +10:00
Martin Schwenke
aed0f9d1b9 tests/eventscripts: Add a policy routing unit test for "ip rule del" failure
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0ce5b079f327aba55b62800ccb22d79976fac665)
2012-09-11 12:52:22 +10:00
Martin Schwenke
184db1b6be tests/eventscripts: Extra cases for policy routing missing config test
Test the startup and monitor events too.

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

(This used to be ctdb commit c29a943f9bbcfecb861e71d007c7698a53dc8773)
2012-07-30 15:57:56 +10:00
Martin Schwenke
d26c21df4a tests/eventscripts: Rewrite the testparm stub
It currently needs the real testparm command installed even though it
only uses limited features.  It is easy enough to fake up the
functionality that 50.samba uses.

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

(This used to be ctdb commit 7ef9916bd95ff2472359a412eac5489f1aad2dce)
2012-07-26 22:03:00 +10:00
Martin Schwenke
0e1f20fe03 tests/eventscripts: Tweak expected output for lockd:b restart
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)
2012-05-25 15:26:26 +10:00
Martin Schwenke
b713c11621 tests/eventscripts: Fix a policy routing test
The previous commit 55006ea8999ab3721fcde81b92692661065f0688
highlighted an error in this test.

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

(This used to be ctdb commit 9f20fbf91706db94f65f62dbd6a4e087890c1da9)
2012-05-11 10:33:27 +10:00
Martin Schwenke
4cf10db7d4 tests/eventscripts: $CTDB_BASE needs to be in $TEST_VAR_DIR
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)
2012-05-11 10:33:27 +10:00
Martin Schwenke
a4f4df233f tests/eventscripts: $CTDB_ETCDIR should be in $TEST_VAR_DIR
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)
2012-04-27 15:42:43 +10:00
Martin Schwenke
4528c55d3e tests/eventscripts: Use a canned ctdb.sysconfig rather than a link
The link is hard to manage and has no real advantage.

The canned config is 2 of the 3 currently non-comment/whitespace lines
in config/ctdb.sysconfig.

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

(This used to be ctdb commit 66d0b913301c3b1037278bcaa0452ecbe07248df)
2012-04-27 15:42:43 +10:00
Martin Schwenke
a4083f2e97 tests/eventscripts: Explicitly set CTDB_SERVICE_AUTOSTARTSTOP="yes"
No use depending on defaults in the initscript - the tests should
control what is tested.

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

(This used to be ctdb commit 1c37abac5fd18c139aa55989d0fb6b475f4c22f1)
2012-04-27 15:42:42 +10:00
Martin Schwenke
6a21c819e7 tests/eventscripts: Be more defensive about removing the var directory
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)
2012-04-27 15:42:42 +10:00
Martin Schwenke
a14671f829 tests/eventscripts: Add sanity check to esnure events.d/ can be found
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)
2012-04-27 15:42:42 +10:00
Martin Schwenke
e0f4f2c501 tests/eventscripts: $FAKE_IP_STATE is always set in ip command stub
No need for a default, especially since there is no sane default!

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

(This used to be ctdb commit b430a5f61cfdc28e967890602ce6dac0e922c07d)
2012-04-27 15:42:42 +10:00
Martin Schwenke
cb09959063 tests: Unit tests should use $TEST_VAR_DIR
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)
2012-04-27 15:42:42 +10:00
Martin Schwenke
6757ad62f4 tests: Make run_tests -X more flexible - it now works with onnode
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)
2012-04-27 15:40:43 +10:00
Martin Schwenke
6764b7b33e tests: Update README files and add new README files where missing
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bef03b32f8ec114a64c55b25951aeeb939d87b33)
2012-04-27 15:40:43 +10:00
Martin Schwenke
43f1209dc4 tests: Programs run by tests should be found in $PATH
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b5308142d03332d6d4e0c3b77283c772462fbb23)
2012-04-27 15:40:43 +10:00
Martin Schwenke
116f19b808 tests: More unit test factoring/rationalisation and bug fixes
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)
2012-04-18 10:37:45 +10:00
Martin Schwenke
6e05811c28 tests/eventscripts: Share directories must be absolute in eventscript tests
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)
2012-04-18 10:35:25 +10:00
Martin Schwenke
aaa6565977 tests/eventscripts: Tweak an error message in a policy routing test
It currently has my home directory pasted into it.  That can't be
right...  ;-)

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

(This used to be ctdb commit 5d6e71cf6e1e0665ec96e7e4e2cfd31f40ebabae)
2012-04-17 12:57:46 +10:00
Martin Schwenke
df39a671db tests/eventscripts - Restructure according to new convention
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit eb13507713ba6732271b7c3024bfddbda6da5ffc)
2012-04-16 16:24:12 +10:00
Martin Schwenke
8d328920db Tests - eventscripts - initial policy routing tests
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 7d7488a49bc7e799f39f3da3fa81be7a2e14480a)
2012-03-22 15:30:27 +11:00
Martin Schwenke
c0931a0cde Tests - eventscripts - new function simple_test_command()
Allows running arbitrary command and comparing output against
expected.

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

(This used to be ctdb commit da2e9650a97f99e7d694659926d9958927edd8ad)
2012-03-22 15:30:27 +11:00
Martin Schwenke
2f312355c7 Tests - eventscripts - change summary columns
To accommodate 13.per_ip-routing in output.

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

(This used to be ctdb commit 0142729c96b8bfecfabe35439071557bcc6ed4da)
2012-03-22 15:30:27 +11:00
Martin Schwenke
746d116649 Tests - eventscripts - rationalise CTDB fakery support
Remove functions for marking nodes as down/up.  This is now done via
ctdb disable/enable in the stub.

Also more consistent temporary directory use.

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

(This used to be ctdb commit 1db9a533aacc6e02ddbadf76241429144a949e1c)
2012-03-22 15:30:27 +11:00
Martin Schwenke
42400a155b Tests - eventscripts - improved support functions for handling public IPs
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 299ce89fb3deeefcc7c01b20197dc6adee1e8194)
2012-03-22 15:30:27 +11:00
Martin Schwenke
f8a1273fc1 Tests - eventscripts - add support functions for policy routing testing
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 79eec235ac9b051333751186c32924d92e6ebeff)
2012-03-22 15:30:27 +11:00
Martin Schwenke
5ecc348072 Tests - eventscripts - fix hardcoding error
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9c30bf7fd3d94884e27a258571a28dca5e460177)
2012-03-22 15:30:27 +11:00
Martin Schwenke
5afbb43038 Tests - eventscripts - stub ctdb command updates
* Proper IP (re)allocation using ctdbd's IP allocation algorithm.
* Therefore, "ctdb ip" works sensibly.
* Add enable, disable, moveip.

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

(This used to be ctdb commit 6d4b4b1293ba960d8fdf81958d6e8dd23c9d771a)
2012-03-22 15:30:27 +11:00
Martin Schwenke
cb0b0e0ae0 Tests - eventscripts - more public IPs in default setup
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 38396185effbcf313678c2e94d4bd20f534c4f03)
2012-03-22 15:30:27 +11:00
Martin Schwenke
52e7a03853 Tests - eventscripts - add -A/-D options
Make it easier to spot differences between desired output and actual
output.

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

(This used to be ctdb commit d132a8f4a8c0573ac447713a71911f02b6f0d73c)
2012-03-22 15:30:27 +11:00
Martin Schwenke
c394b7d065 Tests - eventscripts - ip stub command should print errors to stderr
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 236d572556e447e2d82d14d2c8a40ed8cb98944d)
2012-03-22 15:30:27 +11:00
Martin Schwenke
6e260553f5 Eventscript tests - implement ip route in stub
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ac2cd2a8cbed97348ceae54167ad83cb074ff6b3)
2012-03-22 15:30:27 +11:00
Martin Schwenke
d0f25b3c37 Eventscript tests - implement ip rule in stub
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 26292f362890ca6cb65d0028d50fa97458e0449f)
2012-03-22 15:30:27 +11:00
Martin Schwenke
60b5ff0e4b Eventscript tests - make ip command stub vaguely maintainable
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8b8e17bea87a8c16f7c0f54fcfe29190f203f673)
2012-03-22 15:30:27 +11:00
Martin Schwenke
3b024ab2bd Eventscript tests - make error message consistent with recent change
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f4949b3c1b36949544e98c9fbb64447f94f9e432)
2012-03-22 15:30:27 +11:00
Martin Schwenke
c497e4bc19 Tests: eventscripts - fix breakage in some NFS tests
1341329f6125d491b82c873f793af819e677f714 either contains typos or
attempts to influence the test depending on the host system.  Whatever
the cause, a test system (e.g. my laptop) might not have
/etc/sysconfig/nfs, so that can't be used to cause the stub
etc/sysconfig/nfs to be loaded.

We make the tests work by default again, leaving in some flexibility
over configuration file location.

If the goal is to force a Debian-style test mode then:

* The tests are currently probably quite RHEL-centric anyway, so more
  work is probably needed.

* Use an environment variable to indicate the distro test mode and
  make functions like setup_nfs() remove all of the various
  configuration files and create one in the distro-specific location.

I won't do this now... ENOTIME...

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

(This used to be ctdb commit 4aa4a5790ea9ad20e4d25404760c449b358b5260)
2012-02-06 16:02:09 +11:00
Martin Schwenke
4e01fedea5 Tests: eventscripts - make init test pass with recent change to 10.interface
e646142f4d28b5401235cd5edee325f7a29f8193 changes the output on the
init event.  This accommodates that change.

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

(This used to be ctdb commit 48cb55aae47d11487bdf004a79df56779d1825a0)
2012-02-06 16:02:09 +11:00
Martin Schwenke
36462d46f4 Tests: eventscripts - add tests for CTDB_DELETE_UNEXPECTED_IPS="yes"
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 00373958a5d5fb8c9b99548d5b9f327e78669162)
2011-12-19 11:29:46 +11:00
Mathieu Parent
4617a0e9cf config can be in /etc/default/ instead of /etc/sysconfig/
... on Debian system and derivated.

(ctdb_diagnostics still hardcodes /etc/sysconfig/)

(This used to be ctdb commit 1341329f6125d491b82c873f793af819e677f714)
2011-11-08 16:31:15 +11:00
Martin Schwenke
882fb55bec Tests - eventscripts - add some multievent tests
Running "./run_tests -s simple/* multievent/*" results in a stupid
summary.  Will need to work on that...

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

(This used to be ctdb commit 999c68948da1492ac4d728c6bf79ad4921d9e840)
2011-08-31 17:29:14 +10:00
Martin Schwenke
0048849bd2 Tests - eventscripts - allow "ctdb scriptstatus" output to be primed
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f527ffb55b514b5cb4df3471a0e17ab71307e8a1)
2011-08-31 17:27:05 +10:00
Martin Schwenke
91d5edee80 Tests - eventscripts - ctdb stub - implement scriptstatus, tweaks
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit edc34d01a1ad83b1335c976593a006166b196569)
2011-08-30 16:51:55 +10:00
Martin Schwenke
84c67c378e Tests - eventscripts - formatting tweak in simple_test()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 698af79545986cf788686feb06c4677a10eec770)
2011-08-30 16:51:55 +10:00
Martin Schwenke
c8e87d9f00 Tests - eventscripts - new function simple_test_event()
Just like simple_test() but 1st arg is the event name.

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

(This used to be ctdb commit 69e240e15488e228c0232fdc8804af778cb4e6fc)
2011-08-30 16:51:55 +10:00
Martin Schwenke
af1a0245b6 Tests - eventscripts - output format tweaks
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8f8dc5636436db28ce7d0edd706a4adf2624e71b)
2011-08-30 16:51:55 +10:00
Martin Schwenke
3167f50b6c Tests - eventscripts - add extra filename format for multi-event tests
$event may not be set so we need to test for it.

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

(This used to be ctdb commit 80f14e590242b14829c6309ee908af0f2d33be1e)
2011-08-30 16:51:55 +10:00
Martin Schwenke
1a8d5e0ec7 Tests - eventscripts - add die() function and use it
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0446eaa7798fd0ddf8d8f067c56d19892a13a317)
2011-08-30 16:51:55 +10:00
Martin Schwenke
e4ba51effd Tests - eventscripts - remove undefined argument in some simple_test calls
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c490024aba39cf94cbc9f8f41ecb3d336b1c82a8)
2011-08-30 16:51:55 +10:00
Martin Schwenke
dcd37aadef Tests - evenscripts - add symlink to ctdb.sysconfig
Some of the tests expect the default to be

  CTDB_SERVICE_AUTOSTARTSTOP=yes

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

(This used to be ctdb commit f7de037e3be2e9910bee644dd1e93bae4912a194)
2011-08-30 16:51:55 +10:00
Martin Schwenke
857e144a97 Tests - eventscripts - Samba TCP port checking fixes
Expect "ctdb checktcpport" to exit with 1 if not implemented.

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

(This used to be ctdb commit 20885d592040eb3945524c558b593a1d50a57b43)
2011-08-30 16:51:55 +10:00
Martin Schwenke
5de459f94e Tests - eventscripts - TCP port checking, no working checkers
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b231aa629b909a7dfd071236c7e730e3cc4a1a54)
2011-08-30 16:51:55 +10:00
Martin Schwenke
9b8e25d03b Tests - eventscripts - new Samba TCP port checking test - no nmap
This one should fall back to netstat.

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

(This used to be ctdb commit 0a08068f736efe56b4799e1f1f90539d257deb71)
2011-08-30 16:51:55 +10:00
Martin Schwenke
fe730830a7 Tests - eventscripts - nmap and netstat stubs can pretend they weren't found
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 47f2843b4db767bcc724d8f972e0c2a850d5826f)
2011-08-30 16:51:55 +10:00
Martin Schwenke
7fc7ebb5ac Tests - eventscripts - new Samba tests to test TCP port checking
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9e3e6ab3edf0f79d5973eb39ed843d3c369c665d)
2011-08-30 16:51:55 +10:00
Martin Schwenke
764b425a96 Tests - eventscripts - add a new ctdb_not_implemented() function
This allowed a single ctdb command to be defined as not-implemented
and provided the associated output from the ctdb stub in
$ctdb_not_implemented.

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

(This used to be ctdb commit 3852c091f5e0ecba06b7131ca04b73a0cd632f23)
2011-08-30 16:51:55 +10:00
Martin Schwenke
bda5f71c13 Tests - eventscripts - new function setup_nmap_output_filter()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ef6131ecb068f7d8402cc782359509ba54b5adb0)
2011-08-30 16:51:55 +10:00
Martin Schwenke
5574b3b6fe Tests - eventscripts - add some output filtering
This allows $OUT_FILTER to be set to one or more sed commands to
filter eventscript output.  This allows expected output to be
generalised.

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

(This used to be ctdb commit a1d424045c53f5b148952eade6161af8248ed4df)
2011-08-30 16:51:55 +10:00
Martin Schwenke
58687f52be Tests - eventscripts - ctdb default default level is 0.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit fcf40500c2158dfbe2390fad7bf0614cc575df14)
2011-08-30 16:51:55 +10:00
Martin Schwenke
c9305f5dda Tests - eventscripts - add output for "not implemented" in ctdb stub
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 1d02e3c6a7fb5ad5edb21298deba415ba9519f3d)
2011-08-30 16:51:55 +10:00
Martin Schwenke
e88df4289f Tests - eventscripts - add an nmap stub
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 6ff9545a0fd58f0728b769c7b36d3b6ab7366321)
2011-08-30 16:51:55 +10:00
Martin Schwenke
7b2e79ab7f Tests - eventscripts - stop timeouts waiting for backgrounded testparm
Not sleeping at all speeds up the tests.  However, it can also cause
timeouts.  Therefore, every time sleep is run we force the stub to do
a short 0.1s sleep instead of whatever is specified.  This should be
enough to avoid races.

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

(This used to be ctdb commit 59a1d54bcc15058f7b69e8596b32b26427a3ae57)
2011-08-30 16:51:55 +10:00
Martin Schwenke
6eb339e2c7 Tests - add getdebug and checktcpport to ctdb eventscripts stub
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9c6fd7d21c99e605e20620c5c6b4e695c02af771)
2011-08-30 16:51:55 +10:00
Martin Schwenke
21c17cc100 Tests - add hooks to simulate ctdb commands that aren't implemented
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e9bdfd43af3ed28a7f69a36e3fb037f252a23869)
2011-08-30 16:51:55 +10:00
Martin Schwenke
d2527e3e5b Tests - add eventscripts testing stub for sleep command.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit aedff41ee1df0a1a573476844993fa8eda2f34bf)
2011-08-30 16:51:55 +10:00
Martin Schwenke
7d7851dd45 Tests - Change variable used to fake listening TCP ports.
Change from $FAKE_NETSTAT_TCP_LISTEN to $FAKE_TCP_LISTEN.

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

(This used to be ctdb commit f19ba38e382034fba769145d0bfc81b2c2941563)
2011-08-30 16:51:55 +10:00
Martin Schwenke
62f2d160ac Tests - new NFS share checking tests
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ea0db472c2ce138c723aa7e633b72ac9d8b8a6a3)
2011-08-30 16:51:55 +10:00
Martin Schwenke
f3c590c199 Tests - eventscripts exportfs stub should splits lines
The real exportfs splits lines longer than 15 characters.  The stub
should do that too...

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

(This used to be ctdb commit fb3e123b097d9e36d281c3ab4f3e9a4799fa27bc)
2011-08-30 16:51:55 +10:00
Martin Schwenke
625e0c5aea Tests - add -T (trace) option to eventscripts run_test.sh
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 08eeb788523afe19760b00f40339b702eb193712)
2011-08-30 16:51:54 +10:00
Ronnie Sahlberg
81292ac0e6 Change the errors for 10.interface to clearly state ERROR: for error messages
Update the tests system to catch the new error strings generated by this change

(This used to be ctdb commit a2c30d88348da47d1a733a16e4c7d83c3becb6df)
2011-08-15 15:53:04 +10:00
Ronnie Sahlberg
569ea5c4e1 Merge remote branch 'martins/eventscript_tests'
(This used to be ctdb commit 4e670d9bc1bdeb2abd7e846bc36e02f0aa0d7309)
2011-08-15 15:43:15 +10:00
Martin Schwenke
65ff8b4b7b Tests - exportfs stub needs to print out export options.
This is needed due to bd39b91ad12fd05271a7fced0e6f9d8c4eba92e6.

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

(This used to be ctdb commit 92f8e31f6995836b1668639a4dac2862efee269a)
2011-08-15 15:42:20 +10:00
Ronnie Sahlberg
2c5f1d7ccc Merge remote branch 'martins/eventscript.60.nfs.rpc'
(This used to be ctdb commit 2e30a2bb4371a846c7a768affa15883211642d5c)
2011-08-15 15:20:18 +10:00
Martin Schwenke
3b43805a31 Tests: re-enable the NFS eventscript tests - they work again.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3e145ab1bb61ed2087ec5ce6183ee24802686ed3)
2011-08-12 16:30:54 +10:00
Martin Schwenke
881054a0ad Tests: Re-enable the Samba eventscript tests.
They work again.

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

(This used to be ctdb commit 2036764bfd1a4571fcfcca22099c2b9a95a02c57)
2011-08-11 15:33:46 +10:00
Martin Schwenke
9f98ec85d9 Revert "Tests: tweak some samba tests to cope with debug from ctdb_check_tcp_ports()."
This reverts commit 557ac30e60516742da10b83bfbbbb41430c977a2.

(This used to be ctdb commit 9600cc7a6b7b854fac1a5b080129e3df8fcbd84e)
2011-08-11 15:32:28 +10:00
Martin Schwenke
d8e342d71a Tests - Disable the Samba and NFS eventscript tests.
They're broken and not worth fixing without infrastructure changes so
disable them by taking away the execute bit.  This is somewhat easier
than trying to merge in all the other tests but not these ones.

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

(This used to be ctdb commit 151151353e58f59b15be9313e22b7d4f71ee0de8)
2011-08-08 16:11:14 +10:00
Martin Schwenke
958414ceeb Tests - Tweak 10.interfaces 802.ad bonding test to work with current code.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d3271d316f6d1561e66cbc4cc1b1e8af63895459)
2011-08-08 15:53:28 +10:00
Martin Schwenke
b30143eb78 Tests - implement "ctdb -Y ip -v" in stub for eventscript testing.
This is pretty limited but it gets 10.interfaces tests working.

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

(This used to be ctdb commit 7130963430e530fa4dd5e6fe132bd7122349cc5f)
2011-08-08 15:42:45 +10:00
Martin Schwenke
7e5c48c84c Tests - stub ip program should assume interface name if "dev" not specified.
Currently it fails if you don't use the "dev" keyword.

This makes it behave as expected.

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

(This used to be ctdb commit 4fa2073649f25993de4b8ef6b3e7172068a83a29)
2011-08-08 14:45:30 +10:00
Martin Schwenke
2c9c77f6dc Tests: update tests to work with previous commit.
Issues:

* 10.monitor no longer prints a message when there is no
  public_addresses file.

* Extra bonding test added to check workaround for IEEE 802.3ad
  Dynamic link aggregation bonding mode bug.

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

(This used to be ctdb commit 01c941ab4c764c5aac0d7c0f90fca89775956d41)
2011-08-08 13:47:13 +10:00
Martin Schwenke
506be3cb26 Tests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.
This sets up a more useful convention and avoids future .gitignore
problems.

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

(This used to be ctdb commit 58c696dc600f1073e693930da061776b6fb199f2)
2011-08-08 13:38:07 +10:00
Martin Schwenke
604eb67102 Tests: tweak some samba tests to cope with debug from ctdb_check_tcp_ports().
This is a bit too static.  However, it can fixed up later if it is a
hassle.

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

(This used to be ctdb commit 557ac30e60516742da10b83bfbbbb41430c977a2)
2011-08-08 13:38:07 +10:00
Martin Schwenke
2396846ca1 Tests: Oops! Add bin directory for eventscript tests.
It was matched by .gitignore.

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

(This used to be ctdb commit ef7e5da6241e326267800cd2bd53fb33a0386c2d)
2011-08-08 13:38:07 +10:00
Martin Schwenke
f43ae500be Tests: initial eventscript unit tests.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b675ca3c25b7155b9681128822d1280018ef68bb)
2011-08-08 13:38:07 +10:00