tests: Fix flakey behavior of ctdb_fetch test
authorAmitay Isaacs <amitay@gmail.com>
Thu, 24 May 2012 06:46:07 +0000 (16:46 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 28 May 2012 01:22:27 +0000 (11:22 +1000)
commit88529e8a89eba920aab59524f50fa02eab9b5d03
tree9e2fa6a0a863abe2def08a2d3abbd46da53e914f
parent763183015298f9ac46e8bafad54938b2fb321f4c
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)
ctdb/tests/src/ctdb_fetch.c