mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-10-04 18:33:49 +00:00
WebDAV cache: fix problem that sometimes the tests fail
This commit is contained in:
parent
09384948b5
commit
952a10fb3d
1
.github/workflows/test-dev.yml
vendored
1
.github/workflows/test-dev.yml
vendored
|
@ -53,6 +53,7 @@ jobs:
|
|||
- name: Run connected tests
|
||||
run: ./gradlew app:connectedCheck
|
||||
- name: Archive results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: test-results
|
||||
|
|
|
@ -41,9 +41,7 @@ class DiskCache(
|
|||
if (!cacheDir.mkdirs())
|
||||
throw IllegalArgumentException("Couldn't create cache in $cacheDir")
|
||||
|
||||
workerScope.launch {
|
||||
trim()
|
||||
}
|
||||
trim()
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class DiskCacheTest {
|
|||
|
||||
companion object {
|
||||
const val SOME_KEY = "key1"
|
||||
val SOME_VALUE_LENGTH = 15
|
||||
const val SOME_VALUE_LENGTH = 15
|
||||
val SOME_VALUE = ByteArray(SOME_VALUE_LENGTH) { it.toByte() }
|
||||
val SOME_OTHER_VALUE = ByteArray(30) { (it/2).toByte() }
|
||||
|
||||
|
@ -23,20 +23,19 @@ class DiskCacheTest {
|
|||
|
||||
@Rule
|
||||
@JvmField
|
||||
val cacheDir = TemporaryFolder()
|
||||
val tempDir = TemporaryFolder()
|
||||
|
||||
lateinit var cache: DiskCache
|
||||
|
||||
|
||||
@Before
|
||||
fun createCache() {
|
||||
cacheDir.create()
|
||||
cache = DiskCache(cacheDir.newFolder(), MAX_CACHE_SIZE)
|
||||
cache = DiskCache(tempDir.newFolder(), MAX_CACHE_SIZE)
|
||||
}
|
||||
|
||||
@After
|
||||
fun deleteCache() {
|
||||
cacheDir.delete()
|
||||
assertTrue(cache.cacheDir.deleteRecursively())
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +113,11 @@ class DiskCacheTest {
|
|||
|
||||
@Test
|
||||
fun testTrim() {
|
||||
assertEquals(0, cache.entries())
|
||||
|
||||
cache.get(SOME_KEY) { SOME_VALUE }
|
||||
assertEquals(1, cache.entries())
|
||||
|
||||
cache.trim()
|
||||
assertEquals(1, cache.entries())
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit cca734af166e3040c9709b3d01ed68654846c9bf
|
||||
Subproject commit 5245bc91ca17d789cd826ed716aeebeb814485a7
|
Loading…
Reference in a new issue