@mark1russell7/harness 0.11.16 → 0.11.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as WsProbe, A as Reconnects, B as RunGroup, C as MiddleboxForm, D as ProbeEvent, E as Prediction, F as Replies, G as Shipped, H as RunTopology, I as RequestPrediction, J as StageBand, K as ShippedImage, L as RouterHop, M as Reference, N as ReplicaSet, O as ProxyHop, P as ReplicaSetStage, Q as Toxic, R as RttRange, S as MiddleboxExpectation, T as PinnedImage, U as SentinelEvent, V as RunPart, W as SentinelStage, X as Target, Y as Subject, Z as Topology, _ as HttpProbe, a as DriverBand, b as LineMatch, c as FaultPlace, d as GroupPrediction, et as isHopPlace, f as GroupRole, g as HopPlace, h as HopEvent, i as ClientImage, j as Recovers, k as ProxyTime, l as Group, m as Hop, n as Cell, o as DriverStep, p as HarnessImage, q as Stage, r as Client, s as Fault, t as BuildImage, tt as latestEndOf, u as GroupPlace, v as ImageSource, w as Observer, x as MiddleboxEvent, y as KernelRecord, z as Run } from "./cell-B6YHtKFb.js";
1
+ import { $ as Target, A as ProbeEvent, B as RouterHop, C as LineMatch, D as Observer, E as MiddleboxForm, F as Reference, G as RunTopology, H as Run, I as ReplicaSet, J as Shipped, K as SentinelEvent, L as ReplicaSetStage, M as ProxyTime, N as Reconnects, O as PinnedImage, P as Recovers, Q as Subject, R as Replies, S as KernelRecord, T as MiddleboxExpectation, U as RunGroup, V as RttRange, W as RunPart, X as Stage, Y as ShippedImage, Z as StageBand, _ as Hop, a as Cluster, b as HttpProbe, c as DriverBand, d as FaultPlace, et as Topology, f as Group, g as HarnessImage, h as GroupRole, i as ClientImage, it as latestEndOf, j as ProxyHop, k as Prediction, l as DriverStep, m as GroupPrediction, n as Cell, nt as WsProbe, o as ClusterClientAt, p as GroupPlace, q as SentinelStage, r as Client, rt as isHopPlace, s as ClusterStage, t as BuildImage, tt as Toxic, u as Fault, v as HopEvent, w as MiddleboxEvent, x as ImageSource, y as HopPlace, z as RequestPrediction } from "./cell-CcigQdUN.js";
2
2
  import { Quantity } from "@mark1russell7/quantity";
3
3
  import "testcontainers";
4
4
  //#region src/application.d.ts
@@ -155,8 +155,8 @@ export declare const measureDriver: (cell: Cell, run: Run) => Measured;
155
155
  /**
156
156
  * This module measures a run of a group cell. It gives the first write that a primary accepted
157
157
  * after the fault, and the timeline of the group. The Sentinels of a group announce its timeline.
158
- * The logs of the members of a replica set and its client tell it. The module also gives what
159
- * became of each write.
158
+ * The logs of the members of a replica set or of the nodes of a cluster, and its client, tell it. The
159
+ * module also gives what became of each write.
160
160
  */
161
161
  /** These are the stages of a timeline under Sentinels, in their sequence after a fault. */
162
162
  export declare const STAGES: readonly SentinelStage[];
@@ -168,7 +168,8 @@ interface ErrorOnTheWay {
168
168
  }
169
169
  /**
170
170
  * A writes record tells what became of the writes of a run, by their sequence numbers:
171
- * - `old` counts the writes that the primary of the start of the run accepted after the fault.
171
+ * - `old` counts the writes that the primary of the start of the run accepted after the fault. A
172
+ * cluster counts none: its client publishes through one node, not through the leader of the queue.
172
173
  * - `lost` are the writes that a primary accepted and the group did not keep. They are the cost
173
174
  * of a split brain. It is null when the group did not converge after the run.
174
175
  * - `unknown` are the writes that the client sent and did not see accepted: an error, or no answer.
@@ -222,6 +223,24 @@ export declare const MEMBER_MARKS: Readonly<Record<Exclude<ReplicaSetStage, "dis
222
223
  * the commit of the fault (`sentAfter`). It is on a new primary when `lands` is `new`.
223
224
  */
224
225
  export declare const replicaSetStagesOf: (run: Run, from: number, sentAfter: number, lands: "new" | "same") => Partial<Record<Stage, Quantity>>;
