Test the live-photo writer's fsyncs (closes #130) #131
@@ -21,6 +21,11 @@ declares one.
|
|||||||
|
|
||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
|
- 2026-09-28: Tested the live-photo writer's fsyncs (issue 130). A test checks
|
||||||
|
that the image's and the video's temp files are fsynced before either is
|
||||||
|
renamed into place, and the directory after both renames, as the `writeAtomic`
|
||||||
|
test does for one file.
|
||||||
|
|
||||||
- 2026-09-23: Live photos are stored as their image and their video (issue 107).
|
- 2026-09-23: Live photos are stored as their image and their video (issue 107).
|
||||||
A live photo, which Ente stores as one ZIP, is unpacked as it downloads into
|
A live photo, which Ente stores as one ZIP, is unpacked as it downloads into
|
||||||
`<fileID>.<ext>` for the image and for the video, each with its extension from
|
`<fileID>.<ext>` for the image and for the video, each with its extension from
|
||||||
|
|||||||
@@ -1909,6 +1909,24 @@ describe("downloadFile live photos", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("fsyncs each part's temp file before the renames and the directory after", async () => {
|
||||||
|
const t = setup(livePhotoZip(), livePhoto);
|
||||||
|
|
||||||
|
await t.run();
|
||||||
|
|
||||||
|
// The same durability contract as `writeAtomic`, for two files: both
|
||||||
|
// temp files are on disk before either is renamed into place, and the
|
||||||
|
// directory is fsynced once both renames are done.
|
||||||
|
const [imageTmp, videoTmp] = renameHook.calls.map((c) => c.from);
|
||||||
|
expect(durabilityHook.events).toEqual([
|
||||||
|
`sync:w:${imageTmp}`,
|
||||||
|
`sync:w:${videoTmp}`,
|
||||||
|
`rename:${join(t.dir, "f.heic")}`,
|
||||||
|
`rename:${join(t.dir, "f.mov")}`,
|
||||||
|
`sync:r:${t.dir}`,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it("stores neither part when the video cannot be renamed into place", async () => {
|
it("stores neither part when the video cannot be renamed into place", async () => {
|
||||||
const t = setup(livePhotoZip(), livePhoto);
|
const t = setup(livePhotoZip(), livePhoto);
|
||||||
renameHook.failWith = new Error("simulated rename failure");
|
renameHook.failWith = new Error("simulated rename failure");
|
||||||
|
|||||||
Reference in New Issue
Block a user