diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/DocumentMonitorRunnerIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/DocumentMonitorRunnerIT.kt index e2e45d8a6..6be249ce8 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/DocumentMonitorRunnerIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/DocumentMonitorRunnerIT.kt @@ -47,7 +47,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val index = createTestIndex() - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -108,7 +108,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val index = createTestIndex() val docQuery = - DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf(), queryFieldNames = listOf("test_field")) + DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", queryFieldNames = listOf("test_field")) val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -154,7 +154,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val index = createTestIndex() val docQuery = - DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -199,7 +199,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val docQuery = DocLevelQuery( query = "test_field:\"us-west-2\"", name = "3", - fields = listOf(), + queryFieldNames = listOf("wrong_field") ) val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) @@ -253,7 +253,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val docQuery = DocLevelQuery( query = "test_field:\"us-west-2\"", name = "3", - fields = listOf(), + queryFieldNames = listOf("wrong_field") ) val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) @@ -301,7 +301,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val index = createTestIndex() val docQuery = - DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf(), queryFieldNames = listOf("test_field")) + DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", queryFieldNames = listOf("test_field")) val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -349,8 +349,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val docQuery = DocLevelQuery( query = "test_field:\"us-west-2\"", name = "3", - fields = listOf(), - queryFieldNames = listOf("wrong_field") + ) val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) @@ -399,7 +398,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { val docQuery = DocLevelQuery( query = "test_field:\"us-west-2\"", name = "3", - fields = listOf(), + queryFieldNames = listOf("wrong_field") ) val docLevelInput = DocLevelMonitorInput("description", listOf(index), listOf(docQuery)) @@ -491,7 +490,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { "test_field" : "us-west-2" }""" - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(testIndex), listOf(docQuery)) val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN) @@ -537,7 +536,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { "test_field" : "us-east-1" }""" - val docQuery2 = DocLevelQuery(query = "test_field:\"us-east-1\"", name = "3", fields = listOf()) + val docQuery2 = DocLevelQuery(query = "test_field:\"us-east-1\"", name = "3") val docLevelInput2 = DocLevelMonitorInput("description", listOf(testIndex2), listOf(docQuery2)) val trigger2 = randomDocumentLevelTrigger(condition = ALWAYS_RUN) @@ -630,7 +629,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { "test_field" : "us-west-2" }""" - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(testIndex), listOf(docQuery)) val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN) @@ -668,7 +667,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { "test_field" : "us-west-2" }""" - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(testIndex), listOf(docQuery)) val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN) @@ -960,7 +959,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { "test_field" : "us-west-2" }""" - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = testQueryName, fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = testQueryName) val docLevelInput = DocLevelMonitorInput("description", listOf("$testIndexPrefix*"), listOf(docQuery)) val trigger = randomDocumentLevelTrigger(condition = Script("query[name=$testQueryName]")) @@ -1839,7 +1838,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { false ) - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(dataStreamName), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -1891,7 +1890,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { false ) - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(dataStreamName), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -1953,7 +1952,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { """.trimIndent() ) - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf("$aliasName"), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -2028,7 +2027,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { rolloverDatastream(dataStreamName2) indexDoc(dataStreamName2, "0", testDoc) - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf("test-datastream*"), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) @@ -2102,7 +2101,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() { rolloverDatastream(dataStreamName) indexDoc(dataStreamName, "0", testDoc) - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(dataStreamName), listOf(docQuery)) val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id) diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorDataSourcesIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorDataSourcesIT.kt index 132bb3933..cc1e77778 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorDataSourcesIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorDataSourcesIT.kt @@ -375,20 +375,20 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() { val docQuery2 = DocLevelQuery( query = "source.ip.v6.v2:16645", name = "4", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docQuery3 = DocLevelQuery( query = "source.ip.v4.v0:120", name = "5", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docQuery4 = DocLevelQuery( query = "alias.some.fff:\"us-west-2\"", name = "6", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docQuery5 = DocLevelQuery( @@ -401,14 +401,14 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() { DocLevelQuery( query = "type.subtype:\"some subtype\"", name = "8", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docQuery7 = DocLevelQuery( query = "supertype.type:\"some type\"", name = "9", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docLevelInput = DocLevelMonitorInput( @@ -469,26 +469,26 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() { val docQuery1 = DocLevelQuery( query = "source.ip.v6.v1:12345", name = "3", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docQuery2 = DocLevelQuery( query = "source.ip.v6.v2:16645", name = "4", - fields = listOf(), + queryFieldNames = listOf("source.ip.v6.v2") ) val docQuery3 = DocLevelQuery( query = "source.ip.v4.v0:120", name = "5", - fields = listOf(), + queryFieldNames = listOf("source.ip.v6.v4") ) val docQuery4 = DocLevelQuery( query = "alias.some.fff:\"us-west-2\"", name = "6", - fields = listOf(), + queryFieldNames = listOf("alias.some.fff") ) val docQuery5 = DocLevelQuery( @@ -501,14 +501,12 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() { DocLevelQuery( query = "type.subtype:\"some subtype\"", name = "8", - fields = listOf(), queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docQuery7 = DocLevelQuery( query = "supertype.type:\"some type\"", name = "9", - fields = listOf(), queryFieldNames = listOf("alias.some.fff", "source.ip.v6.v1") ) val docLevelInput = DocLevelMonitorInput( diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/WorkflowRestApiIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/WorkflowRestApiIT.kt index a865c344d..22791b5aa 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/WorkflowRestApiIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/resthandler/WorkflowRestApiIT.kt @@ -1197,7 +1197,7 @@ class WorkflowRestApiIT : AlertingRestTestCase() { "test_field" : "us-west-2" }""" - val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf()) + val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3") val docLevelInput = DocLevelMonitorInput("description", listOf(testIndex), listOf(docQuery)) val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN)