Skip to content

Commit b46d01d

Browse files
committed
Relax testAckedIndexing to allow document updating
The test indexes new documents and is thus correct in testing that the response result is `CREATED`. Sadly we can't guarantee exactly once delivery just yet. Relates elastic#9967 Closes elastic#21658
1 parent d3ee35e commit b46d01d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/test/java/org/elasticsearch/discovery/ClusterDisruptionIT.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.apache.logging.log4j.message.ParameterizedMessage;
2323
import org.apache.lucene.index.CorruptIndexException;
2424
import org.elasticsearch.ElasticsearchException;
25-
import org.elasticsearch.action.DocWriteResponse;
2625
import org.elasticsearch.action.NoShardAvailableActionException;
2726
import org.elasticsearch.action.get.GetResponse;
2827
import org.elasticsearch.action.index.IndexRequestBuilder;
@@ -61,10 +60,13 @@
6160
import java.util.concurrent.atomic.AtomicReference;
6261
import java.util.stream.Collectors;
6362

63+
import static org.elasticsearch.action.DocWriteResponse.Result.CREATED;
64+
import static org.elasticsearch.action.DocWriteResponse.Result.UPDATED;
6465
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
6566
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
6667
import static org.hamcrest.Matchers.equalTo;
6768
import static org.hamcrest.Matchers.is;
69+
import static org.hamcrest.Matchers.isOneOf;
6870
import static org.hamcrest.Matchers.not;
6971

7072
/**
@@ -135,7 +137,7 @@ public void testAckedIndexing() throws Exception {
135137
.setSource("{}", XContentType.JSON)
136138
.setTimeout(timeout)
137139
.get(timeout);
138-
assertEquals(DocWriteResponse.Result.CREATED, response.getResult());
140+
assertThat(response.getResult(), isOneOf(CREATED, UPDATED));
139141
ackedDocs.put(id, node);
140142
logger.trace("[{}] indexed id [{}] through node [{}], response [{}]", name, id, node, response);
141143
} catch (ElasticsearchException e) {

0 commit comments

Comments
 (0)