office: wait for the doc-jobs sync in the Slice3 test
- Commit
8d4287f60b2bf779c35bb3eff84f5304e62585f4- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-08 02:12 UTC (28 days ago)
- Parents
23615f7
The Slice3 sync test read the crdt:doc-jobs key right after kicking off sync, racing the background sync slice on slower CI runners and flaking with a null read. Poll the key (bounded await) until the sync slice publishes it instead of asserting immediately. Verified: full :office:testDevUnitTest green on devserver.
Diff
office/src/test/java/com/vayunmathur/office/util/OfficeViewModelSyncSlice3Test.kt
diff --git a/office/src/test/java/com/vayunmathur/office/util/OfficeViewModelSyncSlice3Test.kt b/office/src/test/java/com/vayunmathur/office/util/OfficeViewModelSyncSlice3Test.ktindex ecce5cd5bd..a2c893c8b8 100644--- a/office/src/test/java/com/vayunmathur/office/util/OfficeViewModelSyncSlice3Test.kt+++ b/office/src/test/java/com/vayunmathur/office/util/OfficeViewModelSyncSlice3Test.kt@@ -674,7 +674,14 @@ class OfficeViewModelSyncSlice3Test { v.onLocalEdit() // The live-push job syncs via the unreachable relay and completes. v.livePushJob?.join()- assertTrue(realDs().getString("crdt:doc-jobs") != null)+ // saveTree commits through a suspending DataStore edit while+ // getString reads the asynchronously-updated mirror; on a loaded+ // box the mirror can lag the completed job, so wait for the+ // persisted tree to become visible instead of reading it once.+ assertTrue(+ await(12_000) { realDs().getString("crdt:doc-jobs") != null },+ "live-push job completed but no tree persisted",+ ) stopJobs(v) }