What is the recommended way of writing integration tests for a Apache Storm topology in Java? Appreciate any suggestions/links.
You can use LocalCluster for integration testing. Take a look at this class https://github.com/apache/storm/blob/822a4685c0278aba9d4e0f43104bc4f86a462222/storm-server/src/main/java/org/apache/storm/LocalCluster.java#L119
You can look at some of Storm's own integration tests for inspiration e.g. https://github.com/apache/storm/blob/e0feb6cf04107029d4b24420f265495cdfbdb098/storm-server/src/test/java/org/apache/storm/TestingTest.java#L38.
Tools you may want to use are the FeederSpout
and FixedTupleSpout
. A topology where all spouts implement the CompletableSpout
interface can be run until completion using the tools in the Testing
class.
Storm tests can also choose to "simulate time" which means the Storm topology will idle until you call LocalCluster.advanceClusterTime
. This can let you do asserts in between bolt emits, for example.