Fix flakyness in SmallFileBackupIntegrationTest

This commit is contained in:
Torsten Grote 2024-03-08 10:36:18 -03:00 committed by Chirayu Desai
parent 6caa01f8c5
commit fef6ecc640

View file

@ -77,7 +77,6 @@ internal class SmallFileBackupIntegrationTest {
val outputStream2 = ByteArrayOutputStream()
val chunkId = Random.nextBytes(KEY_SIZE_BYTES)
val cachedChunk = CachedChunk(chunkId.toHexString(), 0, 181, 0)
val cachedFile2 = file2.toCachedFile(listOf(chunkId.toHexString()), 1)
val backupFile = file2.toBackupFile(cachedFile2.chunks, cachedFile2.zipIndex)
@ -93,7 +92,14 @@ internal class SmallFileBackupIntegrationTest {
every { mac.doFinal(any<ByteArray>()) } returns chunkId
every { chunksCache.get(any()) } returns null
every { storagePlugin.getChunkOutputStream(any()) } returns outputStream2
every { chunksCache.insert(cachedChunk) } just Runs
every {
chunksCache.insert(match<CachedChunk> { cachedChunk ->
cachedChunk.id == chunkId.toHexString() &&
cachedChunk.refCount == 0L &&
cachedChunk.size <= outputStream2.size() &&
cachedChunk.version == 0.toByte()
})
} just Runs
every {
filesCache.upsert(match {
it.copy(lastSeen = cachedFile2.lastSeen) == cachedFile2