mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
fix: harden diagnostic staging lifecycle
This commit is contained in:
1 parent
11c0763fba
commit
dfc0fd4340
4 files changed
+132
-18
No files matched your search
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.session
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.UUID
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.zip.ZipFile
|
||||
@@ -26,6 +27,18 @@ class SessionLogShareZipTest {
|
||||
|
||||
@After fun resetSourceOpener() = resetSecureSourceOpener()
|
||||
|
||||
@Test fun startupRemovesAbandonedDiagnosticStagesAndPreservesActiveSnapshots() {
|
||||
val abandoned = File(app.cacheDir, "share-${UUID.randomUUID()}.diagnostic-stage").apply { mkdirs() }
|
||||
val active = EnhancedSessionLogShare.acquireDiagnosticStage(app, "share")
|
||||
try {
|
||||
EnhancedSessionLogShare.cleanupAbandonedStages(app)
|
||||
assertFalse(abandoned.exists())
|
||||
assertTrue(active.directory.isDirectory)
|
||||
} finally {
|
||||
active.close()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun anArchiveCanBeWrittenOutsideTheShareFolder() {
|
||||
SessionLogShare.clear(app)
|
||||
val session = File(LinuxRuntime.logDir(app), "2026-11-03-01-steam").apply { mkdirs() }
|
||||
|
||||
Reference in new issue
Block a user