Add deterministic-tests (#190)
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:
parent
4482e0155f
commit
0e3132f96c
1 changed files with 7722 additions and 1 deletions
|
|
@ -0,0 +1,68 @@
|
|||
import type { AssertableState } from "../utils/assertable-state";
|
||||
import type { TestDefinition } from "../test-definition";
|
||||
|
||||
export const serverPauseBothEditSameFileTest: TestDefinition = {
|
||||
description:
|
||||
"Both clients edit different sections of the same file while the server is paused. After resuming and converging, client 0 makes another edit to verify further updates still work correctly.",
|
||||
clients: 2,
|
||||
steps: [
|
||||
{
|
||||
type: "create",
|
||||
client: 0,
|
||||
path: "shared.md",
|
||||
content: "line 1: original\nline 2: original\nline 3: original"
|
||||
},
|
||||
{ type: "enable-sync", client: 0 },
|
||||
{ type: "enable-sync", client: 1 },
|
||||
{ type: "barrier" },
|
||||
|
||||
{ type: "pause-server" },
|
||||
|
||||
{
|
||||
type: "update",
|
||||
client: 0,
|
||||
path: "shared.md",
|
||||
content:
|
||||
"line 1: edited by client 0\nline 2: original\nline 3: original"
|
||||
},
|
||||
{
|
||||
type: "update",
|
||||
client: 1,
|
||||
path: "shared.md",
|
||||
content:
|
||||
"line 1: original\nline 2: original\nline 3: edited by client 1"
|
||||
},
|
||||
|
||||
{ type: "resume-server" },
|
||||
{ type: "barrier" },
|
||||
|
||||
{
|
||||
type: "assert-consistent",
|
||||
verify: (s: AssertableState): void => {
|
||||
s.assertFileCount(1).assertContains(
|
||||
"shared.md",
|
||||
"edited by client 0",
|
||||
"edited by client 1"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
type: "update",
|
||||
client: 0,
|
||||
path: "shared.md",
|
||||
content: "post-merge edit from client 0"
|
||||
},
|
||||
{ type: "barrier" },
|
||||
|
||||
{
|
||||
type: "assert-consistent",
|
||||
verify: (s: AssertableState): void => {
|
||||
s.assertFileCount(1).assertContains(
|
||||
"shared.md",
|
||||
"post-merge edit from client 0"
|
||||
);
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
Loading…
Reference in a new issue