Skip to content

Commit e911c73

Browse files
committed
added test for alias in target_index
Signed-off-by: Petar Dzepina <petar.dzepina@gmail.com>
1 parent a20ab93 commit e911c73

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/test/kotlin/org/opensearch/indexmanagement/rollup/runner/RollupRunnerIT.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ class RollupRunnerIT : RollupRestTestCase() {
774774
)
775775
).let { createRollup(it, it.id) }
776776

777+
// First run, backing index is empty: no mappings, no rollup_index setting, no rollupjobs in _META
777778
updateRollupStartTime(rollup)
778779

779780
waitFor { assertTrue("Target rollup index was not created", indexExists(backingIndex)) }
@@ -785,13 +786,18 @@ class RollupRunnerIT : RollupRestTestCase() {
785786
assertEquals("Rollup is not finished", RollupMetadata.Status.FINISHED, rollupMetadata.status)
786787
rollupJob
787788
}
789+
var rollupMetadataID = startedRollup.metadataID!!
790+
var rollupMetadata = getRollupMetadata(rollupMetadataID)
791+
assertEquals("Did not process any doc during rollup", rollupMetadata.stats.documentsProcessed > 0)
788792

789793
// restart job
790794
client().makeRequest(
791795
"PUT",
792796
"$ROLLUP_JOBS_BASE_URI/${startedRollup.id}?if_seq_no=${startedRollup.seqNo}&if_primary_term=${startedRollup.primaryTerm}",
793797
emptyMap(), rollup.copy(enabled = true).toHttpEntity()
794798
)
799+
// Second run, backing index is setup just like any other rollup index
800+
updateRollupStartTime(rollup)
795801

796802
startedRollup = waitFor {
797803
val rollupJob = getRollup(rollupId = rollup.id)
@@ -801,11 +807,12 @@ class RollupRunnerIT : RollupRestTestCase() {
801807
rollupJob
802808
}
803809

804-
val rollupMetadataID = startedRollup.metadataID!!
805-
val rollupMetadata = getRollupMetadata(rollupMetadataID)
810+
rollupMetadataID = startedRollup.metadataID!!
811+
rollupMetadata = getRollupMetadata(rollupMetadataID)
812+
813+
assertEquals("Did not process any doc during rollup", rollupMetadata.stats.documentsProcessed > 0)
814+
806815

807-
// Randomly choosing 100.. if it didn't work we'd either fail hitting the timeout in waitFor or we'd have thousands of pages processed
808-
assertTrue("Did not have less than 100 pages processed", rollupMetadata.stats.documentsProcessed > 0)
809816
}
810817

811818
// TODO: Test scenarios:

0 commit comments

Comments
 (0)