226
+ /** These are the stages of the timeline of a cluster of RabbitMQ, in their usual sequence after a fault. */
227
+ export declare const CLUSTER_STAGES: readonly ClusterStage[];
228
+ /**
229
+ * These are the log lines of RabbitMQ that mark each stage of a cluster, by their message (ra 3.1.10,
230
+ * ra_server_proc.erl:871, :1336-1345 and :1974). `at` tells where the line comes from: the node of the
231
+ * old leader, or another node.
232
+ */
233
+ export declare const NODE_MARKS: Readonly<Record<Exclude<ClusterStage, "first-write">, {
234
+ readonly message: RegExp;
235
+ readonly at: "old" | "other";
236
+ }>>;
237
+ /**
238
+ * This function gives the time of each stage of a cluster from an instant, in a run. The stages of
239
+ * the nodes come from their log lines (`ev` "rabbit"), whose times the lab puts on the monotonic
240
+ * clock. `first-write` is the first confirm of a publish that the client sent after the commit of
241
+ * the fault (`sentAfter`), through any node.
242
+ */
243
+ export declare const clusterStagesOf: (run: Run, from: number, sentAfter: number) => Partial<Record<Stage, Quantity>>;
225
244
  /** This function gives what became of each write of a run, from the lines of the client and the keys that the group kept. */
226
245
  export declare const writesOf: (run: Run, after: number, primary: string) => Writes;
227
246
  /** This function gives the errors that the client met after an instant: each kind, its first time, and its count. */
@@ -1088,6 +1107,10 @@ export declare const mongoClientImage: () => Promise<string>;
1088
1107
  export declare const pgClientImage: () => Promise<string>;
1089
1108
  /** This function gives the image of the client of HikariCP over pgjdbc. */
1090
1109
  export declare const hikariClientImage: () => Promise<string>;
1110
+ /** This function gives the image of the RabbitMQ client: amqplib, with the client and the admin of a cluster cell. */
1111
+ export declare const amqpClientImage: () => Promise<string>;
1112
+ /** This function gives the image of the gRPC client of the harness: grpc-js 1.14.6 on Node 24.21.0, with its client. */
1113
+ export declare const grpcClientImage: () => Promise<string>;
1091
1114
  /** This function gives the image of the procedures subject: the WebSocket client of `@procedures/client`, and its server. */
1092
1115
  export declare const proceduresImage: () => Promise<string>;
1093
1116
  /**
@@ -1384,6 +1407,176 @@ export declare const replicaSetArgs: (cell: Cell, members: Readonly<Record<strin
1384
1407
  */
1385
1408
  export declare const replicaSetOnce: (lab: ReplicaSetLab, cell: Cell, environment: number, index: number) => Promise<Run>;
1386
1409
  //#endregion
1410
+ //#region src/cluster.d.ts
1411
+ /**
1412
+ * This module is the lab of a cluster of RabbitMQ with one quorum queue. The members of the queue
1413
+ * elect its leader by Raft, one member on each node. It opens one environment for a cluster cell,
1414
+ * for the runs of the cell. Each node is a container from the stock image of the cluster, in its own
1415
+ * network namespace. An injector sidecar shares its network and process namespaces.
1416
+ *
1417
+ * The client of each run is amqplib. It publishes a stream of sequence numbers with confirms through
1418
+ * one node, and it connects to the next node when its connection ends. The timeline comes from
1419
+ * the log of each node and from the lines of the client. The prober watches the namespace of the client.
1420
+ */
1421
+ /**
1422
+ * A node line is one log line of a node, as RabbitMQ writes it to its console. `real` is its time on
1423
+ * the wall clock in ms, with its microseconds. `t` is its time on the monotonic clock: the run gives
1424
+ * it from the clock lines of its client.
1425
+ */
1426
+ interface NodeLine extends SentinelEvent {
1427
+ readonly ev: "rabbit";
1428
+ readonly member: string;
1429
+ readonly real: number;
1430
+ readonly level: string;
1431
+ readonly msg: string;
1432
+ }
1433
+ /** This function gives a line of the console without its colors. */
1434
+ export declare const plainOf: (text: string) => string;
1435
+ /** This text is the name of a quorum queue in the log of Ra: its friendly name. */
1436
+ export declare const logNameOf: (queue: string) => string;
1437
+ /**
1438
+ * This function reads one log line of a node, or gives null for a line that a run does not keep. A
1439
+ * run keeps each line of the queue, each warning and each error, and each line of the maintenance
1440
+ * mode of a drain.
1441
+ */
1442
+ export declare const nodeLineOf: (member: string, text: string, queue: string) => NodeLine | null;
1443
+ /** This function puts the log lines of the nodes on the monotonic clock, with the offset of a client. */
1444
+ export declare const nodesOnMonotonic: (log: readonly NodeLine[], offset: number | null) => NodeLine[];
1445
+ /**
1446
+ * This function reads the JSON output of a tool of RabbitMQ (`--formatter json`). The tools print a
1447
+ * value over one line or over more than one, thus it reads from the first bracket to the end.
1448
+ */
1449
+ export declare const toolJsonOf: (text: string) => unknown;
1450
+ /** This function gives the name of a node in the Erlang distribution: `rabbit@<name>`. */
1451
+ export declare const nodeNameOf: (member: string) => string;
1452
+ /**
1453
+ * This function gives the file of rabbitmq.conf of each node. The nodes form the cluster from the list
1454
+ * of their names, and the user guest connects from each address. The lines of the cluster come last.
1455
+ */
1456
+ export declare const clusterConf: (cluster: Cluster) => string;
1457
+ /**
1458
+ * This function gives the command of each node. It writes the cookie of the server and of the tools.
1459
+ * Then it starts the server as the child of a shell. A fin can then stop the server, and the container
1460
+ * stays up.
1461
+ */
1462
+ export declare const nodeCommand: (cluster: Cluster) => string;
1463
+ /** A status row is one member of the queue in the output of `rabbitmq-queues quorum_status`. */
1464
+ interface StatusRow {
1465
+ readonly "Node Name": string;
1466
+ readonly "Raft State": string;
1467
+ readonly Term: number | string;
1468
+ readonly "Commit Index": number | string;
1469
+ }
1470
+ /**
1471
+ * This function judges the status of the queue: its leader, and if the queue is healthy. A healthy
1472
+ * queue has one leader and a follower on each other node. Each follower is in the term of the leader,
1473
+ * at the commit index of the leader.
1474
+ */
1475
+ export declare const clusterViewOf: (cluster: Cluster, rows: readonly StatusRow[]) => GroupView;
1476
+ /**
1477
+ * This function gives the peers that a fault on a node cuts it from. `all` is each other node and the
1478
+ * client, `group` is the other nodes, and `clients` is the client. `one` is the first other node in
1479
+ * the sequence of the cluster, and `one-way` is the same node for the segments from the part only.
1480
+ */
1481
+ export declare const clusterCutOf: (cluster: Cluster, members: Readonly<Record<string, RunPart>>, client: string, part: string, cuts: NonNullable<GroupPlace["cuts"]>) => Cut;
1482
+ /** A wall stamp is the wall clock in ns around a command of a node: the run puts it on the monotonic clock. */
1483
+ interface WallStamp {
1484
+ readonly wall0: number;
1485
+ readonly wall1: number;
1486
+ }
1487
+ /** A cluster lab is one environment of a cluster cell. */
1488
+ interface ClusterLab {
1489
+ readonly cluster: Cluster;
1490
+ readonly clientIp: string;
1491
+ readonly members: Readonly<Record<string, RunPart>>;
1492
+ readonly netns: {
1493
+ readonly client: number;
1494
+ };
1495
+ /** These are all the records that the prober wrote, in sequence. */
1496
+ readonly kernel: readonly KernelRecord[];
1497
+ /** These are the log lines of the nodes that a run keeps, in the sequence of their arrival, with `t` at 0. */
1498
+ readonly log: readonly NodeLine[];
1499
+ /** These are the last raw lines of the console of each node, for the diagnosis of a lab: at most RAW_TAIL of each. */
1500
+ readonly raw: Readonly<Record<string, readonly string[]>>;
1501
+ /** This method sets the sysctls of the client namespace through its privileged sidecar, and reads them back. */
1502
+ sysctl(values: Readonly<Record<string, string>>): Promise<Record<string, string>>;
1503
+ /** This method waits until the queue is whole and calm, and gives the name of the node of its leader. */
1504
+ converge(within?: number): Promise<string>;
1505
+ /** This method removes each message from the queue. */
1506
+ flush(leader: string): Promise<void>;
1507
+ /** This method gives the sequence numbers that the queue holds, through the node of its leader. The queue is empty after it. */
1508
+ holds(leader: string): Promise<number[]>;
1509
+ /** This method gives the node that has a role, when `leader` is the node of the leader. The role is the leader, or a follower. */
1510
+ partOf(role: GroupRole, leader: string): string;
1511
+ /** This method starts the client of a run, with the arguments of `client-cluster.mjs`. */
1512
+ client(args: readonly string[]): Promise<GroupClient>;
1513
+ /** This method applies a network fault between a node and some of its peers, at once or at an instant of the VM. */
1514
+ fault(kind: GroupNetworkFault, part: string, cuts: NonNullable<GroupPlace["cuts"]>, at?: number): Promise<Stamp>;
1515
+ /** This method removes a network fault, at once or at an instant of the VM. */
1516
+ lift(kind: GroupNetworkFault, part: string, cuts: NonNullable<GroupPlace["cuts"]>, at?: number): Promise<Stamp>;
1517
+ /** This method sends a signal to the server process of a node, at once or at an instant of the VM. */
1518
+ signal(part: string, signal: "KILL" | "STOP" | "CONT", at?: number): Promise<Stamp>;
1519
+ /** This method starts the server of a node again, after a fin. */
1520
+ restart(member: string): Promise<void>;
1521
+ /** This method moves the leadership of the queue from the node of `leader` to the node `to`: `rabbitmq-queues transfer_leadership`. */
1522
+ stepDown(leader: string, to: string): Promise<WallStamp>;
1523
+ /** This method puts a node in maintenance mode (`rabbitmq-upgrade drain`). */
1524
+ drain(member: string): Promise<WallStamp>;
1525
+ /** This method ends the maintenance mode of a node (`rabbitmq-upgrade revive`). */
1526
+ revive(member: string): Promise<void>;
1527
+ /** This method removes the TCP metrics of the client namespace: each run starts from a kernel that keeps nothing. */
1528
+ forget(): Promise<void>;
1529
+ /** This method waits for the next clock line of the prober, which gives the count of lost records. */
1530
+ settle(): Promise<number | null>;
1531
+ manifest(sysctls: Readonly<Record<string, string>>): Promise<Manifest>;
1532
+ close(): Promise<void>;
1533
+ }
1534
+ /**
1535
+ * This function opens one environment of a cluster cell:
1536
+ * - one new network, with each node, the client and the admin on it.
1537
+ * - each node: the stock image, its server as the child of a shell, with its hostname as the name of
1538
+ * the node. A log consumer reads its console. The nodes form the cluster from the list of their
1539
+ * names, and the lab waits until each node runs in it.
1540
+ * - the admin declares the quorum queue on the first node, thus its member there is the first leader.
1541
+ * - an injector sidecar for each node, in its network and process namespaces.
1542
+ * - a client that holds its own network namespace, with a privileged sidecar for its sysctls.
1543
+ * - the prober, which watches the namespace of the client.
1544
+ */
1545
+ export declare const openClusterLab: (cluster: Cluster) => Promise<ClusterLab>;
1546
+ /**
1547
+ * This function gives the hosts of the client, in the sequence of its connects: its node first, then
1548
+ * each other node. The node of a follower is the last follower in the sequence of the cluster. A fault
1549
+ * on one member (`one`, `one-way`) cuts the first follower, thus not the node of the client.
1550
+ */
1551
+ export declare const clusterHostsOf: (cell: Cell, members: Readonly<Record<string, RunPart>>, leader: string) => string[];
1552
+ /** This form is the NOTICE of a leader of the queue that starts to give its leadership away: to await_condition, for a transfer. */
1553
+ export declare const GIVES_AWAY: RegExp;
1554
+ /** This form is the INFO of a follower whose monitor of the leader goes down (ra_server_proc.erl:871). A drain stops the leader so. */
1555
+ export declare const MONITOR_DOWN: RegExp;
1556
+ /** This function gives the arguments of the client of a cluster cell: its hosts, the queue, and the stream of publishes. */
1557
+ export declare const clusterArgs: (cell: Cell, members: Readonly<Record<string, RunPart>>, leader: string) => string[];
1558
+ /** This function puts a wall stamp on the monotonic clock, with the clock lines of the client. Without one it gives null. */
1559
+ export declare const monotonicOf: (stamp: WallStamp, events: readonly ProbeEvent[]) => Stamp | null;
1560
+ /**
1561
+ * This function puts the stamp of a fault from a line of the log on the monotonic clock again. It uses
1562
+ * the offset of all the clock lines of the client, as the timeline of the run does. Thus the line of the
1563
+ * stamp is at the stamp. The offset of the clock lines at the fault can be up to 1 ms smaller.
1564
+ */
1565
+ export declare const restamped: (line: NodeLine, events: readonly ProbeEvent[]) => Stamp | null;
1566
+ /**
1567
+ * This function does one run of a cluster cell:
1568
+ * - The queue converges, and it is empty. The client connects through its node, and its stream of
1569
+ * publishes gets steady.
1570
+ * - The fault occurs on its node, as the leader of this run makes the roles. A fault with a hold
1571
+ * lifts at its instant in the VM. A step-down moves the leadership to a follower, and a drain puts
1572
+ * the node in maintenance mode. The stamp of each of them is a line of the log (`stampOf`).
1573
+ * - The run waits for its outcome: the first confirm of a publish sent after the commit of the fault.
1574
+ * Then it waits for the end of the hold, thus the record shows what the cluster did in the whole hold.
1575
+ * - Each fault goes, the client stops, and the queue converges again. The sequence numbers that it
1576
+ * then holds tell which publishes it kept. The log lines of the nodes go onto the monotonic clock.
1577
+ */
1578
+ export declare const clusterOnce: (lab: ClusterLab, cell: Cell, environment: number, index: number) => Promise<Run>;
1579
+ //#endregion
1387
1580
  //#region src/run.d.ts
1388
1581
  /** A cell result is a cell with its manifests, its runs, their measurements and its verdict. */
1389
1582
  interface CellResult {
@@ -1432,5 +1625,5 @@ export declare const spread: (runs: number, environments: number) => number[];
1432
1625
  */
1433
1626
  export declare const runCell: (cell: Cell, say?: (line: string) => void) => Promise<CellResult>;
1434
1627
  //#endregion
1435
- export { type Agent, type BuildImage, type CallReading, type Cell, type CellResult, type Client, type ClientImage, type Crossings, type Cut, type Decision, type DriverBand, type DriverSocket, type DriverStep, type DriverStepTime, type ErrorOnTheWay, type Fault, type FaultPlace, type FaultSide, type Group, type GroupClient, type GroupLab, type GroupMeasured, type GroupNetworkFault, type GroupPlace, type GroupPrediction, type GroupReading, type GroupRole, type GroupVerdict, type GroupView, type HarnessImage, type Hop, type HopEvent, type HopPlace, type HttpProbe, type ImagePlan, type ImageSource, type Interval, type KernelRecord, type Lab, type LineMatch, type Manifest, type ManifestHop, type Measured, type MemberLine, type MiddleboxEvent, type MiddleboxExpectation, type MiddleboxForm, type NetworkFault, type Observer, type Outcome, type PinnedImage, type Prediction, type Probe, type ProbeEvent, type ProgramEvent, type ProxyHop, type ProxyTime, type ReconnectReading, type ReconnectVerdict, type Reconnects, type Recovers, type Reference, type Reordering, type ReplicaSet, type ReplicaSetLab, type ReplicaSetStage, type Replies, type RequestPrediction, type RequestReading, type RouterHop, type RttRange, type Run, type RunGroup, type RunPart, type RunTopology, type SentinelEvent, type SentinelStage, type Shipped, type ShippedImage, type SocketPlace, type Spread, type Stage, type StageBand, type StageVerdict, type Stamp, type Status, type Subject, type Target, type Topology, type Toxic, type Verdict, type Writes, type WsProbe, isHopPlace, latestEndOf };
1628
+ export { type Agent, type BuildImage, type CallReading, type Cell, type CellResult, type Client, type ClientImage, type Cluster, type ClusterClientAt, type ClusterLab, type ClusterStage, type Crossings, type Cut, type Decision, type DriverBand, type DriverSocket, type DriverStep, type DriverStepTime, type ErrorOnTheWay, type Fault, type FaultPlace, type FaultSide, type Group, type GroupClient, type GroupLab, type GroupMeasured, type GroupNetworkFault, type GroupPlace, type GroupPrediction, type GroupReading, type GroupRole, type GroupVerdict, type GroupView, type HarnessImage, type Hop, type HopEvent, type HopPlace, type HttpProbe, type ImagePlan, type ImageSource, type Interval, type KernelRecord, type Lab, type LineMatch, type Manifest, type ManifestHop, type Measured, type MemberLine, type MiddleboxEvent, type MiddleboxExpectation, type MiddleboxForm, type NetworkFault, type NodeLine, type Observer, type Outcome, type PinnedImage, type Prediction, type Probe, type ProbeEvent, type ProgramEvent, type ProxyHop, type ProxyTime, type ReconnectReading, type ReconnectVerdict, type Reconnects, type Recovers, type Reference, type Reordering, type ReplicaSet, type ReplicaSetLab, type ReplicaSetStage, type Replies, type RequestPrediction, type RequestReading, type RouterHop, type RttRange, type Run, type RunGroup, type RunPart, type RunTopology, type SentinelEvent, type SentinelStage, type Shipped, type ShippedImage, type SocketPlace, type Spread, type Stage, type StageBand, type StageVerdict, type Stamp, type Status, type StatusRow, type Subject, type Target, type Topology, type Toxic, type Verdict, type WallStamp, type Writes, type WsProbe, isHopPlace, latestEndOf };
1436
1629
  //# sourceMappingURL=index.d.ts.map