@mark1russell7/harness 0.16.4 → 0.16.6

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,6 +1,6 @@
1
- import { $ as Prediction, A as HostSysctl, At as Stage, B as LoadPlan, C as GroupPrediction, Ct as RunRoute, D as HopPlace, Dt as SentinelStage, E as HopEvent, Et as SentinelEvent, F as KafkaPause, Ft as Toxic, G as MiddleboxForm, H as LoadStream, I as KernelRecord, It as WsProbe, J as Pair, K as Observer, L as LineCount, Lt as environmentProblems, M as ImageSource, Mt as Subject, N as Jitter, Nt as Target, O as HopSignal, Ot as Shipped, P as Kafka, Pt as Topology, Q as PortsPrediction, R as LineMatch, Rt as isHopPlace, S as GroupPlace, St as RunPause, T as Hop, Tt as RunTopology, U as MiddleboxEvent, V as LoadPrediction, W as MiddleboxExpectation, X as PausePrediction, Y as PauseBand, Z as PinnedImage, _ as Fabric, _t as RunBackup, a as ClientCapability, at as QueueEnd, b as FaultPlace, bt as RunGroup, c as ClusterClientAt, ct as Recovers, d as CountBand, dt as ReplicaSetStage, et as ProbeEvent, f as DeliveryPrediction, ft as Replies, g as DriverStep, gt as Run, h as DriverBand, ht as RttRange, i as Client, it as QueueConnection, j as HttpProbe, jt as StageBand, k as HopWrite, kt as ShippedImage, l as ClusterStage, lt as Reference, m as DrillRoom, mt as RouterHop, n as CLIENT_CAPABILITIES, nt as ProxyTime, o as ClientImage, ot as QueuePrediction, p as Drill, pt as RequestPrediction, q as Outcomes, r as Cell, rt as QueueBand, s as Cluster, st as Reconnects, t as BuildImage, tt as ProxyHop, u as ConntrackPrediction, ut as ReplicaSet, v as FabricManifest, vt as RunDrill, w as GroupRole, wt as RunStream, x as Group, xt as RunPart, y as Fault, yt as RunFabric, z as LoadBand, zt as latestEndOf } from "./cell-CXxqXp1q.js";
1
+ import { $ as Outcomes, A as HostSysctl, At as RunStream, B as LoadPlan, Bt as Topology, C as GroupPrediction, Ct as RunBackup, D as HopPlace, Dt as RunPart, E as HopEvent, Et as RunGroup, F as KafkaPause, Ft as ShippedImage, G as MemoryOomTask, Gt as latestEndOf, H as LoadStream, Ht as WsProbe, I as KernelRecord, It as Stage, J as MemoryThrottlePrediction, K as MemoryPrediction, L as LineCount, Lt as StageBand, M as ImageSource, Mt as SentinelEvent, N as Jitter, Nt as SentinelStage, O as HopSignal, Ot as RunPause, P as Kafka, Pt as Shipped, Q as Observer, R as LineMatch, Rt as Subject, S as GroupPlace, St as Run, T as Hop, Tt as RunFabric, U as MemoryLimits, Ut as environmentProblems, V as LoadPrediction, Vt as Toxic, W as MemoryOomPrediction, Wt as isHopPlace, X as MiddleboxExpectation, Y as MiddleboxEvent, Z as MiddleboxForm, _ as Fabric, _t as ReplicaSetStage, a as ClientCapability, at as Prediction, b as FaultPlace, bt as RouterHop, c as ClusterClientAt, ct as ProxyTime, d as CountBand, dt as QueueEnd, et as Pair, f as DeliveryPrediction, ft as QueuePrediction, g as DriverStep, gt as ReplicaSet, h as DriverBand, ht as Reference, i as Client, it as PortsPrediction, j as HttpProbe, jt as RunTopology, k as HopWrite, kt as RunRoute, l as ClusterStage, lt as QueueBand, m as DrillRoom, mt as Recovers, n as CLIENT_CAPABILITIES, nt as PausePrediction, o as ClientImage, ot as ProbeEvent, p as Drill, pt as Reconnects, q as MemoryStep, r as Cell, rt as PinnedImage, s as Cluster, st as ProxyHop, t as BuildImage, tt as PauseBand, u as ConntrackPrediction, ut as QueueConnection, v as FabricManifest, vt as Replies, w as GroupRole, wt as RunDrill, x as Group, xt as RttRange, y as Fault, yt as RequestPrediction, z as LoadBand, zt as Target } from "./cell-FMlgjqVq.js";
2
2
  import { Quantity } from "@mark1russell7/quantity";
