1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

629 Commits

Author SHA1 Message Date
Martin Schwenke
e2a604f93c tests/simple: ctdb stop/continue tests weren't actually checking IPs
The correct variable is $test_node_ips, not $ips.

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

(This used to be ctdb commit 8d17dacee415dd0b4268805a366a86f83e33f27c)
2012-07-26 22:03:00 +10:00
Martin Schwenke
523be079ea tests: select_test_node_and_ips() should try to avoid failing
Sometimes "ctdb sync" doesn't do its job, so we end up with unassigned
IPs.

If $test_node isn't set then this is bad.  However, try a few times to
ensure it is set.

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

(This used to be ctdb commit 2fd0157382b42aa5c5212b8e743c6f589edc6662)
2012-07-26 22:03:00 +10:00
Martin Schwenke
959e37da7b tests: simple tests against local daemons should check $TEST_LOCAL_DEAMONS
Note the old $CTDB_TEST_REAL_CLUSTER - it doesn't exist anymore...

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

(This used to be ctdb commit 47180dc75d15f3d61470705603565b718491c9f8)
2012-07-26 22:03:00 +10:00
Martin Schwenke
053174c07b tests: run_tests should exit with $status with -e option
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 619af3e857c2ced3840abfd86135cc954796da97)
2012-07-26 22:03:00 +10:00
Martin Schwenke
867381486d tests/simple: ctdb reloadips test should use $test_ip
There's no point recalculating this value.

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

(This used to be ctdb commit 6e7bd9685406ae024d413a5d9d8c6e0d89b15567)
2012-07-26 22:03:00 +10:00
Martin Schwenke
c075c2e5c9 tests: select_test_node_and_ips() should never select non-node -1
Instead of selecting the 1st pnn found, select the 1st one that isn't -1.

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

(This used to be ctdb commit f02e501342112aab67aee95f253e29a670b29273)
2012-07-26 22:03:00 +10:00
Michael Adam
27ce9dc366 run_tests: improve spacing
(This used to be ctdb commit a0a0f5588445aeabe07b0e4d65087db454dc09da)
2012-07-03 14:30:25 +02:00
Michael Adam
334557680c run_tests.sh: fix a comment
(This used to be ctdb commit 0e515115b3c21cb179fd7a6356164ac1b5d423e0)
2012-07-03 14:30:24 +02:00
Amitay Isaacs
9881ec8e64 tests: Increment RSN always in ctdb_update_record_persistent test
If the record does not exist in persistent DB, RSN for that record is
considered 0. To write a record, RSN for that record should be set to 1,
otherwise the RSN check would fail.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ac89da4eea98fa686408c5671a6c44c0fd1d7a58)
2012-05-28 11:22:28 +10:00
Amitay Isaacs
0cb1cc631d tests: Fix ctdb_fetch test (parse extra lines of output)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 0be452958db95c8253c362a1c08a1966e53a1f99)
2012-05-28 11:22:28 +10:00
Amitay Isaacs
88529e8a89 tests: Fix flakey behavior of ctdb_fetch test
There were two issues with this test:

1. Since the messages are sent from one node to the next, if a node
   does not register for messages before CTDB on that nodes receives
   the message, it will never be seen by ctdb_fetch and it would
   block on receive and would not send any messages to next node.
   The crude solution is to sleep just before the messages are sent,
   so that ctdb_fetch on all nodes have registered for the messages.

2. If ctdb_fetch stops sending messages after timelimit expiry, the
   next node will keep waiting to receive messages in event_loop_once().
   The default timeout is 30 seconds for event_loop_once(). Adding a
   timed event will always set the timeout value to the time remaining
   for the timed event to expire.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit bc55e09fdac9f743d6428bfe0be77840ad0fd1ba)
2012-05-28 11:22:27 +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
2d953e6957 tests: Complex tests must not be run from a cluster node
Tickle tests fail if run from a node involved in the test.

The condition is actually weaker than this: the test can't be run from
a CTDB node that is hosting public addresses that may be used by the
test.

Rework ctdb_test_check_real_cluster() to support checking this.

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

