Skip to content

Commit cd3536d

Browse files
tmmampagent
andauthored
test(zero-swift): wait for the deleted jump row's successor, not 2 s (#192)
theRowAJumpLandedOnIsDeleted gave the delete a fixed 2 s of wall-clock time to reach the list. That takes several turns of the main actor, which the other @mainactor suites share; HardenStorageTests' busy-write tests hold it for seconds at a time (SQLite's 5 s busy timeout). When such a stall covered the window, the test woke after it and read the list before the delete had arrived: "on screen: n150". It now waits for n151 to come up, then checks it stays, as it waits for the jump before the delete. Amp-Thread-ID: https://ampcode.com/threads/T-01a1d36c-588f-74c1-ab26-4bb389433e40 Co-authored-by: Amp <amp@ampcode.com>
1 parent 9d49cce commit cd3536d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎swift/Tests/AppleTests/VirtualListViewTests.swift‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@
217217
try await t.run(0.5) { false }
218218
#expect(list.firstVisibleItem()?.key == VirtualListTests.id(150))
219219
server.delete("note", ["id": .string(VirtualListTests.id(150))])
220-
try await t.run(2) { false }
220+
// The delete reaches the list over several turns of the main actor,
221+
// which the other suites' tests share and can hold for seconds (a
222+
// SQLite busy wait): a fixed wait can run out before them. Waited for,
223+
// as the jump is above.
224+
try await t.run(30) { list.firstVisibleItem()?.key == VirtualListTests.id(151) }
225+
try await t.run(0.5) { false }
221226
// n151 comes up into its place.
222227
#expect(
223228
list.firstVisibleItem()?.key == VirtualListTests.id(151),

0 commit comments

Comments
 (0)