Skip to content

Commit

Permalink
Fixed issues found during bug bash, and implemented tests (opensearch…
Browse files Browse the repository at this point in the history
…-project#240) (opensearch-project#245)

* Renamed FindingsDashboard/utils to FindingsDashboard/findingsUtils for clarity.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Removed an unused helper method. Refactored various helper methods to have default values. Refactored validation logic for doc level queries. Implemented unit tests for various doc level monitor functions.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Implemented FindingPopover snapshot test.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Implemented FindingFlyout snapshot test.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Refactored DocumentLevelTriggerExpression to require selections, and removed redundant code.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Implementing integration tests

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Implemented an example trigger condition for doc level monitors that are defined using the extraction query editor. Implemented additional form-reset logic when changing monitor types. Moved getDefaultScript to a separate helper class, and refactored the unit tests, to accommodate other monitor types.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Refactored actions component for doc level monitors to support configuration action execution options.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Refactored actions component to refresh the list of channels on blur.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Fixed a bug that was causing the finding flyout triggered by the alerts table to allow multiple flyouts to be open at once.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Removed development comment.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Fixed a bug that prevented sorting the performance preview for doc level monitors defined with the visual editor.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Fixed a bug that allowed doc level monitors to be defined with blank queries/tags when using the visual editor.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Refactored the backend formatting used for 'is not' queries.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Implemented additional integration tests.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Refactored the default notify option for doc level monitors.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Removed index creation step from test as ingesting data will perform that automatically.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>
(cherry picked from commit 0434b4f)

Co-authored-by: AWSHurneyt <hurneyt@amazon.com>
Signed-off-by: AWSHurneyt <hurneyt@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and AWSHurneyt committed Jun 10, 2022
1 parent 5cac5bd commit 107bd28
Show file tree
Hide file tree
Showing 38 changed files with 1,587 additions and 364 deletions.
113 changes: 113 additions & 0 deletions cypress/fixtures/sample_document_level_monitor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"type": "monitor",
"monitor_type": "doc_level_monitor",
"name": "sample_document_level_monitor",
"enabled": true,
"createdBy": "chip",
"schedule": {
"period": {
"interval": 1,
"unit": "MINUTES"
}
},
"inputs": [
{
"doc_level_input": {
"description": "windows-powershell",
"indices": ["document-level-monitor-test-index"],
"queries": [
{
"id": "sigma-123",
"name": "sigma-123",
"query": "region:\"us-west-2\"",
"tags": ["MITRE:8500"]
},
{
"id": "sigma-456",
"name": "sigma-456",
"query": "region:\"us-east-1\"",
"tags": ["MITRE:8600"]
},
{
"id": "sigma-789",
"name": "sigma-789",
"query": "message:\"This is an error from IAD region\"",
"tags": ["MITRE:8700"]
}
]
}
}
],
"triggers": [
{
"document_level_trigger": {
"name": "sample_trigger",
"severity": "1",
"condition": {
"script": {
"source": "query[name=sigma-123] || query[name=sigma-456] || query[name=sigma-789]",
"lang": "painless"
}
},
"actions": []
}
}
],
"ui_metadata": {
"schedule": {
"timezone": null,
"frequency": "interval",
"period": {
"interval": 1,
"unit": "MINUTES"
},
"daily": 0,
"weekly": {
"mon": false,
"tue": false,
"wed": false,
"thur": false,
"fri": false,
"sat": false,
"sun": false
},
"monthly": {
"type": "day",
"day": 1
},
"cronExpression": "0 */1 * * *"
},
"monitor_type": "doc_level_monitor",
"doc_level_input": {
"queries": [
{
"id": "sigma-123",
"queryName": "sigma-123",
"field": "region",
"operator": "==",
"query": "us-west-2",
"tags": ["MITRE:8500"]
},
{
"id": "sigma-456",
"queryName": "sigma-456",
"field": "region",
"operator": "==",
"query": "us-east-1",
"tags": ["MITRE:8600"]
},
{
"id": "sigma-789",
"queryName": "sigma-789",
"field": "message",
"operator": "==",
"query": "This is an error from IAD region",
"tags": ["MITRE:8700"]
}
]
},
"search": {
"searchType": "graph"
}
}
}
Loading

0 comments on commit 107bd28

Please sign in to comment.