(This used to be ctdb commit 14012781c3751a514055df29ea70adfb12ecb2d9)
2012-05-25 15:26:18 +10:00
Martin Schwenke
e2831efd0c tests: test_wrap needs to set TEST_BIN_DIR when installed
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c5e3e4bccbde349739b90d8761e1aa19637887a8)
2012-05-25 15:25:44 +10:00
Amitay Isaacs
cfe030e297 tests: Use per node log files when running tests with local daemons
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 61df417821762d87ed01a7b5e64c35079940344d)
2012-05-25 15:25:15 +10:00
Martin Schwenke
aa50bc580c tests: Move the "ctdb reloadips" test from complex/ to simple/
This is made possible by separation of public addresses files for
local daemons and the addition of get_ctdbd_command_line_option().

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

(This used to be ctdb commit 2bcd58b30d7cf6dd48ad7f019810c6965a44c85a)
2012-05-14 15:13:41 +10:00
Martin Schwenke
4563865fb6 tests: Fix a typo in daemons_setup()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 863ad337fa3c4effe1fd370d3ba414027c600bd6)
2012-05-14 15:13:41 +10:00
Martin Schwenke
8880484658 tests: New function get_ctdbd_command_line_option() for integration testing
This allows, for example, the public addresses file used by a
particular daemon to be known.

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

(This used to be ctdb commit f4b7d14f2e3c7345e7a09abb27c32923fb78cbc4)
2012-05-14 15:13:41 +10:00
Martin Schwenke
e3d357b9c3 tests: Use per-daemon public_addresses file for local daemons
This allows a node's public addresses file to be hacked for testing.

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

(This used to be ctdb commit c7d6e4557d00de674737e2c8d6cbebaa2461c303)
2012-05-14 15:02:19 +10:00
Martin Schwenke
594601bdad tests: Fix wrapper scripts to handle options and tests without breakage
If the -V option is given and no tests are supplied, the "cd" command
in run_tests.sh cause scripts/run_tests to interpret the argument to
-V incorrectly.  Therefore, the wrapper scripts can't use "cd" because
they don't know what the options are doing!

Instead scripts/run_tests searches for each test relative to the
current directory and, if not previously found, then searches relative
to the top-level tests directory.  This is a much better way of doing
things.

Given that run_tests.sh and run_cluster_tests.sh were starting to
contain duplicate complex logic, remove run_cluster_tests.sh and
replace it with a symlink to run_tests.sh.  Run_tests.sh checks $0 to
see what options/defaults to use.  Update INSTALL to deal with this.

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

(This used to be ctdb commit ed2db1f4e8d2b222d7f912a4a007ce48a23e83b0)
2012-05-14 15:02:19 +10:00
Martin Schwenke
b8e9a3e54d tests: Add a test for "ctdb reloadips"
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d2514051761ba23deee0e118c25afab2ab8d854e)
2012-05-11 12:13:24 +10:00
Martin Schwenke
f510ae64cb tests: In integration tests, use --node-ip to avoid locking weirdness
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a00e80c701a0f9695f41c24e0360c25c0873d49d)
2012-05-11 10:33:27 +10:00
Martin Schwenke
99ed2d11e1 tests: Allow run_cluster_tests.sh to take options
However, options must be followed by "--".

This also fixes:

* a bug where specifying tests caused local daemons to be used; and
* an incorrect comment.

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

(This used to be ctdb commit 6b8507d4d3062e709409b3790117d87311b3460d)
2012-05-11 10:33:27 +10:00
Martin Schwenke
af2ab74beb tests: Allow run_tests.sh to take options
However, options must be followed by "--".

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

(This used to be ctdb commit db8cf8f5e644a0b21a6040287887fee40f38d4db)
2012-05-11 10:33:27 +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
Ronnie Sahlberg
a57eba2bb4 Track all child process so we never send a signal to an unrelated process (our child died and kernel wrapped the pid-space and reused the pid for a different process
Wrap all creation of child processes inside ctdb_fork() which is used to track all processes we have spawned.
Capture SIGCHLD to track also which child processes have terminated.

Wrap kill() inside ctdb_kill() and make sure that we never send a !0 signal to a child process pid that has already terminated (and might have been replaced with a

(This used to be ctdb commit f73a4b1495830bcdd094a93732a89dd53b3c2f78)
2012-05-03 14:03:26 +10:00
Amitay Isaacs
ec72e30b8f tests/simple: Fix typo in the test message
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit c642b452e7b0272e32c02509ac579b790d9a03e7)
2012-05-01 12:09:38 +10:00
Martin Schwenke
c30356c140 tests: Update README
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e9fad1ff82e6fb9e6bf615986c41c746fd415058)
2012-04-27 17:19:45 +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
dc2dfbdb93 tests: Add installation script for tests
This could all be done in Makefile.in, but that would be very complex.

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

(This used to be ctdb commit 12c9986059cacda819e669fa77d613b408c62599)
2012-04-27 15:42:42 +10:00
Martin Schwenke
46f82181d0 tests/simple: Add new pseudo testcase to potentially shutdown local daemons
Only shuts them down if $TEST_CLEANUP is true.

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

(This used to be ctdb commit eddfc02335202d853e29a89f08225ab44cac8a25)
2012-04-27 15:42:42 +10:00
Martin Schwenke
70270b6815 tests: New run_tests -C (cleanup) option
Sets TEST_CLEANUP=true and causes $TEST_VAR_DIR to be removed... and
potentially other cleanup actions in testcases.

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

(This used to be ctdb commit 3219f221a858e499f084b8beb44610537312602b)
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
451e660338 tests: Time logging in integration tests should use TEST_VAR_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 734cbd7def23236d418ebc6d813a748a84900101)
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
b7b6f10e9b tests: Improve the logic for adding directories to $PATH
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e6bfd3bdb3a35b2e7e7c41a6f37976772a54e3ce)
2012-04-27 15:42:42 +10:00
Martin Schwenke
d28e268ed6 tests: Update integration.sh to use TEST_VAR_DIR
There are 2 subtleties:

* Local daemons currently use the in-tree tests/events.d/ subdirectory
  for their eventscripts.  However, some tests install/remove test-specific
  eventscripts so now $TEST_VAR_DIR/events.d/ is used and the standard
  eventscripts are copied there at setup time.

* The pgrep/pkill logic for killing local daemons currently relies on
  ctdbd being run with a full path to tests/bin/ctdbd.  If the tests
  are installed and run against an installed daemon then this won't
  work.  Therefore, ctdbd is now expected to be in $PATH and is
  found/killed by matching:

    ctdbd --socket=.* --nlist .* --nopublicipcheck

  This is complex but should avoid killing a real ctdbd running on a
  node.

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

(This used to be ctdb commit 301491802eec0e49e108f5aae7d7be379703d72c)
2012-04-27 15:42:42 +10:00
Martin Schwenke
5b590dfa19 tests: Add a -V option to set new variable TEST_VAR_DIR
Part of preparation to be able to install the tests.  The current var/
subdirectories will end up somewhere in /usr/local/ or /usr/ and we
don't want to put temporary files there.

This creates a temporary TEST_VAR_DIR by default.

If -V is specified then the given directory will be used as
TEST_VAR_DIR.  This allows the current behaviour where individual
integration tests can be run against already-running daemons 9with
sockets and other stuff already created) to save time and trouble.

Yes, there are plans for a clean-up option...  ;-)

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

(This used to be ctdb commit 8e4ec9a40bb7d392d7474b067a74fa121c069007)
2012-04-27 15:42:42 +10:00
Martin Schwenke
7ed4387990 tests/integration: Remove cabability for testcase option
This is unused and can't be used with the current test infrastructure.
It may have been useful with ctdb_test_env but I don't think it was
ever used.

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

(This used to be ctdb commit 4aa879466dd46cb4e8710edbbaac1276521e475b)
2012-04-27 15:40:43 +10:00
Martin Schwenke
286d5aa5b1 tests/integration: Use absolute path for socket symlink
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 709cd5dfeb630096a1cd2062da666fee9ddca715)
2012-04-27 15:40:43 +10:00
Martin Schwenke
edaead3cd5 tests/simple: Replace "tdbdump" with "ctdb cattdb"
tdbdump may not be installed and would be an unnecessary dependency.

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

(This used to be ctdb commit fbabc05569d91bf033f474d89f51b49490943332)
2012-04-27 15:40:43 +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
466ff20156 tests: Update top-level wrapper scripts
* Add the unit tests to "make test"
* Make scripts run from anywhere

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

(This used to be ctdb commit 95947123eee687ed83eebc567397a5bc9d55a945)
2012-04-27 15:40:43 +10:00
Martin Schwenke
c4606275c9 tests: run_tests should exit with failed test status if running with -H
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 6eb7fa572e7fc212332ddd68793e3f35161baf7c)
2012-04-27 15:40:43 +10:00