Skip to content

Commit

Permalink
[Test] increase the wait time after transform job triggered (opensear…
Browse files Browse the repository at this point in the history
…ch-project#999)

Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Oct 11, 2023
1 parent f9e75c0 commit cb783ca
Showing 1 changed file with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.opensearch.indexmanagement.transform.avgAggregation
import org.opensearch.indexmanagement.transform.maxAggregation
import org.opensearch.indexmanagement.transform.minAggregation
import org.opensearch.indexmanagement.transform.model.ISMTransform
import org.opensearch.indexmanagement.transform.model.Transform
import org.opensearch.indexmanagement.transform.model.TransformMetadata
import org.opensearch.indexmanagement.transform.sumAggregation
import org.opensearch.indexmanagement.transform.valueCountAggregation
Expand Down Expand Up @@ -274,6 +275,8 @@ class TransformActionIT : IndexStateManagementRestTestCase() {

updateTransformStartTime(transform)

assertTransformCompleted(transform)

// Change the start time so that the transform action will be attempted.
updateManagedIndexConfigStartTime(managedIndexConfig)
waitFor {
Expand All @@ -282,13 +285,6 @@ class TransformActionIT : IndexStateManagementRestTestCase() {
getExplainManagedIndexMetaData(indexName).info?.get("message")
)
}

val transformJob = getTransform(transformId = transformId)
waitFor {
assertNotNull("Transform job doesn't have metadata set", transformJob.metadataId)
val transformMetadata = getTransformMetadata(transformJob.metadataId!!)
assertEquals("Transform is not finished", TransformMetadata.Status.FINISHED, transformMetadata.status)
}
}

private fun assertIndexTransformSucceededTwice(indexName: String, policyId: String, ismTransform: ISMTransform) {
Expand All @@ -308,7 +304,8 @@ class TransformActionIT : IndexStateManagementRestTestCase() {
getExplainManagedIndexMetaData(indexName).info?.get("message")
)
}
updateTransformStartTime(transform)

assertTransformCompleted(transform)

// Change the start time so that the transform action will be attempted.
updateManagedIndexConfigStartTime(managedIndexConfig)
Expand All @@ -319,13 +316,6 @@ class TransformActionIT : IndexStateManagementRestTestCase() {
)
}

var transformJob = getTransform(transformId = transformId)
waitFor {
assertNotNull("Transform job doesn't have metadata set", transformJob.metadataId)
val transformMetadata = getTransformMetadata(transformJob.metadataId!!)
assertEquals("Transform is not finished", TransformMetadata.Status.FINISHED, transformMetadata.status)
}

// Change the start time so that the transition attempted.
updateManagedIndexConfigStartTime(managedIndexConfig)
waitFor {
Expand All @@ -343,7 +333,8 @@ class TransformActionIT : IndexStateManagementRestTestCase() {
getExplainManagedIndexMetaData(indexName).info?.get("message")
)
}
updateTransformStartTime(transform)

assertTransformCompleted(transform)

// Change the start time so that the second transform action will be attempted.
updateManagedIndexConfigStartTime(managedIndexConfig)
Expand All @@ -353,9 +344,12 @@ class TransformActionIT : IndexStateManagementRestTestCase() {
getExplainManagedIndexMetaData(indexName).info?.get("message")
)
}
}

transformJob = getTransform(transformId = transformId)
waitFor {
private fun assertTransformCompleted(transform: Transform) {
updateTransformStartTime(transform)
waitFor(timeout = Instant.ofEpochSecond(60)) {
val transformJob = getTransform(transformId = transform.id)
assertNotNull("Transform job doesn't have metadata set", transformJob.metadataId)
val transformMetadata = getTransformMetadata(transformJob.metadataId!!)
assertEquals("Transform is not finished", TransformMetadata.Status.FINISHED, transformMetadata.status)
Expand Down

0 comments on commit cb783ca

Please sign in to comment.