-Re: Simulating ConnectionLossException and SessionExpiredException events during integration testing
On Thu, Jun 16, 2011 at 1:16 AM, Ted Dunning <[EMAIL PROTECTED]> wrote:
> 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 <[EMAIL PROTECTED]
> > 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 <[EMAIL PROTECTED]>
> > > 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
> > > cases that are caused by ConnectionLossException and
> > > SessionExpiredException. Is there any good way to simulate these
> > in
> > > an embedded zookeeper runtime and then ensure a new client is created?
> > >
> > > Thanks,
> > > Todd
> > >
> > --
> > Thijs Terlouw,
> > Shenzhen, China
> > http://www.startinchina.com