Skip to content

Commit

Permalink
delete old integ test
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnaksaxena committed Jul 19, 2023
1 parent 975ecba commit ebc3d46
Showing 1 changed file with 0 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,59 +633,6 @@ class RolloverActionIT : IndexStateManagementRestTestCase() {
assertTrue("New rollover index does not exist.", indexExists("$indexNameBase-000002"))
}

fun `test rollover fails if metadata was not updated and is not a transient failure`() {
val aliasName = "${testIndexName}_alias"
val indexNameBase = "${testIndexName}_index"
val firstIndex = "$indexNameBase-1"
val policyID = "${testIndexName}_testPolicyName_1"
val actionConfig = RolloverAction(null, 0, null, null, 0)
val states = listOf(State(name = "RolloverAction", actions = listOf(actionConfig), transitions = listOf()))
val policy = Policy(
id = policyID,
description = "$testIndexName description",
schemaVersion = 1L,
lastUpdatedTime = Instant.now().truncatedTo(ChronoUnit.MILLIS),
errorNotification = randomErrorNotification(),
defaultState = states[0].name,
states = states
)

createPolicy(policy, policyID)
// create index defaults
createIndex(firstIndex, policyID, aliasName)

val managedIndexConfig = getExistingManagedIndexConfig(firstIndex)

// Change the start time so the job will trigger in 2 seconds, this will trigger the first initialization of the policy
updateManagedIndexConfigStartTime(managedIndexConfig)
waitFor { assertEquals(policyID, getExplainManagedIndexMetaData(firstIndex).policyID) }

// Need to speed up to second execution where it will trigger the first execution of the action
updateManagedIndexConfigStartTime(managedIndexConfig)
waitFor {
val info = getExplainManagedIndexMetaData(firstIndex).info as Map<String, Any?>
assertEquals("Index did not rollover.", AttemptRolloverStep.getSuccessMessage(firstIndex), info["message"])
}
Assert.assertTrue("New rollover index does not exist.", indexExists("$indexNameBase-000002"))
// Updating managed index metadata step status to "starting" to reproduce bug
waitFor {
val response = client().makeRequest(
"POST", ".opendistro-ism-config/_update/${managedIndexConfig.id}%23metadata",
StringEntity(
"{\"script\":{\"managed_index\": \"ctx._source.managed_index_metadata.step.step_status = params.step_status\"," +
"\"lang\": \"painless\", \"params\": {\"step_status\": \"starting\"}}}",
ContentType.APPLICATION_JSON
)
)
assertEquals("Request failed", RestStatus.OK, response.restStatus())
}
// Should reproduce bug "Previous action was not able to update IndexMetaData."
updateManagedIndexConfigStartTime(managedIndexConfig)
waitFor {
val info = getExplainManagedIndexMetaData(firstIndex).info as Map<String, Any?>
assertEquals("Index did not rollover.", "Previous action was not able to update IndexMetaData.", info["message"])
}
}
fun `test rollover detects transient failure and continues executing`() {
val aliasName = "${testIndexName}_alias"
val indexNameBase = "${testIndexName}_index"
Expand Down

0 comments on commit ebc3d46

Please sign in to comment.