Skip to content

Commit

Permalink
fix multi-node test failures (#1588)
Browse files Browse the repository at this point in the history
Signed-off-by: Subhobrata Dey <sbcd90@gmail.com>
  • Loading branch information
sbcd90 committed Jul 1, 2024
1 parent 22c5a29 commit 6685efd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import org.opensearch.cluster.routing.ShardRouting
import org.opensearch.cluster.service.ClusterService
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
import org.opensearch.commons.alerting.model.ActionRunResult
import org.opensearch.commons.alerting.model.DocLevelMonitorInput
import org.opensearch.commons.alerting.model.DocumentLevelTriggerRunResult
import org.opensearch.commons.alerting.model.InputRunResults
import org.opensearch.commons.alerting.model.Monitor
Expand Down Expand Up @@ -53,7 +52,7 @@ class RemoteDocumentLevelMonitorRunner : MonitorRunner() {
try {
validate(monitor)
} catch (e: Exception) {
logger.error("Failed to start Document-level-monitor. Error: ${e.message}")
logger.error("Failed to start Document-level-monitor. Error: $e")
monitorResult = monitorResult.copy(error = AlertingException.wrap(e))
}

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

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

if ((monitor.inputs[0] as DocLevelMonitorInput).indices.isEmpty()) {
if ((monitor.inputs[0] as RemoteDocLevelMonitorInput).docLevelMonitorInput.indices.isEmpty()) {
throw IllegalArgumentException("DocLevelMonitorInput has no indices")
}
}
Expand Down
2 changes: 0 additions & 2 deletions sample-remote-monitor-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
// Needed for integ tests
zipArchive group: 'org.opensearch.plugin', name:'alerting', version: "${opensearch_build}"
}

def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import org.opensearch.cluster.service.ClusterService
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutAction
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutRequest
import org.opensearch.commons.alerting.action.DocLevelMonitorFanOutResponse
import org.opensearch.commons.alerting.model.*
import org.opensearch.commons.alerting.model.IndexExecutionContext
import org.opensearch.commons.alerting.model.Monitor
import org.opensearch.commons.alerting.model.MonitorMetadata
import org.opensearch.commons.alerting.model.MonitorRunResult
import org.opensearch.commons.alerting.model.TriggerRunResult
import org.opensearch.commons.alerting.model.WorkflowRunContext
import org.opensearch.commons.alerting.util.AlertingException
import org.opensearch.core.action.ActionListener
import org.opensearch.core.common.breaker.CircuitBreakingException
Expand Down Expand Up @@ -85,7 +90,16 @@ open class RemoteMonitorRunner {
dryrun,
monitorMetadata,
executionId,
indexExecutionContext = null,
indexExecutionContext = IndexExecutionContext(
listOf(),
mutableMapOf(),
mutableMapOf(),
"",
"",
listOf(),
listOf(),
listOf()
),
nodeShardAssignments[node.key]!!.toList(),
concreteIndices,
workflowRunContext
Expand Down

0 comments on commit 6685efd

Please sign in to comment.