test(store): migration harness, restore path and a 5k-task check
Phase 6 of docs/OWN-STORE.md. MigrationTestHelper is wired against the committed v1 schema, so the first real migration only has to add its own case; the class KDoc says where it goes. app/schemas/ is added to the androidTest assets — the schema location comes from the KSP arg, not the Room Gradle plugin, so nothing wired the test assets automatically. The restore tests state the WAL premise directly rather than around it: a backup of the .db alone must lose whatever is still in the -wal, carrying the sidecars must keep it, and checkpointing first must make the .db alone sufficient. If the premise is wrong the first test fails instead of passing vacuously. Performance: 5,000 tasks and 20 FREQ=DAILY series — daily on purpose, so the per-series occurrence cap is the case being measured — through one full smart-list read. The ceiling is loose and the numbers are printed, because nobody has run this on hardware yet. Also fixes a lint error I introduced in the backup rules two commits ago. Naming any <include> makes everything else excluded by default, so the <exclude> for tasks.db.imported sat under no included path and FullBackupContent rejected it — lintDebug has been failing at HEAD since, and CI runs it. The same defect had a second, quieter half: those explicit includes had silently stopped DataStore being backed up at all, since it was only ever covered by the old file's "everything by default". Settings are listed back in explicitly.
This commit is contained in:
@@ -129,6 +129,10 @@ android {
|
||||
isReturnDefaultValues = true
|
||||
}
|
||||
}
|
||||
|
||||
// MigrationTestHelper reads the exported schemas out of the test APK's
|
||||
// assets, so app/schemas/ has to ship with the instrumented tests.
|
||||
sourceSets.getByName("androidTest").assets.srcDir("$projectDir/schemas")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -203,6 +207,7 @@ dependencies {
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
androidTestImplementation(libs.androidx.test.rules)
|
||||
androidTestImplementation(libs.truth)
|
||||
androidTestImplementation(libs.androidx.room.testing)
|
||||
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user