Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Dec 5, 2022
1 parent e22d708 commit fe06f8c
Showing 1 changed file with 0 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,8 @@ package org.opensearch.observability.metrics
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertDoesNotThrow
import org.opensearch.observability.model.ObservabilityObjectType
import kotlin.test.assertEquals

internal class MetricsTests {
@Test
fun incrementCreateCounter() {
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.NOTEBOOK, Metrics.Action.CREATE)
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.APPLICATION, Metrics.Action.CREATE)
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.SAVED_QUERY, Metrics.Action.CREATE)
Metrics.incrementObservabilityObjectActionCounter(
ObservabilityObjectType.OPERATIONAL_PANEL,
Metrics.Action.CREATE
)
Metrics.incrementObservabilityObjectActionCounter(
ObservabilityObjectType.SAVED_VISUALIZATION,
Metrics.Action.CREATE
)
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.TIMESTAMP, Metrics.Action.CREATE)
assertEquals(Metrics.NOTEBOOK_CREATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.APPLICATION_CREATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.SAVED_QUERY_CREATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.OPERATIONAL_PANEL_CREATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.SAVED_VISUALIZATION_CREATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.TIMESTAMP_CREATE_TOTAL.counter.value, 1L)
}

@Test
fun incrementUpdateCounter() {
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.NOTEBOOK, Metrics.Action.UPDATE)
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.APPLICATION, Metrics.Action.UPDATE)
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.SAVED_QUERY, Metrics.Action.UPDATE)
Metrics.incrementObservabilityObjectActionCounter(
ObservabilityObjectType.OPERATIONAL_PANEL,
Metrics.Action.UPDATE
)
Metrics.incrementObservabilityObjectActionCounter(
ObservabilityObjectType.SAVED_VISUALIZATION,
Metrics.Action.UPDATE
)
Metrics.incrementObservabilityObjectActionCounter(ObservabilityObjectType.TIMESTAMP, Metrics.Action.UPDATE)
assertEquals(Metrics.NOTEBOOK_UPDATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.APPLICATION_UPDATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.SAVED_QUERY_UPDATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.OPERATIONAL_PANEL_UPDATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.SAVED_VISUALIZATION_UPDATE_TOTAL.counter.value, 1L)
assertEquals(Metrics.TIMESTAMP_UPDATE_TOTAL.counter.value, 1L)
}

@Test
fun testInvalidArguments() {
assertDoesNotThrow {
Expand Down

0 comments on commit fe06f8c

Please sign in to comment.