The problem is if I have many unit tests, start the topology, wait for it to finish and shutdown many times is slow. Is there some way that I can avoid putting data in the queue and inject data to spout directly? How can I know the topology I am testing has done the work ? (maybe add a counter in topology to remember how many items in the queue got processed?)
Can anyone share your experiences about testing Storm Topologies?
Thanks in advance.
Stone
Thanks. I'm really excited to get going on this finally.
Dave
On Dec 13, 7:02 pm, Nathan Marz <nathan.m...@gmail.com> wrote:
> Storm actually has some awesome built-in stuff for doing testing, although
> it's only available in Clojure right now (Storm's unit tests use this stuff
> heavily). Basically I can do this:
>
> (complete-topology local-cluster topology :mock-sources {"spout1" [["a" 1]
> ["b" 2]]})
>
> This will mock out "spout1" with the tuples provided, and then wait for the
> topology to ack both of those spout tuples. complete-topology then returns
> an object that you can query for the tuples emitted by any component in the
> topology.
>
> I've opened up an issue to expose the testing facilities here:https://github.com/nathanmarz/storm/issues/72
>
> In the meantime, here's the implementation of complete-topology:https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/stor...
>
>
>
>
>
>
>
>
>
> On Mon, Dec 12, 2011 at 10:51 PM, stone <stones....@gmail.com> wrote:
> > Hi ALL,
>
> > I am implementing storm topologies, the testing approach I used is like
> > the following:
>
> > - set up a queue the spout depends on
> > - for each unit test
java.lang.NullPointerException
at
backtype.storm.task.TopologyContext.getComponentCommon(TopologyContext.java:
286)
at
backtype.storm.task.TopologyContext.getComponentOutputFields(TopologyContext.java:
211)
at backtype.storm.tuple.Tuple.<init>(Tuple.java:41)
at backtype.storm.tuple.Tuple.<init>(Tuple.java:51)
at
com.company.data.etl.storm.SoftwareDiscriminatorBoltTests.SoftwareDiscriminatorBoltEmitsToCorrectOutputStream(SoftwareDiscriminatorBoltTests.java:
68)
Thanks,
Dave
Dave
On Dec 16, 2:54 am, Nathan Marz <nathan.m...@gmail.com> wrote:
Another issue that comes up is that you need to mock the output collector and fir lots of bolts you need to mock out things like System.nanoTime(). All that is quite doable with jmockit and the results are pretty easy reading as well.
Sent from my iPhone