@mark1russell7/harness 0.15.8 → 0.15.9
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/README.md +6 -1
- package/build/{image-CsPgXjcZ.js → image-D509StXX.js} +3 -2
- package/build/image-D509StXX.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +45 -51
- package/build/index.js.map +1 -1
- package/build/schema.js +1 -1
- package/package.json +10 -3
- package/build/image-CsPgXjcZ.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { A as unlockedManifests, B as environmentProblems, C as programOf, D as subjectProblems, E as subjectClient, F as jarVersions, H as latestEndOf, I as locksOf, L as npmVersions, M as LOCK_NAMES, N as cargoVersions, O as targetImageOf, P as goVersions, R as versionsOf, S as planOf, T as shippedSource, U as requestFirst, V as isHopPlace, _ as kafkaClientImage, a as SHIPPED_NAMES, b as nodeHttpImage, c as buildRecordOf, d as harnessImage, f as harnessVersion, g as inContext, h as imageProblems, i as SHIPPED_CLIENTS, j as unpinnedBases, k as targetSourceOf, l as goHttpImage, m as imageOf, n as PINNED, o as amqpClientImage, p as hikariClientImage, r as REPOSITORY, s as basesOf, t as CLIENT_NAMES, u as grpcClientImage, v as mongoClientImage, w as routerImage, x as pgClientImage, y as nodeClientImage, z as CLIENT_CAPABILITIES } from "./image-
|
|
1
|
+
import { A as unlockedManifests, B as environmentProblems, C as programOf, D as subjectProblems, E as subjectClient, F as jarVersions, H as latestEndOf, I as locksOf, L as npmVersions, M as LOCK_NAMES, N as cargoVersions, O as targetImageOf, P as goVersions, R as versionsOf, S as planOf, T as shippedSource, U as requestFirst, V as isHopPlace, _ as kafkaClientImage, a as SHIPPED_NAMES, b as nodeHttpImage, c as buildRecordOf, d as harnessImage, f as harnessVersion, g as inContext, h as imageProblems, i as SHIPPED_CLIENTS, j as unpinnedBases, k as targetSourceOf, l as goHttpImage, m as imageOf, n as PINNED, o as amqpClientImage, p as hikariClientImage, r as REPOSITORY, s as basesOf, t as CLIENT_NAMES, u as grpcClientImage, v as mongoClientImage, w as routerImage, x as pgClientImage, y as nodeClientImage, z as CLIENT_CAPABILITIES } from "./image-D509StXX.js";
|
|
2
2
|
import { quantity, valueIn } from "@mark1russell7/quantity";
|
|
3
3
|
import { median, medianInterval as medianInterval$1, quantile, quantileSorted } from "@mark1russell7/rigor-statistics";
|
|
4
4
|
import { rungVerdict } from "@mark1russell7/rigor-bench";
|
|
5
5
|
import { closedLoopPlan, measureLoad, schedule, scheduleHeld } from "@mark1russell7/rigor-chaos";
|
|
6
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
6
7
|
import { createHash, randomBytes } from "node:crypto";
|
|
7
8
|
import { execFile } from "node:child_process";
|
|
8
9
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
@@ -3858,7 +3859,7 @@ const openFabric = async (parts) => {
|
|
|
3858
3859
|
}
|
|
3859
3860
|
if (lacks.length === 0) return;
|
|
3860
3861
|
if (Date.now() > deadline) throw new Error(`the fabric is not ready: ${lacks.join("; ")}`);
|
|
3861
|
-
await
|
|
3862
|
+
await setTimeout$1(READY_POLL_MS);
|
|
3862
3863
|
}
|
|
3863
3864
|
},
|
|
3864
3865
|
async sessions() {
|
|
@@ -4043,7 +4044,6 @@ const TAIL_LINES = 60;
|
|
|
4043
4044
|
const OUTPUT_LINES = 2e3;
|
|
4044
4045
|
/** This time is how long a write of a hop waits for the line that confirms it, in milliseconds. */
|
|
4045
4046
|
const CONFIRM_MS = 1e4;
|
|
4046
|
-
const sleep$6 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4047
4047
|
/** This function gives the arguments of the injector for the options of a fault. */
|
|
4048
4048
|
const optionArgs = (options) => [
|
|
4049
4049
|
...options.direction === void 0 ? [] : ["--direction", options.direction],
|
|
@@ -4943,7 +4943,7 @@ const openLab = async (target, kind = "tcp", topology) => {
|
|
|
4943
4943
|
};
|
|
4944
4944
|
while (!confirmed()) {
|
|
4945
4945
|
if (Date.now() - started > CONFIRM_MS) throw new Error(`the hop ${event.hop} did not confirm the write of ${event.write.path}: no line "${confirm}" in ${CONFIRM_MS / 1e3} s`);
|
|
4946
|
-
await
|
|
4946
|
+
await setTimeout$1(50);
|
|
4947
4947
|
}
|
|
4948
4948
|
}
|
|
4949
4949
|
return stamp;
|
|
@@ -5111,7 +5111,6 @@ const STOP_MS = 5e3;
|
|
|
5111
5111
|
const STANDBY_READY = "database system is ready to accept read-only connections";
|
|
5112
5112
|
/** This text is the write of the client, with its sequence number. */
|
|
5113
5113
|
const INSERT = `INSERT INTO ${TABLE} VALUES ($n)`;
|
|
5114
|
-
const sleep$5 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
5115
5114
|
/** This function gives the argv of one statement in psql, on the server in the same container. */
|
|
5116
5115
|
const psql = (statement) => [
|
|
5117
5116
|
"psql",
|
|
@@ -5171,7 +5170,7 @@ const untilStreaming = async (lab, state) => {
|
|
|
5171
5170
|
const seen = await lab.exec(psql("SELECT sync_state FROM pg_stat_replication WHERE state = 'streaming'"));
|
|
5172
5171
|
if (seen === state) return;
|
|
5173
5172
|
if (Date.now() - started > SETUP_MS) throw new Error(`the standby did not stream as ${state} in ${SETUP_MS} ms: it reports "${seen}"`);
|
|
5174
|
-
await
|
|
5173
|
+
await setTimeout$1(100);
|
|
5175
5174
|
}
|
|
5176
5175
|
};
|
|
5177
5176
|
/**
|
|
@@ -5201,7 +5200,7 @@ const untilSteady = async (probe) => {
|
|
|
5201
5200
|
const started = Date.now();
|
|
5202
5201
|
while (probe.events.filter((event) => event.ev === "ack").length < STEADY$4) {
|
|
5203
5202
|
if (Date.now() - started > SETUP_MS) throw new Error(`the client did not write ${STEADY$4} times in ${SETUP_MS} ms`);
|
|
5204
|
-
await
|
|
5203
|
+
await setTimeout$1(10);
|
|
5205
5204
|
}
|
|
5206
5205
|
};
|
|
5207
5206
|
/** This function gives the count of lost records in the latest clock line of the prober. */
|
|
@@ -5229,11 +5228,11 @@ const pairOnce = async (lab, standby, cell, environment, index, dry = false) =>
|
|
|
5229
5228
|
fault = await lab.fault("blackhole", "target", { peers: peersOf$1(pair, standby.ip, lab) });
|
|
5230
5229
|
const started = Date.now();
|
|
5231
5230
|
for (const at of cancelsOf(pair, holdNs)) {
|
|
5232
|
-
await
|
|
5231
|
+
await setTimeout$1(Math.max(0, at / 1e6 - (Date.now() - started)));
|
|
5233
5232
|
await lab.exec(psql("SELECT count(pg_cancel_backend(pid)) FROM pg_stat_activity WHERE wait_event = 'SyncRep'"));
|
|
5234
5233
|
}
|
|
5235
5234
|
heal = await lab.signal("KILL", fault.t0 + holdNs);
|
|
5236
|
-
await
|
|
5235
|
+
await setTimeout$1(LAST_WRITE_MS);
|
|
5237
5236
|
if (cell.target.kill !== void 0) await lab.exec(cell.target.kill);
|
|
5238
5237
|
}
|
|
5239
5238
|
await probe.go().catch(() => void 0);
|
|
@@ -5472,7 +5471,6 @@ const viewOf = (group, ips, sentinels, members) => {
|
|
|
5472
5471
|
why: "healthy"
|
|
5473
5472
|
};
|
|
5474
5473
|
};
|
|
5475
|
-
const sleep$4 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
5476
5474
|
/** This time is the longest that a group takes to converge before a run, or after it. */
|
|
5477
5475
|
const CONVERGE_MS = 24e4;
|
|
5478
5476
|
/**
|
|
@@ -5667,7 +5665,7 @@ const openGroupLab = async (group, options = {}) => {
|
|
|
5667
5665
|
}));
|
|
5668
5666
|
calm = last.healthy ? calm + 1 : 0;
|
|
5669
5667
|
if (calm >= 2 && last.primary !== null) return last.primary;
|
|
5670
|
-
await
|
|
5668
|
+
await setTimeout$1(1e3);
|
|
5671
5669
|
}
|
|
5672
5670
|
throw new Error(`the group did not converge in ${within} ms: ${last.why}`);
|
|
5673
5671
|
},
|
|
@@ -5752,7 +5750,7 @@ const openGroupLab = async (group, options = {}) => {
|
|
|
5752
5750
|
const started = Date.now();
|
|
5753
5751
|
while (await cli(member, ["PING"]).catch(() => "") !== "PONG") {
|
|
5754
5752
|
if (Date.now() - started > 3e4) throw new Error(`${member} did not start again`);
|
|
5755
|
-
await
|
|
5753
|
+
await setTimeout$1(200);
|
|
5756
5754
|
}
|
|
5757
5755
|
},
|
|
5758
5756
|
failover(coordinated) {
|
|
@@ -6003,7 +6001,7 @@ const groupOnce = async (lab, cell, environment, index) => {
|
|
|
6003
6001
|
await healed;
|
|
6004
6002
|
const after = heal?.t0 ?? t0;
|
|
6005
6003
|
return waitFor$3(client, (event) => event.ev === "ack" && event.t > after, deadline);
|
|
6006
|
-
})()) !== void 0) await
|
|
6004
|
+
})()) !== void 0) await setTimeout$1(TAIL_MS$3);
|
|
6007
6005
|
await healed;
|
|
6008
6006
|
} finally {
|
|
6009
6007
|
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
@@ -6170,7 +6168,6 @@ const statusViewOf = (set, ips, status) => {
|
|
|
6170
6168
|
};
|
|
6171
6169
|
};
|
|
6172
6170
|
/** This function waits for a time, in ms. */
|
|
6173
|
-
const sleep$3 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
6174
6171
|
/** These are the arguments of replSetStepDown: the time that the old primary cannot stand again, and the wait for a secondary to catch up. */
|
|
6175
6172
|
const STEP_DOWN = {
|
|
6176
6173
|
seconds: 60,
|
|
@@ -6318,7 +6315,7 @@ const openReplicaSetLab = async (set, backups = false) => {
|
|
|
6318
6315
|
calm = last.healthy ? calm + 1 : 0;
|
|
6319
6316
|
if (last.primary !== null) known = last.primary;
|
|
6320
6317
|
if (calm >= 2 && last.primary !== null) return last.primary;
|
|
6321
|
-
await
|
|
6318
|
+
await setTimeout$1(1e3);
|
|
6322
6319
|
}
|
|
6323
6320
|
throw new Error(`the set did not converge in ${within} ms: ${last.why}`);
|
|
6324
6321
|
};
|
|
@@ -6424,7 +6421,7 @@ const openReplicaSetLab = async (set, backups = false) => {
|
|
|
6424
6421
|
const started = Date.now();
|
|
6425
6422
|
while (!(await shell(member, "print(db.hello().ok)").catch(() => "")).includes("1")) {
|
|
6426
6423
|
if (Date.now() - started > 6e4) throw new Error(`${member} did not start again`);
|
|
6427
|
-
await
|
|
6424
|
+
await setTimeout$1(500);
|
|
6428
6425
|
}
|
|
6429
6426
|
},
|
|
6430
6427
|
exec(member, argv) {
|
|
@@ -6646,10 +6643,10 @@ const replicaSetOnce = async (lab, cell, environment, index) => {
|
|
|
6646
6643
|
const t1 = fault.t1;
|
|
6647
6644
|
const old = `${lab.members[primary].ip}:${set.port}`;
|
|
6648
6645
|
const sentAt = (n) => client.events.find((event) => event.ev === "sent" && Number(event["n"]) === n)?.t ?? -Infinity;
|
|
6649
|
-
if (await waitFor$2(client, (event) => event.ev === "ack" && sentAt(Number(event["n"])) > t1 && (lands === "same" || typeof event["at"] === "string" && event["at"] !== old), deadlineOf(cell)) !== void 0) await
|
|
6646
|
+
if (await waitFor$2(client, (event) => event.ev === "ack" && sentAt(Number(event["n"])) > t1 && (lands === "same" || typeof event["at"] === "string" && event["at"] !== old), deadlineOf(cell)) !== void 0) await setTimeout$1(TAIL_MS$2);
|
|
6650
6647
|
if (healing !== null) {
|
|
6651
6648
|
await healed.catch(() => void 0);
|
|
6652
|
-
await
|
|
6649
|
+
await setTimeout$1(afterLiftOf(cell));
|
|
6653
6650
|
}
|
|
6654
6651
|
} finally {
|
|
6655
6652
|
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
@@ -6706,7 +6703,7 @@ const until = async (what, check, within) => {
|
|
|
6706
6703
|
const started = Date.now();
|
|
6707
6704
|
while (!await check().catch(() => false)) {
|
|
6708
6705
|
if (Date.now() - started > within) throw new Error(`${what} did not come in ${within} ms`);
|
|
6709
|
-
await
|
|
6706
|
+
await setTimeout$1(500);
|
|
6710
6707
|
}
|
|
6711
6708
|
};
|
|
6712
6709
|
/** This function gives the time that the client sent a write. Zero is no write. */
|
|
@@ -6793,7 +6790,7 @@ const backupsOf = async (lab, drill, primary, writer) => {
|
|
|
6793
6790
|
}];
|
|
6794
6791
|
const every = valueIn(drill.sliceEvery, "s") * 1e3;
|
|
6795
6792
|
for (let slice = 1; slice <= drill.slices; slice += 1) {
|
|
6796
|
-
await
|
|
6793
|
+
await setTimeout$1(Math.max(0, ended + slice * every - Date.now()));
|
|
6797
6794
|
const out = `${VAULT}/slice-${slice}`;
|
|
6798
6795
|
const begun = Date.now();
|
|
6799
6796
|
await lab.vault([
|
|
@@ -6837,7 +6834,7 @@ const lose = async (lab, drill, primary, last) => {
|
|
|
6837
6834
|
const parts = drill.recovery === "restore" ? [primary, ...lab.set.members.filter((name) => name !== primary)] : [primary];
|
|
6838
6835
|
const age = valueIn(drill.age, "s");
|
|
6839
6836
|
const at = last === null || drill.quiet === true ? void 0 : last.t + age * 1e9;
|
|
6840
|
-
if (at === void 0) await
|
|
6837
|
+
if (at === void 0) await setTimeout$1(age * 1e3);
|
|
6841
6838
|
const stamps = await Promise.all(parts.map((part) => lab.signal(part, "KILL", at)));
|
|
6842
6839
|
for (const part of parts) {
|
|
6843
6840
|
await lab.exec(part, [
|
|
@@ -6982,11 +6979,11 @@ const drillOnce = async (lab, cell, environment, index) => {
|
|
|
6982
6979
|
"--from",
|
|
6983
6980
|
String(second)
|
|
6984
6981
|
]);
|
|
6985
|
-
if (await waitFor$2(successor, (event) => event.ev === "ack", deadlineOf(cell)) !== void 0) await
|
|
6982
|
+
if (await waitFor$2(successor, (event) => event.ev === "ack", deadlineOf(cell)) !== void 0) await setTimeout$1(TAIL_MS$2);
|
|
6986
6983
|
} else {
|
|
6987
6984
|
const old = `${lab.members[primary].ip}:${set.port}`;
|
|
6988
6985
|
const sentAt = (n) => writer.events.find((event) => event.ev === "sent" && Number(event["n"]) === n)?.t ?? -Infinity;
|
|
6989
|
-
if (await waitFor$2(writer, (event) => event.ev === "ack" && sentAt(Number(event["n"])) > stamp.t1 && typeof event["at"] === "string" && event["at"] !== old, deadlineOf(cell)) !== void 0) await
|
|
6986
|
+
if (await waitFor$2(writer, (event) => event.ev === "ack" && sentAt(Number(event["n"])) > stamp.t1 && typeof event["at"] === "string" && event["at"] !== old, deadlineOf(cell)) !== void 0) await setTimeout$1(TAIL_MS$2);
|
|
6990
6987
|
await lab.restart(primary);
|
|
6991
6988
|
}
|
|
6992
6989
|
} finally {
|
|
@@ -7165,7 +7162,6 @@ const clusterCutOf = (cluster, members, client, part, cuts) => {
|
|
|
7165
7162
|
};
|
|
7166
7163
|
return { peers: [...others, client] };
|
|
7167
7164
|
};
|
|
7168
|
-
const sleep$2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
7169
7165
|
/**
|
|
7170
7166
|
* This function opens one environment of a cluster cell:
|
|
7171
7167
|
* - one new network, with each node, the client and the admin on it.
|
|
@@ -7327,7 +7323,7 @@ const openClusterLab = async (cluster) => {
|
|
|
7327
7323
|
calm = last.healthy ? calm + 1 : 0;
|
|
7328
7324
|
if (last.primary !== null) known = last.primary;
|
|
7329
7325
|
if (calm >= 2 && last.primary !== null) return last.primary;
|
|
7330
|
-
await
|
|
7326
|
+
await setTimeout$1(1e3);
|
|
7331
7327
|
}
|
|
7332
7328
|
throw new Error(`the queue did not converge in ${within} ms: ${last.why}`);
|
|
7333
7329
|
};
|
|
@@ -7343,7 +7339,7 @@ const openClusterLab = async (cluster) => {
|
|
|
7343
7339
|
const running = (text.trim() === "" ? {} : toolJsonOf(text)).running_nodes ?? [];
|
|
7344
7340
|
if (cluster.members.every((name) => running.includes(nodeNameOf(name)))) break;
|
|
7345
7341
|
if (Date.now() - started > 12e4) throw new Error(`the cluster did not form in 120 s: ${running.join(", ")} run`);
|
|
7346
|
-
await
|
|
7342
|
+
await setTimeout$1(1e3);
|
|
7347
7343
|
}
|
|
7348
7344
|
const declared = lastLine(await output(commander, [
|
|
7349
7345
|
"node",
|
|
@@ -7463,7 +7459,7 @@ const openClusterLab = async (cluster) => {
|
|
|
7463
7459
|
"check_running"
|
|
7464
7460
|
]).then(() => true).catch(() => false)) {
|
|
7465
7461
|
if (Date.now() - begun > 12e4) throw new Error(`${member} did not start again`);
|
|
7466
|
-
await
|
|
7462
|
+
await setTimeout$1(1e3);
|
|
7467
7463
|
}
|
|
7468
7464
|
},
|
|
7469
7465
|
stepDown(leader, to) {
|
|
@@ -7634,7 +7630,7 @@ const stampOf = async (lab, client, logFrom, marks, wall) => {
|
|
|
7634
7630
|
},
|
|
7635
7631
|
line
|
|
7636
7632
|
};
|
|
7637
|
-
await
|
|
7633
|
+
await setTimeout$1(100);
|
|
7638
7634
|
}
|
|
7639
7635
|
return {
|
|
7640
7636
|
stamp: monotonicOf(wall, client.events),
|
|
@@ -7736,10 +7732,10 @@ const clusterOnce = async (lab, cell, environment, index) => {
|
|
|
7736
7732
|
healed.catch(() => void 0);
|
|
7737
7733
|
const t1 = fault.t1;
|
|
7738
7734
|
const sentAt = (n) => client.events.find((event) => event.ev === "sent" && Number(event["n"]) === n)?.t ?? -Infinity;
|
|
7739
|
-
if (await waitFor$1(client, (event) => event.ev === "ack" && sentAt(Number(event["n"])) > t1, deadlineOf(cell)) !== void 0) await
|
|
7735
|
+
if (await waitFor$1(client, (event) => event.ev === "ack" && sentAt(Number(event["n"])) > t1, deadlineOf(cell)) !== void 0) await setTimeout$1(TAIL_MS$1);
|
|
7740
7736
|
if (healing !== null) {
|
|
7741
7737
|
await healed.catch(() => void 0);
|
|
7742
|
-
await
|
|
7738
|
+
await setTimeout$1(TAIL_MS$1);
|
|
7743
7739
|
}
|
|
7744
7740
|
} finally {
|
|
7745
7741
|
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
@@ -7883,7 +7879,6 @@ const kafkaCutOf = (kafka, members, controller, part, cuts) => {
|
|
|
7883
7879
|
const bootstrapOf = (kafka) => kafka.brokers.map((name) => `${name}:${kafka.port}`).join(",");
|
|
7884
7880
|
/** This function gives the name of the topic of a run. A warm-up has the index -1. */
|
|
7885
7881
|
const topicOf = (environment, index) => `cells-e${environment}-r${index + 1}`;
|
|
7886
|
-
const sleep$1 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
7887
7882
|
/**
|
|
7888
7883
|
* This function opens one environment of a Kafka cell:
|
|
7889
7884
|
* - one new network, with each node, the client and the commander on it.
|
|
@@ -8023,7 +8018,7 @@ const openKafkaLab = async (kafka) => {
|
|
|
8023
8018
|
const read = await view().catch((error) => error.message.slice(0, 200));
|
|
8024
8019
|
if (typeof read !== "string" && read.brokers.length === kafka.brokers.length) return;
|
|
8025
8020
|
last = typeof read === "string" ? read : `${read.brokers.length} brokers are not fenced`;
|
|
8026
|
-
await
|
|
8021
|
+
await setTimeout$1(1e3);
|
|
8027
8022
|
}
|
|
8028
8023
|
throw new Error(`the brokers did not come up in ${within} ms: ${last}`);
|
|
8029
8024
|
},
|
|
@@ -8083,7 +8078,7 @@ const openKafkaLab = async (kafka) => {
|
|
|
8083
8078
|
}));
|
|
8084
8079
|
calm = last.healthy ? calm + 1 : 0;
|
|
8085
8080
|
if (calm >= 2 && last.primary !== null) return last.primary;
|
|
8086
|
-
await
|
|
8081
|
+
await setTimeout$1(1e3);
|
|
8087
8082
|
}
|
|
8088
8083
|
throw new Error(`the partition did not converge in ${within} ms: ${last.why}`);
|
|
8089
8084
|
},
|
|
@@ -8286,7 +8281,7 @@ const kafkaOnce = async (lab, cell, environment, index) => {
|
|
|
8286
8281
|
undo.push(() => lab.lift("blackhole", leader, cuts));
|
|
8287
8282
|
heal = await lab.lift("blackhole", leader, cuts, fault.t0 + valueIn(cell.hold, "s") * 1e9);
|
|
8288
8283
|
undo.length = 0;
|
|
8289
|
-
await
|
|
8284
|
+
await setTimeout$1(KAFKA_TAIL_MS);
|
|
8290
8285
|
} finally {
|
|
8291
8286
|
for (const step of undo.reverse()) await step().catch(() => void 0);
|
|
8292
8287
|
await client.stop();
|
|
@@ -8384,14 +8379,14 @@ const kafkaPauseOnce = async (lab, cell, environment, index) => {
|
|
|
8384
8379
|
firstEvents = first.events;
|
|
8385
8380
|
otherEvents = other.events;
|
|
8386
8381
|
const begun = Date.now();
|
|
8387
|
-
while (Date.now() - begun < PAUSE_READY_MS && !pauseReady(first.events, other.events)) await
|
|
8382
|
+
while (Date.now() - begun < PAUSE_READY_MS && !pauseReady(first.events, other.events)) await setTimeout$1(100);
|
|
8388
8383
|
if (pauseReady(first.events, other.events)) {
|
|
8389
8384
|
const seen = first.events.at(-1)?.t ?? 0;
|
|
8390
8385
|
const batch = await waitFor(first, (event) => event.ev === "processing" && event.t > seen, PAUSE_BATCH_MS);
|
|
8391
8386
|
if (batch !== void 0) {
|
|
8392
8387
|
fault = await first.signal("STOP", batch.t + valueIn(pause.stopAfter, "s") * 1e9);
|
|
8393
8388
|
heal = await first.signal("CONT", fault.t0 + hold * 1e9);
|
|
8394
|
-
await
|
|
8389
|
+
await setTimeout$1(KAFKA_TAIL_MS);
|
|
8395
8390
|
}
|
|
8396
8391
|
}
|
|
8397
8392
|
} finally {
|
|
@@ -8538,7 +8533,6 @@ const observerError = (cell, partial, within, dropped = () => false) => new Prom
|
|
|
8538
8533
|
};
|
|
8539
8534
|
look();
|
|
8540
8535
|
});
|
|
8541
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
8542
8536
|
/**
|
|
8543
8537
|
* This time is the pause between the client's first reply and the fault. It is more than Linux's
|
|
8544
8538
|
* TCP_DELACK_MAX of 200 ms. Thus the delayed ACK of the reply is out before the fault.
|
|
@@ -8578,7 +8572,7 @@ const driverOutcome = async (cell, current, within) => {
|
|
|
8578
8572
|
const started = Date.now();
|
|
8579
8573
|
while (Date.now() - started < within) {
|
|
8580
8574
|
if (settled(cell, current())) return;
|
|
8581
|
-
await
|
|
8575
|
+
await setTimeout$1(250);
|
|
8582
8576
|
}
|
|
8583
8577
|
};
|
|
8584
8578
|
/** This function gives the longest wait of a run of a driver cell for its outcome, in ms. */
|
|
@@ -8614,7 +8608,7 @@ const beforeOnce = async (lab, cell, environment, index) => {
|
|
|
8614
8608
|
...lab.topology === null ? {} : { topology: lab.topology }
|
|
8615
8609
|
});
|
|
8616
8610
|
await driverOutcome(cell, current, driverWithin(cell));
|
|
8617
|
-
await
|
|
8611
|
+
await setTimeout$1(TAIL_MS);
|
|
8618
8612
|
} finally {
|
|
8619
8613
|
await lab.lift(kind, faultAt, options);
|
|
8620
8614
|
await probe?.stop();
|
|
@@ -8670,8 +8664,8 @@ const LINES_MS = 5e3;
|
|
|
8670
8664
|
const linesCounted = async (lab, from, counts) => {
|
|
8671
8665
|
const started = Date.now();
|
|
8672
8666
|
const short = () => counts.some((each) => countOf(lab.server.slice(from), each.match) < each.count);
|
|
8673
|
-
while (short() && Date.now() - started < LINES_MS) await
|
|
8674
|
-
await
|
|
8667
|
+
while (short() && Date.now() - started < LINES_MS) await setTimeout$1(20);
|
|
8668
|
+
await setTimeout$1(250);
|
|
8675
8669
|
};
|
|
8676
8670
|
/** This function gives the netem specification of a cell: its latency, then the netem of its fault when it has one. */
|
|
8677
8671
|
const netemSpec = (cell, fault) => {
|
|
@@ -8752,13 +8746,13 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
8752
8746
|
await probe.until(["ready"], 15e3);
|
|
8753
8747
|
if (dry) {
|
|
8754
8748
|
if (cell.probe.mode !== "idle") await go();
|
|
8755
|
-
await
|
|
8749
|
+
await setTimeout$1(500);
|
|
8756
8750
|
} else {
|
|
8757
8751
|
const replyInFlight = cell.probe.mode === "inflight" && (server && cell.fault !== "mtu-blackhole" || cell.fault === "fin" || requestFirst(cell));
|
|
8758
8752
|
if (replyInFlight) {
|
|
8759
8753
|
await go();
|
|
8760
|
-
await
|
|
8761
|
-
} else await
|
|
8754
|
+
await setTimeout$1(200);
|
|
8755
|
+
} else await setTimeout$1(250);
|
|
8762
8756
|
const faultAt = cell.faultAt ?? (server ? "client" : "target");
|
|
8763
8757
|
const towardServerComesIn = faultAt === "target" || isHopPlace(faultAt) && faultAt.toward === "client";
|
|
8764
8758
|
const direction = cell.drops === void 0 ? void 0 : cell.drops === "to-server" === towardServerComesIn ? "in" : "out";
|
|
@@ -8873,7 +8867,7 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
8873
8867
|
};
|
|
8874
8868
|
fault = await apply();
|
|
8875
8869
|
try {
|
|
8876
|
-
if (cell.idleBefore !== void 0 && cell.probe.mode !== "idle") await
|
|
8870
|
+
if (cell.idleBefore !== void 0 && cell.probe.mode !== "idle") await setTimeout$1(valueIn(cell.idleBefore, "ms"));
|
|
8877
8871
|
if ((cell.probe.mode === "inflight" || cell.probe.mode === "stream" || cell.probe.mode === "schedule") && !replyInFlight) await go();
|
|
8878
8872
|
const { prediction } = cell;
|
|
8879
8873
|
const http = cell.probe.http !== void 0;
|
|
@@ -8882,8 +8876,8 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
8882
8876
|
...partial(),
|
|
8883
8877
|
fault
|
|
8884
8878
|
}), driverWithin(cell));
|
|
8885
|
-
else await
|
|
8886
|
-
await
|
|
8879
|
+
else await setTimeout$1(valueIn(prediction.window, "s") * 1e3);
|
|
8880
|
+
await setTimeout$1(TAIL_MS);
|
|
8887
8881
|
} else if (cell.probe.mode === "gap") {
|
|
8888
8882
|
const gap = cell.probe.http?.gap === void 0 ? 0 : valueIn(cell.probe.http.gap, "s");
|
|
8889
8883
|
const window = valueIn(prediction.detects ? prediction.high : prediction.window, "s");
|
|
@@ -8909,7 +8903,7 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
8909
8903
|
"eof",
|
|
8910
8904
|
"drop"
|
|
8911
8905
|
], window * 1e3).catch(() => void 0);
|
|
8912
|
-
await
|
|
8906
|
+
await setTimeout$1(MONITOR_MS);
|
|
8913
8907
|
const moved = laterMove(fabricOf().routes.slice(routesFrom), fault?.t0 ?? 0);
|
|
8914
8908
|
heal = moved === null ? null : {
|
|
8915
8909
|
t0: moved,
|
|
@@ -8934,7 +8928,7 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
8934
8928
|
"drop",
|
|
8935
8929
|
...http ? ["closed"] : []
|
|
8936
8930
|
], within).catch(() => void 0);
|
|
8937
|
-
} else await
|
|
8931
|
+
} else await setTimeout$1(valueIn(prediction.window, "s") * 1e3);
|
|
8938
8932
|
} finally {
|
|
8939
8933
|
await lift();
|
|
8940
8934
|
if (toxicFirst) await lab.toxic(null);
|
|
@@ -8954,8 +8948,8 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
8954
8948
|
...partial(),
|
|
8955
8949
|
server: lab.server.slice(serverFrom)
|
|
8956
8950
|
});
|
|
8957
|
-
while (!streamEnded(current(), stream) && !stopped() && Date.now() - started < within) await
|
|
8958
|
-
await
|
|
8951
|
+
while (!streamEnded(current(), stream) && !stopped() && Date.now() - started < within) await setTimeout$1(20);
|
|
8952
|
+
await setTimeout$1(TAIL_MS);
|
|
8959
8953
|
}
|
|
8960
8954
|
}
|
|
8961
8955
|
} finally {
|