-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integ test: forcemerge and snapshot on leader during bootstrap
Signed-off-by: Sooraj Sinha <[email protected]>
- Loading branch information
Showing
4 changed files
with
130 additions
and
45 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/test/kotlin/com/amazon/elasticsearch/replication/IndexUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.amazon.elasticsearch.replication | ||
|
||
import org.apache.logging.log4j.LogManager | ||
import org.assertj.core.api.Assertions | ||
import org.elasticsearch.action.DocWriteResponse | ||
import org.elasticsearch.action.admin.indices.flush.FlushRequest | ||
import org.elasticsearch.action.index.IndexRequest | ||
import org.elasticsearch.client.RequestOptions | ||
import org.elasticsearch.client.RestHighLevelClient | ||
import org.elasticsearch.test.ESTestCase | ||
|
||
object IndexUtil { | ||
private val log = LogManager.getLogger(IndexUtil::class.java) | ||
|
||
fun fillIndex(clusterClient: RestHighLevelClient, | ||
indexName : String, | ||
nFields: Int, | ||
fieldLength: Int, | ||
stepSize: Int) { | ||
for (i in nFields downTo 1 step stepSize) { | ||
val sourceMap : MutableMap<String, String> = HashMap() | ||
for (j in stepSize downTo 1) | ||
sourceMap[(i-j).toString()] = ESTestCase.randomAlphaOfLength(fieldLength) | ||
log.info("Updating index with map of size:${sourceMap.size}") | ||
val indexResponse = clusterClient.index(IndexRequest(indexName).id(i.toString()).source(sourceMap), RequestOptions.DEFAULT) | ||
Assertions.assertThat(indexResponse.result).isIn(DocWriteResponse.Result.CREATED, DocWriteResponse.Result.UPDATED) | ||
} | ||
//flush the index | ||
clusterClient.indices().flush(FlushRequest(indexName), RequestOptions.DEFAULT) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters