-
-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathMetricsSystemTest.kt
More file actions
49 lines (40 loc) · 1.36 KB
/
MetricsSystemTest.kt
File metadata and controls
49 lines (40 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package io.sentry.systemtest
import io.sentry.systemtest.util.TestHelper
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.Before
class MetricsSystemTest {
lateinit var testHelper: TestHelper
@Before
fun setup() {
testHelper = TestHelper("http://localhost:8080")
testHelper.reset()
}
@Test
fun `count metric`() {
val restClient = testHelper.restClient
assertEquals("count metric increased", restClient.getCountMetric())
assertEquals(200, restClient.lastKnownStatusCode)
testHelper.ensureMetricsReceived { event, header ->
testHelper.doesContainMetric(event, "countMetric", "counter", 1.0)
}
}
@Test
fun `gauge metric`() {
val restClient = testHelper.restClient
assertEquals("gauge metric tracked", restClient.getGaugeMetric(14))
assertEquals(200, restClient.lastKnownStatusCode)
testHelper.ensureMetricsReceived { event, header ->
testHelper.doesContainMetric(event, "memory.free", "gauge", 14.0)
}
}
@Test
fun `distribution metric`() {
val restClient = testHelper.restClient
assertEquals("distribution metric tracked", restClient.getDistributionMetric(23))
assertEquals(200, restClient.lastKnownStatusCode)
testHelper.ensureMetricsReceived { event, header ->
testHelper.doesContainMetric(event, "distributionMetric", "distribution", 23.0)
}
}
}