mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
test(daemon): stabilize artifact-manifest reconcile mtime test on slow CI
The reconcile-on-run-end regression test compared `fs.statSync(...).mtimeMs` against a `Date.now()`-captured run-start timestamp using strict `<`, so if the new file's ms-truncated mtime tied with runStartTimeMs (or fell a hair below it on a runner with NTP jitter) the new-file branch was incorrectly skipped and the sidecar-existence assertion flaked. Force the new file's mtime to runStartTimeMs + 1 000 ms after the write so the ordering is deterministic regardless of system-clock vs filesystem precision differences. The old file already uses utimesSync for the same reason — this just makes both ends of the comparison explicit.
This commit is contained in:
parent
0c4b7e50be
commit
598e5fc69f
1 changed files with 8 additions and 0 deletions
|
|
@ -146,6 +146,14 @@ describe('run-end artifact manifest reconciliation (#2893)', () => {
|
|||
|
||||
// File written during the run
|
||||
await writeProjectFile(projectsRoot, PROJECT_ID, 'new-output.html', '<p>new</p>');
|
||||
// Force the new file's mtime strictly above runStartTimeMs. Without this,
|
||||
// CI runners occasionally produce a file whose ms-truncated mtime equals
|
||||
// (or, due to NTP jitter, falls a hair below) Date.now() captured a few
|
||||
// microseconds earlier, which made the `<` mtime filter incorrectly skip
|
||||
// the new file and the sidecar-existence assertion flaked.
|
||||
const newPath = path.join(projectsRoot, PROJECT_ID, 'new-output.html');
|
||||
const futureTime = new Date(runStartTimeMs + 1_000);
|
||||
fs.utimesSync(newPath, futureTime, futureTime);
|
||||
|
||||
// Simulate the close-handler reconciliation with mtime filter
|
||||
const dir = path.join(projectsRoot, PROJECT_ID);
|
||||
|
|
|
|||
Loading…
Reference in a new issue