3
- import { LoadMeasure, Schedule } from "@mark1russell7/rigor-chaos";
3
+ import { DiskFault, LoadMeasure, Schedule } from "@mark1russell7/rigor-chaos";
4
4
  import { StartedTestContainer } from "testcontainers";
5
5
  /**
6
6
  * This module reads the acts of the program of the observer: its heartbeat, its drop of the
@@ -412,6 +412,56 @@ interface ConntrackReading {
412
412
  * the run did not start from an empty table.
413
413
  */
414
414
  export declare const measureConntrack: (run: Run, expected: ConntrackPrediction) => Measured;
415
+ /** This record is one step of the growth of a throttle cell, as the memory client wrote it. */
416
+ interface MemoryStepReading {
417
+ /** This usage is the pages of the cgroup after the step. */
418
+ readonly usage: number;
419
+ readonly time: Quantity;
420
+ /** This count is the rise of the event `high` in the step. */
421
+ readonly high: number;
422
+ /** This choice says that the judge read the step: its usage rose by one batch. */
423
+ readonly read: boolean;
424
+ }
425
+ /** This record is one task of an OOM cell at the end of its run. */
426
+ interface MemoryTaskReading {
427
+ readonly name: string;
428
+ readonly outcome: string;
429
+ readonly signal: number | null;
430
+ }
431
+ /** This record is what a run of a memory cell measured. */
432
+ interface MemoryReading {
433
+ /** These are the limits as the cgroup printed them at the `ready` line. */
434
+ readonly limits: {
435
+ readonly high: string;
436
+ readonly max: string;
437
+ readonly swap: string;
438
+ };
439
+ /** This usage is the pages of the cgroup at the `ready` line. */
440
+ readonly start: number;
441
+ readonly steps: readonly MemoryStepReading[];
442
+ readonly tasks: readonly MemoryTaskReading[];
443
+ /** These are the counts of `memory.events` at the end of the run. */
444
+ readonly events: Readonly<Record<string, number>>;
445
+ /** This time is the total stall of `memory.pressure` (`some`), or null when the kernel has no pressure file. */
446
+ readonly stall: Quantity | null;
447
+ }
448
+ /** This function gives the band of a step whose charge left the usage from `usage` to `usage + drift`, and the bounds of its events `high`. */
449
+ export declare const stepBand: (expected: MemoryThrottlePrediction, usage: number) => {
450
+ readonly band: QueueBand;
451
+ readonly high: {
452
+ readonly low: number;
453
+ readonly high: number;
454
+ };
455
+ };
456
+ /**
457
+ * This function reads one run of a memory cell from the lines of the memory client. A run is void
458
+ * when the client wrote an error or no `done` line, or when the cgroup reads other limits than the
459
+ * cell. A throttle run is also void when the client did not lock its pages, or on a kernel with
460
+ * another HZ. It is void too when the judge reads less than `read` of its steps above `memory.high`.
461
+ * A step is not read when its usage did not rise by one batch: then a reclaim freed pages, or the
462
+ * step charged two batches.
463
+ */
464
+ export declare const measureMemory: (run: Run, expected: MemoryPrediction) => Measured;
415
465
  /**
416
466
  * This module reads one run of a paused consumer against its law. Two members of a group each hold
417
467
  * one partition. A SIGSTOP stops the first member while it holds a batch, and a SIGCONT ends that
@@ -1191,11 +1241,15 @@ interface Lab {
1191
1241
  t0: number;
1192
1242
  t1: number;
1193
1243
  } | null>;
1194
- /** This method starts the client with `args`. Each file is in its container before it starts. */
1244
+ /**
1245
+ * This method starts the client with `args`. Each file is in its container before it starts. With
1246
+ * `cgroup`, the lab writes each file of the client cgroup and reads it back. Then it makes the file
1247
+ * `/tmp/cgroup` in the container: the client waits for it.
1248
+ */
1195
1249
  probe(args: readonly string[], files?: ReadonlyArray<{
1196
1250
  readonly content: string;
1197
1251
  readonly target: string;
1198
- }>): Promise<Probe>;
1252
+ }>, cgroup?: Readonly<Record<string, string>>): Promise<Probe>;
1199
1253
  /**
1200
1254
  * This method waits for the next clock line of the prober, which gives the count of lost
1201
1255
  * records. It gives null when no clock line comes in 5 s, because then nothing tells the count.
@@ -2198,6 +2252,11 @@ interface Measured {
2198
2252
  readonly ports?: PortsReading;
2199
2253
  /** This record is what a run of a conntrack cell measured: the flows, the count, and when a slot came back. */
2200
2254
  readonly conntrack?: ConntrackReading;
2255
+ /**
2256
+ * This record is what a run of a memory cell measured: each step of a growth, or the end of each task of an OOM.
2257
+ * A void run has it too when the judge read the lines of the client.
2258
+ */
2259
+ readonly memory?: MemoryReading;
2201
2260
  /** This record is what the second request of an HTTP client met, for a cell whose prediction says it. */
2202
2261
  readonly request?: RequestReading | null;
2203
2262
  /** This record is the time of each later band of a driver cell (`DriverBand.then`). */
@@ -2425,6 +2484,128 @@ export declare const DEBUG = "the record is of a local debug run, and no page re
2425
2484
  * of a schedule refuses it. A commit with changes to tracked files is not a pin.
2426
2485
  */
2427
2486
  export declare const recordProblems: (record: Pinnable) => string[];
2487
+ /**
2488
+ * The disk tier applies a disk plan of `@mark1russell7/rigor-chaos` to the files of a program. Each fault starts one new
2489
+ * container of the shipped image `lazyfs`. LazyFS is a FUSE file system that keeps each write in its cache until an
2490
+ * fsync.
2491
+ *
2492
+ * The writer of the subject writes its files on the mount of LazyFS, and the fault stops it at its point. Then
2493
+ * `lazyfs::clear-cache` loses each write of data after the last fsync: the state of the disk after a power cut. LazyFS
2494
+ * applies each new file, each rename and each unlink at once, so the cut keeps each directory entry. This is the rule
2495
+ * of the kind `lose-unsynced`. The check of the subject reads the files that the disk kept, and writes one JSON value. The record
2496
+ * keeps that value.
2497
+ *
2498
+ * A point at a step uses the stop points of `@mark1russell7/rigor-testkit/stop` in the writer: the writer stops itself
2499
+ * at the step with `SIGKILL`. A point at a time stops the writer with `SIGKILL` after that time from its start.
2500
+ *
2501
+ * The container is privileged: it needs `/dev/fuse` and a mount. The AppArmor profile of Docker refuses a FUSE mount in
2502
+ * a container that is not privileged. Thus the tier operates only in CI, in the workflow `disk.yml`.
2503
+ */
2504
+ /** The folder of the subject in the container. */
2505
+ export declare const DISK_SUBJECT = "/opt/subject";
2506
+ /** The mount of LazyFS in the container. The writer operates in this folder. */
2507
+ export declare const DISK_MOUNT = "/mnt/disk";
2508
+ /** The folder that holds the files under the mount. The check operates in this folder after the fault. */
2509
+ export declare const DISK_ROOT = "/var/disk";
2510
+ /** The format of a record of the disk tier. */
2511
+ export declare const DISK_RECORD_FORMAT = "harness-disk/1";
2512
+ /** The subject of the disk tier: a folder with a writer and a check. */
2513
+ interface DiskSubject {
2514
+ /** The name of the subject, for the record. */
2515
+ readonly name: string;
2516
+ /** The folder of the subject on this machine. The tier copies it to `DISK_SUBJECT` in each container. */
2517
+ readonly folder: string;
2518
+ /** The argv of the writer, with no shell. It operates in `DISK_MOUNT`. An example is `["node", "/opt/subject/writer.mjs"]`. */
2519
+ readonly writer: readonly [string, ...string[]];
2520
+ /** The argv of the check, with no shell. It operates in `DISK_ROOT` after the fault, and writes one JSON value. */
2521
+ readonly check: readonly [string, ...string[]];
2522
+ /** The variables of the environment of the writer and of the check. */
2523
+ readonly env?: Readonly<Record<string, string>>;
2524
+ /** The time in ms for the writer of a fault at a step. The default is 60 000. After it, the writer gets `SIGKILL`. */
2525
+ readonly timeoutMs?: number;
2526
+ }
2527
+ /** The options of `openDiskLab`. */
2528
+ interface DiskLabOptions {
2529
+ readonly subject: DiskSubject;
2530
+ /** The commit of the code that operates, and if its tracked files have changes. The record keeps it. */
2531
+ readonly code: RecordCode;
2532
+ }
2533
+ /** The image of the disk tier: its tag, and the record of its build. */
2534
+ interface DiskImage {
2535
+ readonly tag: string;
2536
+ readonly build?: BuildRecord;
2537
+ }
2538
+ /** A disk lab holds the parts that stay the same from one fault of a plan to the next. */
2539
+ interface DiskLab {
2540
+ readonly subject: DiskSubject;
2541
+ /** The sha256 of the path and the content of each file of the subject folder. */
2542
+ readonly digest: string;
2543
+ readonly image: DiskImage;
2544
+ readonly code: RecordCode;
2545
+ readonly substrate: Substrate;
2546
+ }
2547
+ /** The record of the writer of one fault. */
2548
+ interface DiskWriterRecord {
2549
+ /** The exit code of the writer. A stop with `SIGKILL` gives 137. */
2550
+ readonly exit: number;
2551
+ /** This value is `true` when the fault stopped the writer at its point. A writer that ends first gives `false`. */
2552
+ readonly stopped: boolean;
2553
+ /** The number of the stop points that the writer got to. */
2554
+ readonly steps: number;
2555
+ /** The last stop point that the writer got to, or `null` when it got to no point. */
2556
+ readonly lastStep: number | null;
2557
+ readonly lastLabel: string | null;
2558
+ /** The time in ms from the start of the writer to its end. */
2559
+ readonly ms: number;
2560
+ /** The last characters of the output of the writer. */
2561
+ readonly output: string;
2562
+ }
2563
+ /** The record of one fault of a disk plan. */
2564
+ interface DiskRecord {
2565
+ readonly format: typeof DISK_RECORD_FORMAT;
2566
+ readonly fault: DiskFault;
2567
+ readonly subject: {
2568
+ readonly name: string;
2569
+ readonly digest: string;
2570
+ };
2571
+ /** The image: its tag, the id of the image of the container, and the record of its build. */
2572
+ readonly image: DiskImage & {
2573
+ readonly id: string;
2574
+ };
2575
+ readonly code: RecordCode;
2576
+ readonly substrate: Substrate;
2577
+ readonly writer: DiskWriterRecord;
2578
+ /** The JSON value that the check wrote: what the disk kept. */
2579
+ readonly persisted: unknown;
2580
+ /** The time when `runDiskFault` started the fault, in ISO 8601. */
2581
+ readonly at: string;
2582
+ }
2583
+ /** This function gives each problem of a subject of the disk tier. An empty list means that the subject is correct. */
2584
+ export declare const diskSubjectProblems: (subject: DiskSubject) => string[];
2585
+ /** This function gives the sha256 of the path and the content of each file under a folder, in a stable sequence. */
2586
+ export declare const folderDigest: (folder: string) => string;
2587
+ /**
2588
+ * This function builds the image `lazyfs` once, and gives the lab of a subject. It throws a `RangeError` for a subject
2589
+ * with problems. The lab reads the substrate of this machine: a container lab is the layer E1.
2590
+ */
2591
+ export declare const openDiskLab: (options: DiskLabOptions) => Promise<DiskLab>;
2592
+ /**
2593
+ * This function applies one fault of a disk plan in one new container, and gives its record. It throws a `RangeError`
2594
+ * for a fault with problems. The promise rejects when LazyFS does not clear its cache, or when the check does not end
2595
+ * with the code 0 and one JSON value. Thus a check that cannot read the disk gives no record. The time limit of the
2596
+ * cut also covers the write of the command to LazyFS: that write waits when LazyFS did not start.
2597
+ */
2598
+ export declare const runDiskFault: (lab: DiskLab, fault: DiskFault) => Promise<DiskRecord>;
2599
+ /** These are the parts of a disk record that tell if it pins its code and its image. */
2600
+ interface DiskPinnable {
2601
+ readonly code?: RecordCode | undefined;
2602
+ readonly image: DiskImage;
2603
+ }
2604
+ /**
2605
+ * This function gives each problem of the pins of a disk record. The pins are the commit of the code and the image with
2606
+ * its build record. A checkout with changes is also a problem. A record with a problem is not a record.
2607
+ */
2608
+ export declare const diskRecordProblems: (record: DiskPinnable) => string[];
2428
2609
  /**
2429
2610
  * This function does one run of a recovery drill:
2430
2611
  * - The set converges, and it loses its writes. The tenants get their data, and a hash reads it.
@@ -2777,4 +2958,4 @@ export declare const environmentCounts: (cell: Cell, runs: number) => number[];
2777
2958
  * Each environment does a warm-up first, and the result keeps it apart from the counted runs.
2778
2959
  */
