@mark1russell7/harness 0.11.1 → 0.11.2

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 CHANGED
@@ -129,6 +129,7 @@ The harness builds six images. The tag of each image comes from the content of a
129
129
  - **The Node client image** (`image/node`) is a driver client: ioredis 6.0.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them. `client-ioredis.mjs` prints the lines of the TCP client on the same clock, and it adds the status changes of ioredis as `status` lines. The same image holds the client of a group in Sentinel mode (`client-sentinel.mjs`) and the observer of its Sentinels (`observer.mjs`).
130
130
  - **The Go HTTP image** (`image/go-http`) is the `http.Transport` of Go 1.27.2 at its defaults (`client-go`). The program uses the standard library only, thus the digest of the Go builder pins all of its code. The build does `gofmt` and `go vet` first. A wrapper on each connection writes what the read loop of the transport reads. The trace of the transport writes each try of a request.
131
131
  - **The Node HTTP image** (`image/node-http`) holds the `http.Agent` of Node 24.21.0 (`client-agent.mjs`) and an HTTP/1.1 `Client` of undici 8.12.2 (`client-undici.mjs`). The digest of the image and an npm lockfile pin them. It is apart from the image of ioredis, thus the cells of ioredis keep their image.
132
+ - **The PostgreSQL client image** (`image/pg`) is node-postgres: pg 8.23.1 with pg-pool 3.14.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them. `client-pg.mjs` makes one `pg.Pool` with the options of the cell (`Cell.driverOptions`), and it prints the lines of the TCP client on the same clock. The first query makes the connection, and the reply gives the client back to the pool, where it is idle. An error of the pool for that idle client is the detection of an idle cell. The probe is `{ driver: { name: "pg", query } }`, with `SELECT 1` as the query when the cell gives none.
132
133
  - **The MongoDB client image** (`image/mongo`) is the driver mongodb 7.7.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them. `client-mongo.mjs` prints the lines of the TCP client on the same clock:
133
134
  - Each socket of the driver is a `socket` line with its role: `monitor`, `rtt` or `pool`. The stack of the call that makes the socket gives the role.
134
135
  - The events of the driver are `sdam` lines (the heartbeats and the changes of each server), `cmap` lines (the pools) and `command` lines (each try of an operation).
package/build/index.d.ts CHANGED
@@ -566,10 +566,10 @@ type HarnessImage = "procedures";
566
566
  /**
567
567
  * A client is what the runs of a cell use: the TCP client of the harness, or a driver on its
568
568
  * socket. The HTTP clients are the `http.Transport` of Go (`go-http`), the `http.Agent` of Node
569
- * (`http-agent`) and an HTTP/1.1 `Client` of undici (`undici`). The MongoDB driver is `mongodb`, and the WebSocket client of
570
- * `@procedures/client` is `procedures-ws`.
569
+ * (`http-agent`) and an HTTP/1.1 `Client` of undici (`undici`). The MongoDB driver is `mongodb`, node-postgres is `pg`, and
570
+ * the WebSocket client of `@procedures/client` is `procedures-ws`.
571
571
  */
572
- type Client = "tcp" | "ioredis" | "go-http" | "http-agent" | "undici" | "mongodb" | "procedures-ws";
572
+ type Client = "tcp" | "ioredis" | "go-http" | "http-agent" | "undici" | "mongodb" | "pg" | "procedures-ws";
573
573
  /**
574
574
  * A WebSocket probe is the workload and the settings of the WebSocket client of
575
575
  * `@procedures/client` (`procedures-ws`). The cell gives each setting, thus the client takes
@@ -683,6 +683,8 @@ interface Cell {
683
683
  * - ioredis 6 on Node, whose keepAlive is the keepalive delay of the socket.
684
684
  * - the MongoDB driver on Node, against the replica set `set`. Its operation is a write, or
685
685
  * the read of a long document (`read-long`). `Cell.driverOptions` are its options.
686
+ * - node-postgres on Node, as a `pg.Pool` against one server. Its operation is `query`, or
687
+ * `SELECT 1`. `Cell.driverOptions` are the options of its pool.
686
688
  */
