Add deterministic-tests (#190)
Some checks are pending
Check / build (push) Waiting to run
E2E tests / build (push) Waiting to run
Publish CLI / publish-docker (push) Waiting to run
Publish server Docker image / publish-docker (push) Waiting to run

Reviewed-on: https://home.schmelczer.dev/git/git/andras/vault-link/pulls/190
Co-authored-by: Andras Schmelczer <andras@schmelczer.dev>
Co-committed-by: Andras Schmelczer <andras@schmelczer.dev>
This commit is contained in:
Andras Schmelczer 2026-05-09 10:15:21 +01:00 • committed by andras
commit 0e3132f96c

View file

@ -0,0 +1,65 @@
import type { AssertableState } from "../utils/assertable-state";
import type { TestDefinition } from "../test-definition";
export const renamedPendingCreateReusedPathThenDeleteTest: TestDefinition = {
description:
"A queued create is renamed away from file-59.md, a newer local " +
"file reuses file-59.md before the queued create drains, and the " +
"renamed-away generation is deleted. The delete must not erase or " +
"orphan the newer file-59.md generation.",
clients: 2,
steps: [
{ type: "enable-sync", client: 0 },
{ type: "enable-sync", client: 1 },
{ type: "barrier" },
{ type: "pause-server" },
{
type: "create",
client: 1,
path: "blocker.md",
content: "blocker\n"
},
{ type: "sleep", ms: 100 },
{
type: "create",
client: 1,
path: "file-59.md",
content: "old\n"
},
{
type: "rename",
client: 1,
oldPath: "file-59.md",
newPath: "file-33.md"
},
{
type: "create",
client: 1,
path: "file-59.md",
content: "new\n"
},
{
type: "resume-server-until-history-then-pause",
client: 1,
syncType: "CREATE",
path: "file-33.md"
},
{ type: "delete", client: 1, path: "file-33.md" },
{ type: "resume-server" },
{ type: "barrier" },
{
type: "assert-consistent",
verify: (state: AssertableState): void => {
state
.assertFileCount(2)
.assertContent("blocker.md", "blocker\n")
.assertContent("file-59.md", "new\n")
.assertFileNotExists("file-33.md");
}
}
]
};