quak backup works on up to the content pool's limit of originals at once (closes #182) #192
@@ -909,6 +909,27 @@ describe("the backup lock", () => {
|
|||||||
expect(existsSync(lockPath(outDir))).toBe(false);
|
expect(existsSync(lockPath(outDir))).toBe(false);
|
||||||
await lib.close();
|
await lib.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// `runBackup` takes a library object from its caller. With a
|
||||||
|
// `contentConcurrency` below 1, or one that is not a number, it would
|
||||||
|
// back up no original and report no error. It rejects any that is not a
|
||||||
|
// positive integer, as `BoundedPool` does, before it takes the lock,
|
||||||
|
// which would create the download directory, and before it asks the
|
||||||
|
// library for anything: the object here has nothing else.
|
||||||
|
it("rejects a library whose contentConcurrency is not a positive integer, before taking the lock", async () => {
|
||||||
|
const outDir = join(root, "backup");
|
||||||
|
for (const contentConcurrency of [undefined, 0, -1, 1.5, NaN]) {
|
||||||
|
const lib = { contentConcurrency } as unknown as BackupLibrary;
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
runBackup(lib, { downloadDirectory: outDir }),
|
||||||
|
).rejects.toThrow(
|
||||||
|
`contentConcurrency must be a positive integer, got ${contentConcurrency}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(existsSync(outDir)).toBe(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Also serves ML data: file 100 has `ML_PAYLOAD`, the other two have none.
|
// Also serves ML data: file 100 has `ML_PAYLOAD`, the other two have none.
|
||||||
|
|||||||
Reference in New Issue
Block a user