Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Tests: the secret box's key rewrites never share an mtime, so the replaced-key test can't flake

Claudebcfeb63d4887
diff --git a/tests/secret-box.test.ts b/tests/secret-box.test.ts
index 8a6267c3..204e48ac 100644
--- a/tests/secret-box.test.ts
+++ b/tests/secret-box.test.ts
@@ -23,9 +23,12 @@ afterAll(() => {
});
/** Replace the key file's content, with a new modification time so the server reads it again. */
+// Each rewrite moves the file's time on by a whole second more than the last: two rewrites in the same millisecond
+// would otherwise get the same mtime, and the box (which caches the key by mtime) would keep the old key.
+let rewrites = 0;
function rewrite(content: string) {
fs.writeFileSync(keyFile, content);
- const later = new Date(Date.now() + 5_000);
+ const later = new Date(Date.now() + 5_000 + 1_000 * ++rewrites);
fs.utimesSync(keyFile, later, later);
}