687
689
  readonly driver?: {
688
690
  readonly name: "ioredis";
@@ -691,6 +693,9 @@ interface Cell {
691
693
  readonly name: "mongodb";
692
694
  readonly set: string;
693
695
  readonly op?: "write" | "read-long";
696
+ } | {
697
+ readonly name: "pg";
698
+ readonly query?: string;
694
699
  };
695
700
  /** This workload is the workload of an HTTP client (`Cell.client` is an HTTP client). The client then ignores `keepalive` and `userTimeout`. */
696
701
  readonly http?: HttpProbe;
@@ -1574,6 +1579,8 @@ export declare const goHttpImage: () => Promise<string>;
1574
1579
  export declare const nodeHttpImage: () => Promise<string>;
1575
1580
  /** This function gives the image of the MongoDB client. */
1576
1581
  export declare const mongoClientImage: () => Promise<string>;
1582
+ /** This function gives the image of the PostgreSQL client. */
1583
+ export declare const pgClientImage: () => Promise<string>;
1577
1584
  /** This function gives the image of `@procedures/client`: its WebSocket client and its server. */
1578
1585
  export declare const proceduresImage: () => Promise<string>;
1579
1586
  /** This function gives the image that a target operates: its stock image, or an image of the harness (`Target.harness`). */
package/build/index.js CHANGED
@@ -1953,6 +1953,12 @@ const MONGO = {
1953
1953
  dockerfile: "harness/image/mongo/Dockerfile",
1954
1954
  from: ["harness/image/mongo"]
1955
1955
  };
1956
+ /** This image holds the PostgreSQL client: node-postgres (pg 8.23.1 with pg-pool 3.14.0) on Node 24.21.0. */
1957
+ const PG = {
1958
+ name: "loom-harness-pg",
1959
+ dockerfile: "harness/image/pg/Dockerfile",
1960
+ from: ["harness/image/pg"]
1961
+ };
1956
1962
  /** This image holds `@procedures/client` 0.7.0 on Node 24.21.0: its WebSocket client as a client of the harness, and the script of its server. */
1957
1963
  const PROCEDURES = {
1958
1964
  name: "loom-harness-procedures",
@@ -2031,6 +2037,8 @@ const goHttpImage = () => build(GO_HTTP);
2031
2037
  const nodeHttpImage = () => build(NODE_HTTP);
2032
2038
  /** This function gives the image of the MongoDB client. */
2033
2039
  const mongoClientImage = () => build(MONGO);
2040
+ /** This function gives the image of the PostgreSQL client. */
2041
+ const pgClientImage = () => build(PG);
2034
2042
  /** This function gives the image of `@procedures/client`: its WebSocket client and its server. */
2035
2043
  const proceduresImage = () => build(PROCEDURES);
2036
2044
  /** This function gives the image that a target operates: its stock image, or an image of the harness (`Target.harness`). */
@@ -2228,6 +2236,11 @@ const clientOf = async (kind, image) => {
2228
2236
  command: ["node", "/opt/harness/mongo/client-mongo.mjs"],
2229
2237
  clientKind: kind
2230
2238
  };
2239
+ if (kind === "pg") return {
2240
+ clientImage: await pgClientImage(),
2241
+ command: ["node", "/opt/harness/pg/client-pg.mjs"],
2242
+ clientKind: kind
2243
+ };
2231
2244
  if (kind === "procedures-ws") return {
2232
2245
  clientImage: await proceduresImage(),
2233
2246
  command: ["node", "/opt/harness/procedures/client-ws.mjs"],
@@ -4236,6 +4249,13 @@ const probeArgs = (cell, lab) => {
4236
4249
  args.push("--max-s", String(Math.ceil(longest * 2 + 10)));
4237
4250
  return args;
4238
4251
  }
4252
+ if (probe.driver?.name === "pg") {
4253
+ if (probe.driver.query !== void 0) args.push("--query", probe.driver.query);
4254
+ if (cell.before === true) args.push("--before");
4255
+ if (cell.driverOptions !== void 0) args.push("--options", JSON.stringify(cell.driverOptions));
4256
+ args.push("--max-s", String(Math.ceil(longest * 2 + 10)));
4257
+ return args;
4258
+ }
4239
4259
  if (probe.driver !== void 0) {
4240
4260
  args.push("--keepalive-ms", String(valueIn(probe.driver.keepAlive, "ms")));
4241
4261
  args.push("--max-s", String(Math.ceil(longest * 2 + 10)));
@@ -4763,6 +4783,6 @@ const runCell = async (cell, say = () => {}) => {
4763
4783
  }
4764
4784
  };
4765
4785
  //#endregion
4766
- export { CONVERGE_MS, INJECT, KEPT, LINGER_MS, LISTING, MEMBER_MARKS, NOISE, PUMP, QUIET_MS, RELATIVE, REPLICA_SET_STAGES, STAGES, STATUS_SCRIPT, STEPS, STEP_DOWN, callOf, clockOffsetOf, closeOrExit, crossingsOf, cutOf, deadlineOf, delayVoids, deviceOf, dropFinding, dropOf, endpointAfter, errorsOf, exitOf, fieldOf, fieldsOf, firstUnanswered, goHttpImage, groupOnce, groupVerdictOf, harnessImage, hzOf, infoOf, initiateScript, isHopPlace, judge, lagsOf, latestEndOf, leftAfter, matches, measure, measureDriver, measureGroup, medianInterval, memberCommand, memberConfig, memberLineOf, mongoClientImage, nodeClientImage, nodeHttpImage, noiseOf, onMonotonic, openGroupLab, openLab, openReplicaSetLab, peersOf, pingsOf, proceduresImage, programLines, quantileOf, reconnectFinding, reconnectOf, referenceOf, reorderingOf, replicaSetArgs, replicaSetOnce, replicaSetStagesOf, requestOf, requestWords, routerImage, routesOf, runCell, sentinelConfig, socketAt, socketOf, socketsOf, spread, spreadOf, stagesOf, statusViewOf, subscriptionsOf, targetImageOf, templated, toxicBody, verdictOf, viewOf, writesOf };
4786
+ export { CONVERGE_MS, INJECT, KEPT, LINGER_MS, LISTING, MEMBER_MARKS, NOISE, PUMP, QUIET_MS, RELATIVE, REPLICA_SET_STAGES, STAGES, STATUS_SCRIPT, STEPS, STEP_DOWN, callOf, clockOffsetOf, closeOrExit, crossingsOf, cutOf, deadlineOf, delayVoids, deviceOf, dropFinding, dropOf, endpointAfter, errorsOf, exitOf, fieldOf, fieldsOf, firstUnanswered, goHttpImage, groupOnce, groupVerdictOf, harnessImage, hzOf, infoOf, initiateScript, isHopPlace, judge, lagsOf, latestEndOf, leftAfter, matches, measure, measureDriver, measureGroup, medianInterval, memberCommand, memberConfig, memberLineOf, mongoClientImage, nodeClientImage, nodeHttpImage, noiseOf, onMonotonic, openGroupLab, openLab, openReplicaSetLab, peersOf, pgClientImage, pingsOf, proceduresImage, programLines, quantileOf, reconnectFinding, reconnectOf, referenceOf, reorderingOf, replicaSetArgs, replicaSetOnce, replicaSetStagesOf, requestOf, requestWords, routerImage, routesOf, runCell, sentinelConfig, socketAt, socketOf, socketsOf, spread, spreadOf, stagesOf, statusViewOf, subscriptionsOf, targetImageOf, templated, toxicBody, verdictOf, viewOf, writesOf };
4767
4787
 
4768
4788
  //# sourceMappingURL=index.js.map