Skip to content

Commit

Permalink
Revert "[Backport 2.11] Backport #1240 and #1276 to 2.11 (#1286)" (#1313
Browse files Browse the repository at this point in the history
)

This reverts commit c00c86d.

Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
  • Loading branch information
eirsep authored Nov 28, 2023
1 parent 7a398eb commit c41858e
Show file tree
Hide file tree
Showing 13 changed files with 193 additions and 231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class DocLevelMonitorQueries(private val client: Client, private val clusterServ
.id(it.id + "_$monitorId")
.source(
mapOf(
"query" to mapOf("query_string" to mapOf("query" to query, "fields" to it.fields)),
"query" to mapOf("query_string" to mapOf("query" to query)),
"monitor_id" to monitorId,
"index" to sourceIndex
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dynamic": "strict",
"_meta" : {
"schema_version": 4
"schema_version": 3
},
"properties": {
"schema_version": {
Expand Down Expand Up @@ -46,9 +46,6 @@
"type" : "keyword"
}
}
},
"fields": {
"type": "text"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,7 @@ abstract class AlertingRestTestCase : ODFERestTestCase() {
monitorId: String = "NO_ID",
monitorName: String = "NO_NAME",
index: String = "testIndex",
docLevelQueries: List<DocLevelQuery> = listOf(
DocLevelQuery(query = "test_field:\"us-west-2\"", name = "testQuery", fields = listOf())
),
docLevelQueries: List<DocLevelQuery> = listOf(DocLevelQuery(query = "test_field:\"us-west-2\"", name = "testQuery")),
matchingDocIds: List<String>,
): String {
val finding = Finding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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)
Expand Down Expand Up @@ -84,7 +84,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)
Expand Down Expand Up @@ -116,7 +116,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)
Expand Down Expand Up @@ -156,7 +156,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {
"test_field" : "us-west-2"
}"""

val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", tags = listOf("test_tag"), fields = listOf())
val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", tags = listOf("test_tag"))
val docLevelInput = DocLevelMonitorInput("description", listOf(testIndex), listOf(docQuery))

val trigger = randomDocumentLevelTrigger(condition = Script("query[tag=test_tag]"))
Expand Down Expand Up @@ -196,7 +196,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {
"test_field" : "us-west-2"
}"""

val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", tags = listOf("test_tag"), fields = listOf())
val docQuery = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", tags = listOf("test_tag"))
val docLevelInput = DocLevelMonitorInput("description", listOf(testIndex), listOf(docQuery))

val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN)
Expand Down Expand Up @@ -227,7 +227,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 alertCategories = AlertCategory.values()
Expand Down Expand Up @@ -295,7 +295,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 actionExecutionScope = PerExecutionActionScope()
Expand Down Expand Up @@ -362,7 +362,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]"))
Expand Down Expand Up @@ -406,7 +406,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {
"test_field" : "us-west-2"
}"""

val docQuery = DocLevelQuery(query = "NOT (test_field:\"us-west-1\")", name = testQueryName, fields = listOf())
val docQuery = DocLevelQuery(query = "NOT (test_field:\"us-west-1\")", name = testQueryName)
val docLevelInput = DocLevelMonitorInput("description", listOf("$testIndexPrefix*"), listOf(docQuery))

val trigger = randomDocumentLevelTrigger(condition = Script("query[name=$testQueryName]"))
Expand Down Expand Up @@ -447,7 +447,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("test*"), listOf(docQuery))

val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN)
Expand Down Expand Up @@ -532,13 +532,11 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {

val docQuery1 = DocLevelQuery(
query = "(source.device.port:12345 AND test_field:12345) OR source.device.hwd.id:12345",
name = "4",
fields = listOf()
name = "4"
)
val docQuery2 = DocLevelQuery(
query = "(source.device.port:\"12345\" AND test_field:\"12345\") OR source.device.hwd.id:\"12345\"",
name = "5",
fields = listOf()
name = "5"
)
val docLevelInput = DocLevelMonitorInput("description", listOf("test*"), listOf(docQuery1, docQuery2))

Expand Down Expand Up @@ -670,8 +668,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {

val docQuery = DocLevelQuery(
query = "nested_field.test1:\"12345\"",
name = "5",
fields = listOf()
name = "5"
)
val docLevelInput = DocLevelMonitorInput("description", listOf("test*"), listOf(docQuery))

Expand Down Expand Up @@ -757,8 +754,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {

val docQuery = DocLevelQuery(
query = "test_field:\"12345\" AND source.id:\"12345\"",
name = "5",
fields = listOf()
name = "5"
)
val docLevelInput = DocLevelMonitorInput("description", listOf("test*"), listOf(docQuery))

Expand Down Expand Up @@ -874,13 +870,11 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {

val docQuery1 = DocLevelQuery(
query = "test_field:\"12345\"",
name = "4",
fields = listOf()
name = "4"
)
val docQuery2 = DocLevelQuery(
query = "source.device.hwd.id:\"12345\"",
name = "5",
fields = listOf()
name = "5"
)

val docLevelInput = DocLevelMonitorInput("description", listOf("test*"), listOf(docQuery1, docQuery2))
Expand Down Expand Up @@ -927,7 +921,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("test*"), listOf(docQuery))

val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN)
Expand Down Expand Up @@ -976,8 +970,8 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {
"test_field" : "us-west-2"
}"""

val docQuery1 = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3", fields = listOf())
val docQuery2 = DocLevelQuery(query = "test_field_new:\"us-west-2\"", name = "4", fields = listOf())
val docQuery1 = DocLevelQuery(query = "test_field:\"us-west-2\"", name = "3")
val docQuery2 = DocLevelQuery(query = "test_field_new:\"us-west-2\"", name = "4")
val docLevelInput = DocLevelMonitorInput("description", listOf("test*"), listOf(docQuery1, docQuery2))

val trigger = randomDocumentLevelTrigger(condition = ALWAYS_RUN)
Expand Down Expand Up @@ -1239,7 +1233,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 alertCategories = AlertCategory.values()
Expand Down Expand Up @@ -1286,7 +1280,7 @@ class DocumentMonitorRunnerIT : AlertingRestTestCase() {
val index4 = createTestIndex()
val index5 = createTestIndex()

val docQuery = DocLevelQuery(query = "\"us-west-2\"", name = "3", fields = listOf())
val docQuery = DocLevelQuery(query = "\"us-west-2\"", name = "3")
var docLevelInput = DocLevelMonitorInput("description", listOf(index1, index2, index4, index5), listOf(docQuery))

val action = randomAction(template = randomTemplateScript("Hello {{ctx.monitor.name}}"), destinationId = createDestination().id)
Expand Down Expand Up @@ -1334,7 +1328,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 alertCategories = AlertCategory.values()
Expand Down
Loading

0 comments on commit c41858e

Please sign in to comment.