You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Anthony Urso <an...@gmail.com> on 2010/10/18 14:17:46 UTC

Testing zookeeper outside the source distribution?

Anyone have any pointers on how to test against ZK outside of the
source distribution? All the fun classes (e.g. ClientBase) do not make
it into the ZK release jar.

Right now I am manually running a ZK node for the unit tests to
connect to prior to running my test, but I would rather have something
that ant could reliably
automate starting and stopping for CI.

Thanks,
Anthony

RE: Testing zookeeper outside the source distribution?

Posted by "Fournier, Camille F. [Tech]" <Ca...@gs.com>.
That would be incredibly useful, I keep meaning to just take the code I need for integration testing from the zk test source but it would be much nicer as a released jar. I created ZOOKEEPER-903 to track this:

https://issues.apache.org/jira/browse/ZOOKEEPER-903

C

-----Original Message-----
From: Benjamin Reed [mailto:breed@yahoo-inc.com] 
Sent: Monday, October 18, 2010 11:12 AM
To: zookeeper-user@hadoop.apache.org
Subject: Re: Testing zookeeper outside the source distribution?

  we should be exposing those classes and releasing them as a testing 
jar. do you want to open up a jira to track this issue?

ben

On 10/18/2010 05:17 AM, Anthony Urso wrote:
> Anyone have any pointers on how to test against ZK outside of the
> source distribution? All the fun classes (e.g. ClientBase) do not make
> it into the ZK release jar.
>
> Right now I am manually running a ZK node for the unit tests to
> connect to prior to running my test, but I would rather have something
> that ant could reliably
> automate starting and stopping for CI.
>
> Thanks,
> Anthony


Re: Testing zookeeper outside the source distribution?

Posted by Benjamin Reed <br...@yahoo-inc.com>.
  we should be exposing those classes and releasing them as a testing 
jar. do you want to open up a jira to track this issue?

ben

On 10/18/2010 05:17 AM, Anthony Urso wrote:
> Anyone have any pointers on how to test against ZK outside of the
> source distribution? All the fun classes (e.g. ClientBase) do not make
> it into the ZK release jar.
>
> Right now I am manually running a ZK node for the unit tests to
> connect to prior to running my test, but I would rather have something
> that ant could reliably
> automate starting and stopping for CI.
>
> Thanks,
> Anthony


Re: Testing zookeeper outside the source distribution?

Posted by Patrick Hunt <ph...@gmail.com>.
You might checkout a tool I built a while back to be used by operations
teams deploying ZooKeeper: http://bit.ly/a6tGVJ

It's really two tools actually, a smoketester and a latency tester, both of
which are important to verify when deploying a new cluster.

Patrick

On Mon, Oct 18, 2010 at 9:50 AM, Ted Dunning <te...@gmail.com> wrote:

> Generally, I think a better way to do this is to use a standard mock object
> framework.  Then you don't have to fake up an interface.
>
> But the original poster probably has a need to do integration tests more
> than unit tests.  In such tests, they need to test against a real ZK to
> make
> sure that their assumptions about the semantics of ZK are valid.
>
> On Mon, Oct 18, 2010 at 8:53 AM, David Rosenstrauch <darose@darose.net
> >wrote:
>
> > Consequently, the way I write my code for ZooKeeper is against a more
> > generic interface that provides operations for open, close, getData, and
> > setData.  When unit testing, I substitute in a "dummy" implementation
> that
> > just stores data in memory (i.e., a HashMap); when running live code I
> use
> > an implementation that talks to ZooKeeper.
> >
>

Re: Testing zookeeper outside the source distribution?

Posted by Patrick Hunt <ph...@apache.org>.
You might checkout a tool I built a while back to be used by operations
teams deploying ZooKeeper: http://bit.ly/a6tGVJ

It's really two tools actually, a smoketester and a latency tester, both of
which are important to verify when deploying a new cluster.

Patrick

On Mon, Oct 18, 2010 at 9:50 AM, Ted Dunning <te...@gmail.com> wrote:

> Generally, I think a better way to do this is to use a standard mock object
> framework.  Then you don't have to fake up an interface.
>
> But the original poster probably has a need to do integration tests more
> than unit tests.  In such tests, they need to test against a real ZK to
> make
> sure that their assumptions about the semantics of ZK are valid.
>
> On Mon, Oct 18, 2010 at 8:53 AM, David Rosenstrauch <darose@darose.net
> >wrote:
>
> > Consequently, the way I write my code for ZooKeeper is against a more
> > generic interface that provides operations for open, close, getData, and
> > setData.  When unit testing, I substitute in a "dummy" implementation
> that
> > just stores data in memory (i.e., a HashMap); when running live code I
> use
> > an implementation that talks to ZooKeeper.
> >
>

Re: Testing zookeeper outside the source distribution?

Posted by Ted Dunning <te...@gmail.com>.
Generally, I think a better way to do this is to use a standard mock object
framework.  Then you don't have to fake up an interface.

But the original poster probably has a need to do integration tests more
than unit tests.  In such tests, they need to test against a real ZK to make
sure that their assumptions about the semantics of ZK are valid.

On Mon, Oct 18, 2010 at 8:53 AM, David Rosenstrauch <da...@darose.net>wrote:

> Consequently, the way I write my code for ZooKeeper is against a more
> generic interface that provides operations for open, close, getData, and
> setData.  When unit testing, I substitute in a "dummy" implementation that
> just stores data in memory (i.e., a HashMap); when running live code I use
> an implementation that talks to ZooKeeper.
>

Re: Testing zookeeper outside the source distribution?

Posted by David Rosenstrauch <da...@darose.net>.
On 10/18/2010 08:17 AM, Anthony Urso wrote:
> Anyone have any pointers on how to test against ZK outside of the
> source distribution? All the fun classes (e.g. ClientBase) do not make
> it into the ZK release jar.
>
> Right now I am manually running a ZK node for the unit tests to
> connect to prior to running my test, but I would rather have something
> that ant could reliably
> automate starting and stopping for CI.
>
> Thanks,
> Anthony

The way I learned about unit testing is that a unit test should be 
"isolated", that is:  not need to depend on any external resource - most 
notably network resources, such as a database, a web server, or 
ZooKeeper.  (It's still OK to have a test that tests again a network 
resource, but that's really an integration test, not a unit test.)

Consequently, the way I write my code for ZooKeeper is against a more 
generic interface that provides operations for open, close, getData, and 
setData.  When unit testing, I substitute in a "dummy" implementation 
that just stores data in memory (i.e., a HashMap); when running live 
code I use an implementation that talks to ZooKeeper.

HTH,

DR