@mark1russell7/harness 0.16.1 → 0.16.3

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 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-CHFQ55Ks.js";
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";
2
2
  import { Quantity } from "@mark1russell7/quantity";
3
3
  import { LoadMeasure, Schedule } from "@mark1russell7/rigor-chaos";
4
4
  import { StartedTestContainer } from "testcontainers";
@@ -865,15 +865,37 @@ export declare const PUMP_SLACK: Quantity;
865
865
  * directions, or one), or a reset on the next segment. It can also be an ICMP unreachable for each
866
866
  * segment, or a drop of each segment that is longer than a length. It can also be a drop of the
867
867
  * first ACK of each FIN that the namespace sends.
868
+ *
869
+ * A silence drops each packet of the namespace of a hop, in its three chains, and it names no peer.
870
+ * The links stay up and ARP continues, thus a connect through a silent router times out.
871
+ */
872
+ type NetworkFault = "blackhole" | "rst" | "reject" | "mtu" | "fin-ack" | "silence";
873
+ /**
874
+ * These are the options of a network fault: its direction and its protocol. A reject takes a code,
875
+ * an MTU drop a length, and a reset its handshake.
868
876
  */
869
- type NetworkFault = "blackhole" | "rst" | "reject" | "mtu" | "fin-ack";
870
- /** These are the options of a network fault: the direction of a black hole, the code of a reject, the length of an MTU drop. */
871
877
  interface FaultOptions {
872
- /** This direction is relative to the namespace of the rule: `in` drops what comes from the peer, `out` what goes to it. */
878
+ /**
879
+ * This direction is relative to the namespace of the rule: `in` acts on what comes from the peer,
880
+ * `out` on what goes to it. A black hole without it acts on both. A reject without it acts on `in`.
881
+ * At a router, `out` acts on what the router forwards through its device to the peer.
882
+ */
873
883
  readonly direction?: "in" | "out";
884
+ /**
885
+ * This protocol limits a black hole, a reject or an MTU drop. A black hole without it drops each
886
+ * protocol. A reject or an MTU drop without it acts only on TCP. The value `all` acts on each
887
+ * protocol. An MTU drop with `all` is a real black hole.
888
+ * Thus a path-MTU search with ping also sees it.
889
+ */
890
+ readonly protocol?: "tcp" | "udp" | "icmp" | "all";
874
891
  readonly code?: "host" | "net" | "port" | "admin";
875
892
  /** This length is the longest segment in bytes that an MTU drop lets through. */
876
893
  readonly above?: number;
894
+ /**
895
+ * This value lets each SYN of a reset pass. The connect then succeeds, and the next segment of
896
+ * the peer gets the reset. Without it, the SYN also gets the reset.
897
+ */
898
+ readonly handshake?: "pass";
877
899
  /** These are the addresses that the rule faces, in place of the peer of its place. */
878
900
  readonly peers?: readonly string[];
879
901
  }
@@ -1092,6 +1114,9 @@ interface Lab {
1092
1114
  * of the target. The fault is a black hole, or a reset that answers the next segment of the
1093
1115
  * client. At a proxy of a topology, the rules face the peer of the proxy on one side. The stamps
1094
1116
  * of the injector bracket it.
1117
+ *
1118
+ * A silence at a hop drops each packet of the hop. Thus a router stops its forward and its
1119
+ * answers, and ARP continues.
1095
1120
  */
1096
1121
  fault(kind: NetworkFault, at?: FaultPlace, options?: FaultOptions): Promise<{
1097
1122
  t0: number;
@@ -2750,4 +2775,4 @@ export declare const environmentCounts: (cell: Cell, runs: number) => number[];
2750
2775
  * Each environment does a warm-up first, and the result keeps it apart from the counted runs.
2751
2776
  */
2752
2777
  export declare const runCell: (cell: Cell, say?: (line: string) => void) => Promise<CellResult>;
2753
- 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 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 };
2778
+ 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 };
package/build/index.js CHANGED
@@ -4056,8 +4056,10 @@ const CONFIRM_MS = 1e4;
4056
4056
  /** This function gives the arguments of the injector for the options of a fault. */
4057
4057
  const optionArgs = (options) => [
4058
4058
  ...options.direction === void 0 ? [] : ["--direction", options.direction],
4059
+ ...options.protocol === void 0 ? [] : ["--protocol", options.protocol],
4059
4060
  ...options.code === void 0 ? [] : ["--code", options.code],
4060
- ...options.above === void 0 ? [] : ["--above", String(options.above)]
4061
+ ...options.above === void 0 ? [] : ["--above", String(options.above)],
4062
+ ...options.handshake === void 0 ? [] : ["--handshake", options.handshake]
4061
4063
  ];
4062
4064
  /** These are the actions of the injector that lift each network fault. */
