You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Stephen Green <ee...@gmail.com> on 2010/06/04 20:28:55 UTC

Simulating failures?

Now that I've got things working pretty smoothly with my ZooKeeper
setup in normal operation, I'd like to test some of the recovery stuff
that I've put into my application.

I'd like to make sure that if a connection to ZK fails, then my
application recovers appropriately (possibly by giving up).  Obviously
I could do some of this by shutting off the server and restarting it,
but I'd like to be a bit more systematic, if possible.

Is there any way to inject failures into the ZK client so that I can
test without having to randomly kill servers/clients?

Thanks,

Steve
-- 
Stephen Green
http://thesearchguy.wordpress.com

Re: Simulating failures?

Posted by Patrick Hunt <ph...@apache.org>.
Here's how to test session expiration (haven't tried this in a while):
http://github.com/phunt/zkexamples

It would be great to have some test 
infrastructure/examples/docs/strategies available for developers (zk 
client users). If someone would be interested to workon/contribute this 
we'd be pretty psyched to work with you on it.

Patrick

On 06/04/2010 11:28 AM, Stephen Green wrote:
> Now that I've got things working pretty smoothly with my ZooKeeper
> setup in normal operation, I'd like to test some of the recovery stuff
> that I've put into my application.
>
> I'd like to make sure that if a connection to ZK fails, then my
> application recovers appropriately (possibly by giving up).  Obviously
> I could do some of this by shutting off the server and restarting it,
> but I'd like to be a bit more systematic, if possible.
>
> Is there any way to inject failures into the ZK client so that I can
> test without having to randomly kill servers/clients?
>
> Thanks,
>
> Steve

Re: Simulating failures?

Posted by Ted Dunning <te...@gmail.com>.
I use mock objects to create a simulated ZK object.

Alternatively, you may be able to sub-class and delegate all ZK calls.  That
would let you inject faults.

On Fri, Jun 4, 2010 at 11:28 AM, Stephen Green <ee...@gmail.com>wrote:

> Is there any way to inject failures into the ZK client so that I can
> test without having to randomly kill servers/clients?
>