-
-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathCacheSystemTest.kt
More file actions
51 lines (39 loc) · 1.34 KB
/
CacheSystemTest.kt
File metadata and controls
51 lines (39 loc) · 1.34 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
50
51
package io.sentry.systemtest
import io.sentry.systemtest.util.TestHelper
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.Before
class CacheSystemTest {
lateinit var testHelper: TestHelper
@Before
fun setup() {
testHelper = TestHelper("http://localhost:8080")
testHelper.reset()
}
@Test
fun `cache put and get produce spans`() {
val restClient = testHelper.restClient
// Save a todo (triggers @CachePut -> cache.put span)
val todo = Todo(1L, "test-todo", false)
restClient.saveCachedTodo(todo)
assertEquals(200, restClient.lastKnownStatusCode)
testHelper.ensureTransactionReceived { transaction, _ ->
testHelper.doesTransactionContainSpanWithOp(transaction, "cache.put")
}
testHelper.reset()
// Get the todo (triggers @Cacheable -> cache.get span, should be a hit)
restClient.getCachedTodo(1L)
assertEquals(200, restClient.lastKnownStatusCode)
testHelper.ensureTransactionReceived { transaction, _ ->
testHelper.doesTransactionContainSpanWithOp(transaction, "cache.get")
}
}
@Test
fun `cache evict produces span`() {
val restClient = testHelper.restClient
restClient.deleteCachedTodo(1L)
testHelper.ensureTransactionReceived { transaction, _ ->
testHelper.doesTransactionContainSpanWithOp(transaction, "cache.evict")
}
}
}