From 0060a749cac02b3401de8879871cae38b7c7db12 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 16 Sep 2015 04:58:16 -0400 Subject: [PATCH] Fix test case to verify the AssertionError did in fact come from IndexWriter.filesExist --- .../elasticsearch/index/engine/InternalEngineTests.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index ba65a1026ae..818e2b08122 100644 --- a/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -41,6 +41,7 @@ import org.apache.lucene.store.MockDirectoryWrapper; import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.TestUtil; import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version; import org.elasticsearch.action.support.TransportActions; import org.elasticsearch.cluster.metadata.IndexMetaData; @@ -1728,9 +1729,11 @@ public class InternalEngineTests extends ESTestCase { engine = createEngine(store, primaryTranslogDir); started = true; break; - } catch (EngineCreationFailureException | AssertionError ex) { - // IndexWriter can throw AssertionError on init (if asserts are enabled) if we throw FNFE/NSFE when it asserts that all - // referenced files in the current commit point do exist + } catch (EngineCreationFailureException ex) { + } catch (AssertionError ex) { + // IndexWriter can throw AssertionError on init (if asserts are enabled) if our directory randomly throws FNFE/NSFE when + // it asserts that all referenced files in the current commit point do exist + assertTrue(ExceptionsHelper.stackTrace(ex).contains("org.apache.lucene.index.IndexWriter.filesExist")); } }