Test: index dump on test failure

This changes adds the ability for a test to create an index dump if a search request fails the test. This can be helpful to be able to analyse the index state after the test has failed
If the random id already exists, we just skip the dump?  Seems like if this method is called, a dump should always be produced?