2779
2960
  export declare const runCell: (cell: Cell, say?: (line: string) => void) => Promise<CellResult>;
2780
- export { type Agent, type BuildImage, type BuildRecord, CLIENT_CAPABILITIES, type CallReading, type Cell, type CellResult, type Client, type ClientCapability, type ClientImage, type ClockPair, type Cloud, type Cluster, type ClusterClientAt, type ClusterLab, type ClusterStage, type ConntrackPrediction, type ConntrackReading, type ContextFile, type CountBand, type Crossings, type Cut, type Decision, type DeliveryPrediction, type DeliveryReading, type DeliveryStream, type Drill, type DrillRoom, type DriverBand, type DriverSocket, type DriverStep, type DriverStepTime, type ErrorOnTheWay, type EstimateVerdict, type Fabric, type FabricLab, type FabricManifest, type FabricParts, type Fault, type FaultOptions, 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 Hop, type HopEvent, type HopPlace, type HopSignal, type HopWrite, type Host, type HostSetting, type HostSysctl, type HttpProbe, type ImagePlan, type ImageSource, type Interval, type Jitter, type Kafka, type KafkaLab, type KafkaMember, type KafkaPause, type KernelRecord, type Lab, type Layer, type LeafViews, type LineCount, type LineMatch, type LoadBand, type LoadJudgement, type LoadPlan, type LoadPrediction, type LoadSpread, type LoadStream, type LoadVerdict, type Manifest, type ManifestHop, type Measured, type MemberLine, type MiddleboxEvent, type MiddleboxExpectation, type MiddleboxForm, type NetworkFault, type NodeLine, type Observer, type OplogRead, type OplogTime, type Outcome, type Outcomes, type Pair, type PairSets, type Pairing, type PartitionView, type PauseBand, type PauseCommit, type PausePrediction, type PauseReading, type Pinnable, type PinnedImage, type PortsPrediction, type PortsReading, type Prediction, type Probe, type ProbeEvent, type ProgramEvent, type ProxyHop, type ProxyTime, type QueueBand, type QueueConnection, type QueueConnectionReading, type QueueEnd, type QueuePrediction, type QueueReading, type ReconnectReading, type ReconnectVerdict, type Reconnects, type RecordCode, type Recovers, type RecoveryMeasured, type Reference, type Reordering, type ReplicaSet, type ReplicaSetLab, type ReplicaSetStage, type Replies, type RequestPrediction, type RequestReading, type RouteLine, type RouterHop, type RttRange, type Run, type RunBackup, type RunDrill, type RunEstimate, type RunFabric, type RunGroup, type RunLoad, type RunPart, type RunPause, type RunRoute, type RunStream, type RunTopology, type SentinelEvent, type SentinelStage, type Shipped, type ShippedImage, type Sibling, type SocketPlace, type Spread, type Stage, type StageBand, type StageVerdict, type StallReading, type Stamp, type Status, type StatusRow, type Subject, type Substrate, type SubstrateSource, type Target, type TimeFromFault, type Topology, type Toxic, type Verdict, type WallStamp, type Writes, type WsProbe, environmentProblems, isHopPlace, latestEndOf };
2961
+ export { type Agent, type BuildImage, type BuildRecord, CLIENT_CAPABILITIES, type CallReading, type Cell, type CellResult, type Client, type ClientCapability, type ClientImage, type ClockPair, type Cloud, type Cluster, type ClusterClientAt, type ClusterLab, type ClusterStage, type ConntrackPrediction, type ConntrackReading, type ContextFile, type CountBand, type Crossings, type Cut, type Decision, type DeliveryPrediction, type DeliveryReading, type DeliveryStream, type DiskImage, type DiskLab, type DiskLabOptions, type DiskPinnable, type DiskRecord, type DiskSubject, type DiskWriterRecord, type Drill, type DrillRoom, type DriverBand, type DriverSocket, type DriverStep, type DriverStepTime, type ErrorOnTheWay, type EstimateVerdict, type Fabric, type FabricLab, type FabricManifest, type FabricParts, type Fault, type FaultOptions, 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 Hop, type HopEvent, type HopPlace, type HopSignal, type HopWrite, type Host, type HostSetting, type HostSysctl, type HttpProbe, type ImagePlan, type ImageSource, type Interval, type Jitter, type Kafka, type KafkaLab, type KafkaMember, type KafkaPause, type KernelRecord, type Lab, type Layer, type LeafViews, type LineCount, type LineMatch, type LoadBand, type LoadJudgement, type LoadPlan, type LoadPrediction, type LoadSpread, type LoadStream, type LoadVerdict, type Manifest, type ManifestHop, type Measured, type MemberLine, type MemoryLimits, type MemoryOomPrediction, type MemoryOomTask, type MemoryPrediction, type MemoryReading, type MemoryStep, type MemoryStepReading, type MemoryTaskReading, type MemoryThrottlePrediction, type MiddleboxEvent, type MiddleboxExpectation, type MiddleboxForm, type NetworkFault, type NodeLine, type Observer, type OplogRead, type OplogTime, type Outcome, type Outcomes, type Pair, type PairSets, type Pairing, type PartitionView, type PauseBand, type PauseCommit, type PausePrediction, type PauseReading, type Pinnable, type PinnedImage, type PortsPrediction, type PortsReading, type Prediction, type Probe, type ProbeEvent, type ProgramEvent, type ProxyHop, type ProxyTime, type QueueBand, type QueueConnection, type QueueConnectionReading, type QueueEnd, type QueuePrediction, type QueueReading, type ReconnectReading, type ReconnectVerdict, type Reconnects, type RecordCode, type Recovers, type RecoveryMeasured, type Reference, type Reordering, type ReplicaSet, type ReplicaSetLab, type ReplicaSetStage, type Replies, type RequestPrediction, type RequestReading, type RouteLine, type RouterHop, type RttRange, type Run, type RunBackup, type RunDrill, type RunEstimate, type RunFabric, type RunGroup, type RunLoad, type RunPart, type RunPause, type RunRoute, type RunStream, type RunTopology, type SentinelEvent, type SentinelStage, type Shipped, type ShippedImage, type Sibling, type SocketPlace, type Spread, type Stage, type StageBand, type StageVerdict, type StallReading, type Stamp, type Status, type StatusRow, type Subject, type Substrate, type SubstrateSource, type Target, type TimeFromFault, type Topology, type Toxic, type Verdict, type WallStamp, type Writes, type WsProbe, environmentProblems, isHopPlace, latestEndOf };