Skip to content

Commit

Permalink
Merge branch 'main' into add-more-error-notification
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenlan-amzn committed Oct 11, 2023
2 parents f0c2c67 + 2241a29 commit b5b987c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ object ManagedIndexRunner :
val indexResponse: UpdateResponse = client.suspendUntil { update(indexRequest, it) }
if (indexResponse.status() != RestStatus.OK) {
logger.error("Failed to disable ManagedIndexConfig(${managedIndexConfig.index}) Error : indexResponse.status()")
} else {
logger.info("Successfully disabled ISM job for [${managedIndexConfig.index}]")
}
} catch (e: Exception) {
logger.error("Failed to disable ManagedIndexConfig(${managedIndexConfig.index})", e)
Expand Down
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 b5b987c

Please sign in to comment.