-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Issue opensearch-project/alerting#200 Signed-off-by: Petar Partlov <p.partlov@paysend.com>
- Loading branch information
Petar Partlov
committed
Nov 10, 2022
1 parent
5fd25b0
commit 7cba7ae
Showing
10 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/test/kotlin/org/opensearch/commons/alerting/model/MonitorsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.opensearch.commons.alerting.model | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
import org.opensearch.commons.alerting.randomQueryLevelMonitor | ||
import org.opensearch.commons.alerting.util.IndexUtils | ||
|
||
class MonitorsTest { | ||
|
||
@Test | ||
fun `test monitor asTemplateArgs`() { | ||
val monitor = randomQueryLevelMonitor() | ||
|
||
val templateArgs = monitor.asTemplateArg() | ||
|
||
assertEquals(monitor.id, templateArgs[IndexUtils._ID], "Template arg field 'id' doesn't match") | ||
assertEquals( | ||
monitor.version, templateArgs[IndexUtils._VERSION], "Template arg field 'version' doesn't match" | ||
) | ||
assertEquals(monitor.name, templateArgs[Monitor.NAME_FIELD], "Template arg field 'name' doesn't match") | ||
assertEquals( | ||
monitor.enabled, templateArgs[Monitor.ENABLED_FIELD], "Template arg field 'enabled' doesn't match" | ||
) | ||
assertEquals( | ||
monitor.monitorType.toString(), templateArgs[Monitor.MONITOR_TYPE_FIELD], | ||
"Template arg field 'monitoryType' doesn't match" | ||
) | ||
} | ||
} |