4063
4065
  const LIFT = {
@@ -4065,7 +4067,31 @@ const LIFT = {
4065
4067
  rst: "clear-rst",
4066
4068
  reject: "clear-reject",
4067
4069
  mtu: "clear-mtu",
4068
- "fin-ack": "clear-fin-ack"
4070
+ "fin-ack": "clear-fin-ack",
4071
+ silence: "clear-silence"
4072
+ };
4073
+ /**
4074
+ * This function gives the argv of the injector for a network fault at a place, or for its lift. The
4075
+ * lab gives the peer of the place and, at a router, its device (`--via`). The peers of the options
4076
+ * replace the peer.
4077
+ *
4078
+ * A silence names no peer and takes no option. It acts only at a hop, and the side of the hop has no
4079
+ * effect on it.
4080
+ */
4081
+ const faultArgs = (kind, at, peer, via, options = {}, lift = false) => {
4082
+ const action = lift ? LIFT[kind] : kind;
4083
+ if (kind === "silence") {
4084
+ if (!isHopPlace(at)) throw new Error(`a silence drops each packet of the namespace of a hop, not of ${JSON.stringify(at)}`);
4085
+ if (Object.values(options).some((value) => value !== void 0)) throw new Error("a silence takes no options");
4086
+ return ["/opt/harness/inject", action];
4087
+ }
4088
+ return [
4089
+ "/opt/harness/inject",
4090
+ action,
4091
+ options.peers?.join(",") ?? peer,
4092
+ ...optionArgs(options),
4093
+ ...via
4094
+ ];
4069
4095
  };
4070
4096
  /** This function collects the JSON lines of a program. It gives each line to `also` too, when the caller gives it. */
4071
4097
  const lines = (also) => {
@@ -4167,6 +4193,22 @@ const endpointAfter = (hops, element) => {
4167
4193
  while (at <= hops.length && hops[at - 1].kind === "router") at += 1;
4168
4194
  return at;
4169
4195
  };
4196
+ /**
4197
+ * This function gives the run topology of a chain of hops, or null for a direct pair. Each hop gets
4198
+ * its namespace, its peer on each side and its own address on each side.
4199
+ */
4200
+ const runTopologyOf = (targetPeer, hops) => hops.length === 0 ? null : {
4201
+ targetPeer,
4202
+ hops: Object.fromEntries(hops.map((hop) => [hop.hop.name, {
4203
+ netns: hop.netns,
4204
+ client: hop.peer.client,
4205
+ target: hop.peer.target,
4206
+ address: {
4207
+ client: hop.ip.client,
4208
+ target: hop.ip.target
4209
+ }
4210
+ }]))
4211
+ };
4170
4212
  const STOP = { timeout: 0 };
4171
4213
  /** These are the values of CONFIG_HZ that Linux offers. */
4172
4214
  const RATES = [
@@ -4529,14 +4571,7 @@ const openLab = async (target, kind = "tcp", topology) => {
4529
4571
  const targetIp = fabric !== void 0 ? FABRIC_TARGET : first === hops.length + 1 ? serverIp : inChain[first - 1].ip.client;
4530
4572
  const targetPort = first === hops.length + 1 ? target.port : inChain[first - 1].hop.port;
4531
4573
  const targetPeer = inChain.length === 0 ? clientIp : inChain.at(-1).ip.target;
4532
- const placed = inChain.length === 0 ? null : {
4533
- targetPeer,
4534
- hops: Object.fromEntries(inChain.map((hop) => [hop.hop.name, {
4535
- netns: hop.netns,
4536
- client: hop.peer.client,
4537
- target: hop.peer.target
4538
- }]))
4539
- };
4574
+ const placed = runTopologyOf(targetPeer, inChain);
4540
4575
  const paused = runtime.container.getById(server.getId());
4541
4576
  let targetAdmin;
4542
4577
  let signaller;
@@ -4735,23 +4770,11 @@ const openLab = async (target, kind = "tcp", topology) => {
4735
4770
  },
4736
4771
  async fault(kind, at = "target", options = {}) {
4737
4772
  const [where, peer, via] = placeOf(at);
4738
- return stamped(where, [
4739
- "/opt/harness/inject",
4740
- kind,
4741
- options.peers?.join(",") ?? peer,
4742
- ...optionArgs(options),
4743
- ...via
4744
- ]);
4773
+ return stamped(where, faultArgs(kind, at, peer, via, options));
4745
4774
  },
4746
4775
  async lift(kind, at = "target", options = {}) {
4747
4776
  const [where, peer, via] = placeOf(at);
4748
- await output(where, [
4749
- "/opt/harness/inject",
4750
- LIFT[kind],
4751
- options.peers?.join(",") ?? peer,
4752
- ...optionArgs(options),
4753
- ...via
4754
- ]);
4777
+ await output(where, faultArgs(kind, at, peer, via, options, true));
4755
4778
  },
4756
4779
  async netem(spec, at = "target") {
4757
4780
  const [where, device] = deviceAt(at);