zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Irfan Hamid <iha...@salesforce.com>
Subject Re: Simulate expired connection for testing
Date Thu, 23 Jun 2016 13:46:04 GMT
Thanks Jordan. I'm currently using 3.4.6 so was hoping for a solution
there. Secondly, the solution you've described would be suitable for
unit-testing since it requires access to the ZooKeeper client object, or am
I missing something and we can inject a session expiration for a different
session than the one the client object is in?

Thanks,
Irfan.


On Wed, Jun 22, 2016 at 1:21 PM, Jordan Zimmerman <
jordan@jordanzimmerman.com> wrote:

> In ZK 3.5.x there is a method for this:
>
>         client.getTestable().injectSessionExpiration();
>
> -JZ
>
> > On Jun 22, 2016, at 3:18 PM, Irfan Hamid <ihamid@salesforce.com> wrote:
> >
> > Hi,
> >
> > I'm testing some client code against a ZK cluster, and since it's local
> > testing I can use a single ZK instance as well if need be. I'm trying to
> > simulate an expired connection so I can validate my reconnect logic. I've
> > tried the following:
> >
> > 1. Single ZK server: connect from client, then kill -9 zkpid (this
> results
> > in disconnect). Try waiting a long time then restart ZK server, it
> > reconnects;
> > 2. Multiple ZK server quorum: connect from client, then kill -9 zkpid
> (the
> > one client connected to). This causes the client to be disconnected and
> > then connects to a different quorum server, until there is no majority
> left
> > active (1 out of 3) and then it can't reconnect.
> >
> > Is there an easy way for me to simulate an end-to-end scenario outside of
> > unit-tests that lets me see the behavior of my reconnect logic?
> >
> > Thanks,
> > Irfan.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message