Skip to content

Commit 7069477

Browse files
committed
Fix lint errors and Integration test
Signed-off-by: Tarun-kishore <[email protected]>
1 parent ca0416c commit 7069477

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/validation/ValidateRollover.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class ValidateRollover(
3131
if (skipRollover(indexName) || alreadyRolledOver(rolloverTarget, indexName)) return this
3232

3333
if (!isDataStream) {
34-
if (!hasAlias(rolloverTarget, indexName) || !isWriteIndex(rolloverTarget, indexName)
35-
) {
34+
if (!hasAlias(rolloverTarget, indexName) || !isWriteIndex(rolloverTarget, indexName)) {
3635
return this
3736
}
3837
}

src/main/kotlin/org/opensearch/indexmanagement/transform/util/TransformLockManager.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ class TransformLockManager(
104104
*/
105105
suspend fun renewLockForLongSearch(timeSpentOnSearch: Long) {
106106
// If the request was longer than 10 minutes and lock expires in less than 20 minutes, renew the lock just in case
107-
if (timeSpentOnSearch > TIMEOUT_UPPER_BOUND_IN_SECONDS && lockExpirationInSeconds() ?: 0 < MAXIMUM_LOCK_EXPIRATION_IN_SECONDS
108-
) {
107+
if (timeSpentOnSearch > TIMEOUT_UPPER_BOUND_IN_SECONDS && lockExpirationInSeconds() ?: 0 < MAXIMUM_LOCK_EXPIRATION_IN_SECONDS) {
109108
this.renewLockForScheduledJob()
110109
}
111110
}

src/test/kotlin/org/opensearch/indexmanagement/rollup/interceptor/RollupInterceptorIT.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,13 @@ class RollupInterceptorIT : RollupRestTestCase() {
392392
client().makeRequest("POST", "/target_rollup_search/_search", emptyMap(), StringEntity(req, ContentType.APPLICATION_JSON))
393393
fail("Expected 400 Method BAD_REQUEST response")
394394
} catch (e: ResponseException) {
395-
assertEquals(
395+
val errorMessage = (e.response.asMap() as Map<String, Map<String, Map<String, String>>>)["error"]!!["caused_by"]!!["reason"]!!
396+
assertTrue(
396397
"Wrong error message",
397-
"Could not find a rollup job that can answer this query because [missing field RateCodeID, missing field timestamp, " +
398-
"missing sum aggregation on total_amount]",
399-
(e.response.asMap() as Map<String, Map<String, Map<String, String>>>)["error"]!!["caused_by"]!!["reason"],
398+
errorMessage.startsWith("Could not find a rollup job that can answer this query because") == true &&
399+
errorMessage.contains("missing field RateCodeID") == true &&
400+
errorMessage.contains("missing field timestamp") == true &&
401+
errorMessage.contains("missing sum aggregation on total_amount") == true,
400402
)
401403
assertEquals("Unexpected status", RestStatus.BAD_REQUEST, e.response.restStatus())
402404
}

0 commit comments

Comments
 (0)