zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: Simulating ConnectionLossException and SessionExpiredException events during integration testing
Date Thu, 16 Jun 2011 07:16:34 GMT
The other method which is used in the ZK test cases is to make a second
connection with the same session id and then close that session.  This
causes the first connection to get a session expiration.

On Thu, Jun 16, 2011 at 7:59 AM, Thijs Terlouw <thijsterlouw@gmail.com>wrote:

> I recently used iptables on Linux to test these edge cases:
>
> You just drop all traffic to the zookeeper server ip/port:
> "iptables -D OUTPUT -p tcp -dport 2181 -j DROP"
> then you wait a couple of seconds (longer than the session expiration
> value, depends on your configuration) and then remove this iptables
> rule again. The ZK Client library will reconnect and will receive
> SessionExpired.
>
> Not sure your embedded zookeeper is used via tcp, but you could always
> test with a standalone zookeeper server.
>
> Thijs
>
> On Thu, Jun 16, 2011 at 12:37 PM, Todd Nine <todd@spidertracks.com> wrote:
> > Hi guys,
> >  I've written quite a few integration tests around our zookeeper
> > functionality.  However I find I'm having a really hard time testing edge
> > cases that are caused by ConnectionLossException and
> > SessionExpiredException.  Is there any good way to simulate these events
> in
> > an embedded zookeeper runtime and then ensure a new client is created?
> >
> > Thanks,
> > Todd
> >
>
>
>
> --
> Thijs Terlouw,
> Shenzhen, China
> http://www.startinchina.com
>

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