From 2ca919b31a936ba210ce751fa7852a328535191f Mon Sep 17 00:00:00 2001 From: Ali Beyad Date: Fri, 7 Oct 2016 15:26:58 -0400 Subject: [PATCH] improve test code slightly --- .../index/engine/InternalEngineTests.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 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 2726731ca811a..d8bc7bb058e4f 100644 --- a/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/core/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -1685,15 +1685,14 @@ public void testSeqNoAndCheckpoints() throws IOException { // the first time the commit data iterable gets an iterator, the max seq no from that point in time should // remain from any subsequent call to IndexWriter#getLiveCommitData unless the commit data is overwritten by a // subsequent call to IndexWriter#setLiveCommitData. - if (initialEngine.seqNoService().getMaxSeqNo() != SequenceNumbersService.NO_OPS_PERFORMED) { - assertThat( - initialEngine.seqNoService().getMaxSeqNo(), - // its possible that right after a commit, a version conflict exception happened so the max seq no was not updated, - // so here we check greater than or equal to - versionConflict ? greaterThanOrEqualTo(initialEngine.loadSeqNoStatsFromCommit().getMaxSeqNo()) : - greaterThan(initialEngine.loadSeqNoStatsFromCommit().getMaxSeqNo()) - ); - } + assertThat( + initialEngine.seqNoService().getMaxSeqNo(), + // its possible we haven't indexed any documents yet, or its possible that right after a commit, a version conflict + // exception happened so the max seq no was not updated, so here we check greater than or equal to + initialEngine.seqNoService().getMaxSeqNo() != SequenceNumbersService.NO_OPS_PERFORMED || versionConflict ? + greaterThanOrEqualTo(initialEngine.loadSeqNoStatsFromCommit().getMaxSeqNo()) : + greaterThan(initialEngine.loadSeqNoStatsFromCommit().getMaxSeqNo()) + ); if (rarely()) { localCheckpoint = primarySeqNo;