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
49
frontend/deterministic-tests/src/test-definition.ts
Normal file
49
frontend/deterministic-tests/src/test-definition.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import type { AssertableState } from "./utils/assertable-state";
|
||||
|
||||
export interface ClientState {
|
||||
files: Map<string, string>;
|
||||
clientFiles: Map<string, string>[];
|
||||
}
|
||||
|
||||
export type TestStep =
|
||||
| { type: "create"; client: number; path: string; content: string }
|
||||
| { type: "update"; client: number; path: string; content: string }
|
||||
| { type: "rename"; client: number; oldPath: string; newPath: string }
|
||||
| {
|
||||
type: "rename-next-write";
|
||||
client: number;
|
||||
oldPath: string;
|
||||
newPath: string;
|
||||
}
|
||||
| { type: "delete"; client: number; path: string }
|
||||
| { type: "sync"; client?: number }
|
||||
| { type: "disable-sync"; client: number }
|
||||
| { type: "enable-sync"; client: number }
|
||||
| { type: "pause-server" }
|
||||
| { type: "resume-server" }
|
||||
| {
|
||||
type: "resume-server-until-history-then-pause";
|
||||
client: number;
|
||||
syncType: "CREATE" | "UPDATE" | "DELETE";
|
||||
path: string;
|
||||
}
|
||||
| { type: "barrier" }
|
||||
| { type: "assert-consistent"; verify?: (state: AssertableState) => void }
|
||||
| { type: "pause-websocket"; client: number }
|
||||
| { type: "resume-websocket"; client: number }
|
||||
| { type: "drop-next-create-response"; client: number }
|
||||
| { type: "wait-for-dropped-create-response"; client: number }
|
||||
| { type: "sleep"; ms: number }
|
||||
| { type: "reset"; client: number };
|
||||
|
||||
export interface TestDefinition {
|
||||
description?: string;
|
||||
clients: number;
|
||||
steps: TestStep[];
|
||||
}
|
||||
|
||||
export interface TestResult {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
duration?: number;
|
||||
}
|
||||
Loading…
Reference in a new issue