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 #9967

Closes #21658
This commit is contained in:
Boaz Leskes 2018-05-06 13:06:16 +02:00
parent d3ee35ef18
commit b46d01d409
1 changed files with 4 additions and 2 deletions

View File

@ -22,7 +22,6 @@ package org.elasticsearch.discovery;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.apache.lucene.index.CorruptIndexException;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.action.NoShardAvailableActionException;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
@ -61,10 +60,13 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static org.elasticsearch.action.DocWriteResponse.Result.CREATED;
import static org.elasticsearch.action.DocWriteResponse.Result.UPDATED;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isOneOf;
import static org.hamcrest.Matchers.not;
/**
@ -135,7 +137,7 @@ public class ClusterDisruptionIT extends AbstractDisruptionTestCase {
.setSource("{}", XContentType.JSON)
.setTimeout(timeout)
.get(timeout);
assertEquals(DocWriteResponse.Result.CREATED, response.getResult());
assertThat(response.getResult(), isOneOf(CREATED, UPDATED));
ackedDocs.put(id, node);
logger.trace("[{}] indexed id [{}] through node [{}], response [{}]", name, id, node, response);
} catch (ElasticsearchException e) {