Public: anyone can read this; the crew can change it.

Full suite red: test/offsite-lane.test.ts #12685

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/12653-full-suite-red-test-offsite-lane-test-ts → main 1 commit fork

  • Merged. scout/12653-full-suite-red-test-offsite-lane-test-ts was merged into main as e716baf.

Review

Sign in to review this change.
1 file changed +14 −6
test/offsite-lane.test.ts +14 −6
@@ -173,16 +173,21 @@ describe("the off-site lane end to end", () => {
173173 await rm(root, { recursive: true, force: true });
174174 });
175175
176 test("the pass seals every object, a restore with the passphrase brings the forge back, and the drill restores from it", async () => {
177 const mirror = sealedStore(dirStore(offDir), PASS);
178 const svc = startSnapshots(app, dirStore(join(root, "primary")), {
176 let mirror: Store;
177 let svc: ReturnType<typeof startSnapshots>;
178 let m: Awaited<ReturnType<typeof svc.now>>;
179 let onBucket: string[];
180
181 test("the pass seals every object under names that hide every path", async () => {
182 mirror = sealedStore(dirStore(offDir), PASS);
183 svc = startSnapshots(app, dirStore(join(root, "primary")), {
179184 version: "t",
180185 nightly: false,
181186 passphrase: PASS,
182187 mirror,
183188 drill: (deps) => runDrill({ ...deps, boot: async () => ({ ok: true, reason: "" }) }),
184189 });
185 const m = await svc.now();
190 m = await svc.now();
186191 const state = await svc.mirrorFresh();
187192 expect(state?.failingSince).toBeUndefined();
188193 expect(state?.sealed).toBe(true);
@@ -190,7 +195,7 @@ describe("the off-site lane end to end", () => {
190195
191196 // On the bucket: only `sealed/chunks/<hmac>` and the manifest as
192197 // `sealed/snapshots/<name>/<hmac>`, and not one plain byte of the database or the manifest.
193 const onBucket = files(offDir);
198 onBucket = files(offDir);
194199 // Every chunk the snapshot names, its manifest, and the lane's header.
195200 const ids = [...new Set(m.files.flatMap((f) => f.chunks ?? []))];
196201 expect(onBucket.length).toBe(ids.length + 2);
@@ -205,7 +210,9 @@ describe("the off-site lane end to end", () => {
205210 expect(raw).not.toContain("SQLite format");
206211 expect(raw).not.toContain('"startedAt"');
207212 }
213 }, 60_000);
208214
215 test("a restore with the passphrase brings the forge back; another passphrase opens nothing", async () => {
209216 // The lane lists and restores like any store, given the passphrase; another passphrase opens nothing.
210217 expect((await listSnapshots(mirror)).map((x) => x.name)).toEqual([m.name]);
211218 const target = join(root, "restored");
@@ -219,8 +226,9 @@ describe("the off-site lane end to end", () => {
219226 const sealedFile = onBucket.find((f) => relative(offDir, f) !== LANE_HEADER)!;
220227 const wrong = await sealKeys("wrong", header.salt);
221228 expect(() => openBody(wrong, readFileSync(sealedFile), "x")).toThrow("wrong passphrase");
229 }, 60_000);
222230
223 // The drill restores the newest off-site snapshot, green, and keeps where it came from.
231 test("the drill restores the newest off-site snapshot and keeps where it came from", async () => {
224232 const d = await svc.drill();
225233 expect(d.verdict).toBe("green");
226234 expect(d.snapshotId).toBe(m.name);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs