You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Clint Kelly <cl...@gmail.com> on 2014/12/09 20:41:58 UTC

Best practice for emulating a Cassandra timeout during unit tests?

Hi all,

I'd like to write some tests for my code that uses the Cassandra Java
driver to see how it behaves if there is a read timeout while accessing
Cassandra.  Is there a best-practice for getting this done?  I was thinking
about adjusting the settings in the cluster builder to adjust the timeout
settings to be something impossibly low (like 1ms), but I'd rather do
something to my test Cassandra instance (using the
EmbeddedCassandraService) to temporarily slow it down.

Any suggestions?

Best regards,
Clint

Re: Best practice for emulating a Cassandra timeout during unit tests?

Posted by Jens Rantil <je...@tink.se>.
Hi,




I don’t know if this is “best practice”, but you could do this using mocking if nothing else.




Cheers,

Jens


———
Jens Rantil
Backend engineer
Tink AB

Email: jens.rantil@tink.se
Phone: +46 708 84 18 32
Web: www.tink.se

Facebook Linkedin Twitter

On Tue, Dec 9, 2014 at 8:42 PM, Clint Kelly <cl...@gmail.com> wrote:

> Hi all,
> I'd like to write some tests for my code that uses the Cassandra Java
> driver to see how it behaves if there is a read timeout while accessing
> Cassandra.  Is there a best-practice for getting this done?  I was thinking
> about adjusting the settings in the cluster builder to adjust the timeout
> settings to be something impossibly low (like 1ms), but I'd rather do
> something to my test Cassandra instance (using the
> EmbeddedCassandraService) to temporarily slow it down.
> Any suggestions?
> Best regards,
> Clint