Skip to content

Commit 6685efd

Browse files
authored
fix multi-node test failures (opensearch-project#1588)
Signed-off-by: Subhobrata Dey <[email protected]>
1 parent 22c5a29 commit 6685efd

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

alerting/src/main/kotlin/org/opensearch/alerting/remote/monitors/RemoteDocumentLevelMonitorRunner.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import org.opensearch.cluster.routing.ShardRouting
1818
import org.opensearch.cluster.service.ClusterService
1919
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
2020
import org.opensearch.commons.alerting.model.ActionRunResult
21-
import org.opensearch.commons.alerting.model.DocLevelMonitorInput
2221
import org.opensearch.commons.alerting.model.DocumentLevelTriggerRunResult
2322
import org.opensearch.commons.alerting.model.InputRunResults
2423
import org.opensearch.commons.alerting.model.Monitor
@@ -53,7 +52,7 @@ class RemoteDocumentLevelMonitorRunner : MonitorRunner() {
5352
try {
5453
validate(monitor)
5554
} catch (e: Exception) {
56-
logger.error("Failed to start Document-level-monitor. Error: ${e.message}")
55+
logger.error("Failed to start Document-level-monitor. Error: $e")
5756
monitorResult = monitorResult.copy(error = AlertingException.wrap(e))
5857
}
5958

@@ -199,11 +198,11 @@ class RemoteDocumentLevelMonitorRunner : MonitorRunner() {
199198
throw IOException("Only one input is supported with remote document-level-monitor.")
200199
}
201200

202-
if (monitor.inputs[0].name() != DocLevelMonitorInput.DOC_LEVEL_INPUT_FIELD) {
201+
if (monitor.inputs[0].name() != RemoteDocLevelMonitorInput.REMOTE_DOC_LEVEL_MONITOR_INPUT_FIELD) {
203202
throw IOException("Invalid input with remote document-level-monitor.")
204203
}
205204

206-
if ((monitor.inputs[0] as DocLevelMonitorInput).indices.isEmpty()) {
205+
if ((monitor.inputs[0] as RemoteDocLevelMonitorInput).docLevelMonitorInput.indices.isEmpty()) {
207206
throw IllegalArgumentException("DocLevelMonitorInput has no indices")
208207
}
209208
}

sample-remote-monitor-plugin/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ dependencies {
4444
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
4545
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
4646
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
47-
// Needed for integ tests
48-
zipArchive group: 'org.opensearch.plugin', name:'alerting', version: "${opensearch_build}"
4947
}
5048

5149
def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile

spi/src/main/kotlin/org/opensearch/alerting/spi/RemoteMonitorRunner.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import org.opensearch.cluster.service.ClusterService
1212
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutAction
1313
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutRequest
1414
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
15-
import org.opensearch.commons.alerting.model.*
15+
import org.opensearch.commons.alerting.model.IndexExecutionContext
16+
import org.opensearch.commons.alerting.model.Monitor
17+
import org.opensearch.commons.alerting.model.MonitorMetadata
18+
import org.opensearch.commons.alerting.model.MonitorRunResult
19+
import org.opensearch.commons.alerting.model.TriggerRunResult
20+
import org.opensearch.commons.alerting.model.WorkflowRunContext
1621
import org.opensearch.commons.alerting.util.AlertingException
1722
import org.opensearch.core.action.ActionListener
1823
import org.opensearch.core.common.breaker.CircuitBreakingException
@@ -85,7 +90,16 @@ open class RemoteMonitorRunner {
8590
dryrun,
8691
monitorMetadata,
8792
executionId,
88-
indexExecutionContext = null,
93+
indexExecutionContext = IndexExecutionContext(
94+
listOf(),
95+
mutableMapOf(),
96+
mutableMapOf(),
97+
"",
98+
"",
99+
listOf(),
100+
listOf(),
101+
listOf()
102+
),
89103
nodeShardAssignments[node.key]!!.toList(),
90104
concreteIndices,
91105
workflowRunContext

0 commit comments

Comments
 (0)