diff --git a/test/settings-admin-only-multiuser.test.ts b/test/settings-admin-only-multiuser.test.ts index e6c18120..533007ae 100644 --- a/test/settings-admin-only-multiuser.test.ts +++ b/test/settings-admin-only-multiuser.test.ts @@ -57,8 +57,12 @@ async function send(method: string, path: string, headers: Record) => boolean): Promise> { let last: Record = {}; for (let i = 0; i < 40; i++) { - last = JSON.parse(await readSettingsBytes()); - if (predicate(last)) return last; + try { + last = JSON.parse(await readSettingsBytes()); + if (predicate(last)) return last; + } catch { + // the write is not atomic: a read that lands between its truncate and its data is empty, so poll again + } await new Promise((r) => setTimeout(r, 25)); } return last;