diff --git a/@xen-orchestra/immutable-backups/src/remote.integ.mts b/@xen-orchestra/immutable-backups/src/remote.integ.mts index 883052a3e9..054357d3fc 100644 --- a/@xen-orchestra/immutable-backups/src/remote.integ.mts +++ b/@xen-orchestra/immutable-backups/src/remote.integ.mts @@ -139,7 +139,13 @@ describe('protectRemotes/watchRemote', async () => { await fs.writeFile(path.join(vmDir, `${BACKUP_DATE}.json`), '{}') // The whole directory (and its contents) must become immutable. + // `chattr -R` flags the directory before recursing into its children, so + // waiting on the directory alone races with the files inside it. await waitFor(() => Directory.isImmutable(vhdDir)) + await waitFor(() => Directory.isImmutable(blocks)) + await waitFor(() => File.isImmutable(bat)) + await waitFor(() => File.isImmutable(header)) + await waitFor(() => File.isImmutable(footer)) assert.strictEqual(await Directory.isImmutable(vhdDir), true, 'vhd dir should be immutable') assert.strictEqual(await File.isImmutable(bat), true, 'bat should be immutable')