You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shai Erera <se...@gmail.com> on 2015/03/29 09:36:55 UTC

Simulate Solr node kill (tests)

Hi

I was looking for a way to simulate a Solr node kill in unit tests. I
looked at ChaosMonkey which has a .kill() method, but it relies on being
able to use IpTables (which means running 'iptables'). Since I'm testing on
Windows, I can't.

As an alternative, I thought to grab the instance of the SolrZkClient used
internally by CoreContainer and close() it, therefore the node will lose
the ability to communicate with ZK and won't be able to update its states.
Then if I stop the Jetty server, its graceful shutdown will not affect the
states recorded in ZK.

Does that sound like a good alternative?
Should I maybe close the ZkController?
Is there a better way to simulate a kill?

The IpTables method allows me to also test temporarily losing connection w/
ZK, but I see ZolrZooKeeper also offers a closeCnxn() method which uses
TestableZooKeeper (from the ZK project) underneath to simulate that. Is
that a good alternative to ChaosMonkey for simulating temporary ZK
connection losses?

Separately, if the answer is YES to both questions, can that replace the
IpTables method, allowing these tests to run under Windows too?

Shai