@mark1russell7/harness 0.16.11 → 0.16.12
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 +4 -1
- package/build/index.js +11 -5
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1355,6 +1355,9 @@ export declare const deviceOf: (route: string) => string;
|
|
|
1355
1355
|
* - each hop of the topology, on the network of each of its sides. A hop is a router, or a stock
|
|
1356
1356
|
* proxy with an injector sidecar in its namespace.
|
|
1357
1357
|
* - an injector sidecar in the namespace of the target.
|
|
1358
|
+
* - the commands of `setup` in the target, after the target is ready and before the first hop
|
|
1359
|
+
* starts. A hop can connect to the target at its start, as a service to its replica set. Then it
|
|
1360
|
+
* sees the target in the state that the cell needs.
|
|
1358
1361
|
* - the prober, a privileged container that loads the kernel program and watches the namespace of
|
|
1359
1362
|
* the client, of the target and of each hop.
|
|
1360
1363
|
*
|
|
@@ -1366,7 +1369,7 @@ export declare const deviceOf: (route: string) => string;
|
|
|
1366
1369
|
* privileged sidecar adds. A router translates the address of the side of the client, thus the
|
|
1367
1370
|
* target and each later hop see the router as the peer.
|
|
1368
1371
|
*/
|
|
1369
|
-
export declare const openLab: (target: Target, kind?: Client | ClientImage, topology?: Topology) => Promise<Lab>;
|
|
1372
|
+
export declare const openLab: (target: Target, kind?: Client | ClientImage, topology?: Topology, setup?: ReadonlyArray<readonly string[]>) => Promise<Lab>;
|
|
1370
1373
|
/**
|
|
1371
1374
|
* This module is the lab of a replicated group: a primary and its replicas, and the Sentinels
|
|
1372
1375
|
* that decide which member is the primary. It opens one environment for a group cell, and it does
|
package/build/index.js
CHANGED
|
@@ -4692,6 +4692,9 @@ const deviceOf = (route) => {
|
|
|
4692
4692
|
* - each hop of the topology, on the network of each of its sides. A hop is a router, or a stock
|
|
4693
4693
|
* proxy with an injector sidecar in its namespace.
|
|
4694
4694
|
* - an injector sidecar in the namespace of the target.
|
|
4695
|
+
* - the commands of `setup` in the target, after the target is ready and before the first hop
|
|
4696
|
+
* starts. A hop can connect to the target at its start, as a service to its replica set. Then it
|
|
4697
|
+
* sees the target in the state that the cell needs.
|
|
4695
4698
|
* - the prober, a privileged container that loads the kernel program and watches the namespace of
|
|
4696
4699
|
* the client, of the target and of each hop.
|
|
4697
4700
|
*
|
|
@@ -4703,7 +4706,7 @@ const deviceOf = (route) => {
|
|
|
4703
4706
|
* privileged sidecar adds. A router translates the address of the side of the client, thus the
|
|
4704
4707
|
* target and each later hop see the router as the peer.
|
|
4705
4708
|
*/
|
|
4706
|
-
const openLab = async (target, kind = "tcp", topology) => {
|
|
4709
|
+
const openLab = async (target, kind = "tcp", topology, setup = []) => {
|
|
4707
4710
|
const image = await harnessImage();
|
|
4708
4711
|
const { clientImage, command, clientKind, capabilities, source } = await clientOf(kind);
|
|
4709
4712
|
const hops = topology?.hops ?? [];
|
|
@@ -4746,6 +4749,7 @@ const openLab = async (target, kind = "tcp", topology) => {
|
|
|
4746
4749
|
const server = await (target.command === void 0 ? stock : stock.withCommand([...target.command])).start();
|
|
4747
4750
|
opened.push(server);
|
|
4748
4751
|
const serverIp = await ipOn(server, last);
|
|
4752
|
+
for (const argv of setup) await output(server, [...argv]);
|
|
4749
4753
|
const middlebox = [];
|
|
4750
4754
|
const hopOutput = /* @__PURE__ */ new Map();
|
|
4751
4755
|
const inChain = [];
|
|
@@ -4829,8 +4833,11 @@ const openLab = async (target, kind = "tcp", topology) => {
|
|
|
4829
4833
|
throw new Error(`the hop ${hop.name} did not start: ${error instanceof Error ? error.message : String(error)}. Its last lines:\n${tail.join("\n")}`);
|
|
4830
4834
|
});
|
|
4831
4835
|
opened.push(box);
|
|
4832
|
-
|
|
4833
|
-
|
|
4836
|
+
const stopped = (error) => {
|
|
4837
|
+
throw new Error(`the hop ${hop.name} stopped after it started: ${error instanceof Error ? error.message : String(error)}. Its last lines:\n${tail.join("\n")}`);
|
|
4838
|
+
};
|
|
4839
|
+
await join(box, clientSide).catch(stopped);
|
|
4840
|
+
const injector = await new GenericContainer(image).withNetworkMode(`container:${box.getId()}`).withAddedCapabilities("NET_ADMIN", "NET_RAW").start().catch(stopped);
|
|
4834
4841
|
opened.push(injector);
|
|
4835
4842
|
inChain[at] = {
|
|
4836
4843
|
hop,
|
|
@@ -9653,11 +9660,10 @@ const inEnvironment = async (cell, environment, count, say) => {
|
|
|
9653
9660
|
if (cell.cluster !== void 0) return inClusterEnvironment(cell, environment, count, say);
|
|
9654
9661
|
if (cell.kafka !== void 0) return inKafkaEnvironment(cell, environment, count, say);
|
|
9655
9662
|
if (cell.pair !== void 0) return inPairEnvironment(cell, environment, count, say);
|
|
9656
|
-
const lab = await openLab(cell.target, cell.client ?? cell.probe.driver?.name ?? "tcp", cell.topology);
|
|
9663
|
+
const lab = await openLab(cell.target, cell.client ?? cell.probe.driver?.name ?? "tcp", cell.topology, cell.targetSetup);
|
|
9657
9664
|
try {
|
|
9658
9665
|
const settings = await lab.configure(cell.targetSettings ?? {});
|
|
9659
9666
|
const targetSysctls = await lab.targetSysctl(cell.targetSysctls ?? {});
|
|
9660
|
-
if (cell.targetSetup !== void 0) await lab.setup(cell.targetSetup);
|
|
9661
9667
|
if (cell.fault === "mtu-blackhole" || cell.fault === "netem") {
|
|
9662
9668
|
await lab.offload(false, "target");
|
|
9663
9669
|
await lab.offload(false, "client");
|