Skip to content

Commit 20a2444

Browse files
committed
more subvolume tests
1 parent 9ece08a commit 20a2444

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/packages/file-server/storage-btrfs/test/basics.test.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { before, after, fs } from "./setup";
22
import { isValidUUID } from "@cocalc/util/misc";
3-
// import { readFile, writeFile } from "fs/promises";
4-
// import { join } from "path";
3+
import { readFile, writeFile } from "fs/promises";
4+
import { join } from "path";
55

66
beforeAll(before);
77

@@ -60,15 +60,21 @@ describe("operations with subvolumes", () => {
6060
await fs.rsync({ src: "sagemath", target: "cython" });
6161
});
6262

63-
// it("rsync with an actual file", async () => {
64-
// const sagemath = await fs.subvolume("sagemath");
65-
// const cython = await fs.subvolume("cython");
66-
// await writeFile(join(sagemath.path, "README.md"), "hi");
67-
// await fs.rsync({ src: "sagemath", target: "cython" });
68-
// expect((await readFile(join(sagemath.path, "README.md")), "utf8")).toEqual(
69-
// "hi",
70-
// );
71-
// });
63+
it("rsync an actual file", async () => {
64+
const sagemath = await fs.subvolume("sagemath");
65+
const cython = await fs.subvolume("cython");
66+
await writeFile(join(sagemath.path, "README.md"), "hi");
67+
await fs.rsync({ src: "sagemath", target: "cython" });
68+
const copy = await readFile(join(cython.path, "README.md"), "utf8");
69+
expect(copy).toEqual("hi");
70+
});
71+
72+
it("clone a subvolume with contents", async () => {
73+
await fs.cloneSubvolume("cython", "pyrex");
74+
const pyrex = await fs.subvolume("pyrex");
75+
const clone = await readFile(join(pyrex.path, "README.md"), "utf8");
76+
expect(clone).toEqual("hi");
77+
});
7278
});
7379

7480
afterAll(after);

src/packages/file-server/storage-btrfs/test/setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ export async function after() {
2929
try {
3030
await fs.unmount();
3131
} catch {}
32-
console.log("deleting ", tempDir);
3332
await rm(tempDir, { force: true, recursive: true });
3433
}

0 commit comments

Comments
 (0)