test: verify portable workspace registry end to end
This commit is contained in:
@@ -112,6 +112,45 @@ test("session listing permits all scope only to admins", async () => {
|
||||
expect(seen).toEqual([false, true]);
|
||||
});
|
||||
|
||||
test("an administrator session listing retains revisions referenced by resumable manifests", async () => {
|
||||
const retained = vi.fn(async () => {});
|
||||
const retainedRevision = "a".repeat(40);
|
||||
const app = buildApp(loadConfig({ AUTH_MODE: "upstream", THT_HARNESS_DIR: "../harness" }), {
|
||||
thtRunner: {
|
||||
withPrincipal: () => ({ sessionList: async () => [
|
||||
{ id: "open", status: "open", archived: false, workspace_revision: retainedRevision },
|
||||
{ id: "finalized", status: "finalized", archived: false, workspace_revision: "b".repeat(40) },
|
||||
{ id: "archived", status: "closed", archived: true, workspace_revision: "c".repeat(40) },
|
||||
] }),
|
||||
} as any,
|
||||
workspaceRegistry: { reconcileSnapshotRetention: retained } as any,
|
||||
});
|
||||
|
||||
const response = await app.inject({
|
||||
method: "GET", url: "/sessions?scope=all",
|
||||
headers: { ...aliceHeaders, "x-thoth-is-admin": "1" },
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(retained).toHaveBeenCalledWith([retainedRevision]);
|
||||
});
|
||||
|
||||
test("the single local installation listing reconciles its resumable workspace pins", async () => {
|
||||
const retained = vi.fn(async () => {});
|
||||
const retainedRevision = "d".repeat(40);
|
||||
const app = buildApp(loadConfig({ THT_HARNESS_DIR: "../harness" }), {
|
||||
thtRunner: {
|
||||
sessionList: async () => [{ id: "open", status: "closed", archived: false, workspace_revision: retainedRevision }],
|
||||
} as any,
|
||||
workspaceRegistry: { reconcileSnapshotRetention: retained } as any,
|
||||
});
|
||||
|
||||
const response = await app.inject({ method: "GET", url: "/sessions" });
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(retained).toHaveBeenCalledWith([retainedRevision]);
|
||||
});
|
||||
|
||||
test("A, B, and admin requests preserve owner isolation through session route mutations", async () => {
|
||||
const owners = new Map([["a", "alice"], ["b", "bob"]]);
|
||||
const closed: Array<{ id: string; subject: string }> = [];
|
||||
|
||||
Reference in New Issue
Block a user