@dads-framework/postgres 0.0.0-stage → 0.2.0

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.
Files changed (160) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +97 -2
  3. package/dist/drizzle.d.ts +9 -0
  4. package/dist/drizzle.d.ts.map +1 -0
  5. package/dist/drizzle.js +2 -0
  6. package/dist/drizzle.js.map +1 -0
  7. package/dist/index.d.ts +13 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +12 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/lib/attributed-pool.d.ts +95 -0
  12. package/dist/lib/attributed-pool.d.ts.map +1 -0
  13. package/dist/lib/attributed-pool.js +128 -0
  14. package/dist/lib/attributed-pool.js.map +1 -0
  15. package/dist/lib/bytea-column.d.ts +37 -0
  16. package/dist/lib/bytea-column.d.ts.map +1 -0
  17. package/dist/lib/bytea-column.js +20 -0
  18. package/dist/lib/bytea-column.js.map +1 -0
  19. package/dist/lib/checked-out-client-errors.d.ts +22 -0
  20. package/dist/lib/checked-out-client-errors.d.ts.map +1 -0
  21. package/dist/lib/checked-out-client-errors.js +28 -0
  22. package/dist/lib/checked-out-client-errors.js.map +1 -0
  23. package/dist/lib/connect-postgres-client.d.ts +16 -0
  24. package/dist/lib/connect-postgres-client.d.ts.map +1 -0
  25. package/dist/lib/connect-postgres-client.js +14 -0
  26. package/dist/lib/connect-postgres-client.js.map +1 -0
  27. package/dist/lib/counting-client.d.ts +39 -0
  28. package/dist/lib/counting-client.d.ts.map +1 -0
  29. package/dist/lib/counting-client.js +102 -0
  30. package/dist/lib/counting-client.js.map +1 -0
  31. package/dist/lib/create-postgres-connection.d.ts +65 -0
  32. package/dist/lib/create-postgres-connection.d.ts.map +1 -0
  33. package/dist/lib/create-postgres-connection.js +68 -0
  34. package/dist/lib/create-postgres-connection.js.map +1 -0
  35. package/dist/lib/event-actor-columns.d.ts +49 -0
  36. package/dist/lib/event-actor-columns.d.ts.map +1 -0
  37. package/dist/lib/event-actor-columns.js +37 -0
  38. package/dist/lib/event-actor-columns.js.map +1 -0
  39. package/dist/lib/inet-column.d.ts +37 -0
  40. package/dist/lib/inet-column.d.ts.map +1 -0
  41. package/dist/lib/inet-column.js +17 -0
  42. package/dist/lib/inet-column.js.map +1 -0
  43. package/dist/lib/load-page-and-total.d.ts +16 -0
  44. package/dist/lib/load-page-and-total.d.ts.map +1 -0
  45. package/dist/lib/load-page-and-total.js +16 -0
  46. package/dist/lib/load-page-and-total.js.map +1 -0
  47. package/dist/lib/postgres-pool-laws.d.ts +6 -0
  48. package/dist/lib/postgres-pool-laws.d.ts.map +1 -0
  49. package/dist/lib/postgres-pool-laws.js +58 -0
  50. package/dist/lib/postgres-pool-laws.js.map +1 -0
  51. package/dist/lib/synced-rows.d.ts +97 -0
  52. package/dist/lib/synced-rows.d.ts.map +1 -0
  53. package/dist/lib/synced-rows.js +158 -0
  54. package/dist/lib/synced-rows.js.map +1 -0
  55. package/dist/lib/unique-violation.d.ts +10 -0
  56. package/dist/lib/unique-violation.d.ts.map +1 -0
  57. package/dist/lib/unique-violation.js +24 -0
  58. package/dist/lib/unique-violation.js.map +1 -0
  59. package/dist/lib/update-at-row-version.d.ts +31 -0
  60. package/dist/lib/update-at-row-version.d.ts.map +1 -0
  61. package/dist/lib/update-at-row-version.js +14 -0
  62. package/dist/lib/update-at-row-version.js.map +1 -0
  63. package/dist/lib/xid8-column.d.ts +38 -0
  64. package/dist/lib/xid8-column.d.ts.map +1 -0
  65. package/dist/lib/xid8-column.js +18 -0
  66. package/dist/lib/xid8-column.js.map +1 -0
  67. package/dist/postgres.tsbuildinfo +1 -0
  68. package/dist/testing/create-test-pool.d.ts +35 -0
  69. package/dist/testing/create-test-pool.d.ts.map +1 -0
  70. package/dist/testing/create-test-pool.js +47 -0
  71. package/dist/testing/create-test-pool.js.map +1 -0
  72. package/dist/testing/deterministic-uuid.d.ts +2 -0
  73. package/dist/testing/deterministic-uuid.d.ts.map +1 -0
  74. package/dist/testing/deterministic-uuid.js +20 -0
  75. package/dist/testing/deterministic-uuid.js.map +1 -0
  76. package/dist/testing/global-setup/container-tier-semaphore.d.ts +51 -0
  77. package/dist/testing/global-setup/container-tier-semaphore.d.ts.map +1 -0
  78. package/dist/testing/global-setup/container-tier-semaphore.js +129 -0
  79. package/dist/testing/global-setup/container-tier-semaphore.js.map +1 -0
  80. package/dist/testing/global-setup/decide-shared-test-postgres.d.ts +51 -0
  81. package/dist/testing/global-setup/decide-shared-test-postgres.d.ts.map +1 -0
  82. package/dist/testing/global-setup/decide-shared-test-postgres.js +109 -0
  83. package/dist/testing/global-setup/decide-shared-test-postgres.js.map +1 -0
  84. package/dist/testing/global-setup/index.d.ts +16 -0
  85. package/dist/testing/global-setup/index.d.ts.map +1 -0
  86. package/dist/testing/global-setup/index.js +151 -0
  87. package/dist/testing/global-setup/index.js.map +1 -0
  88. package/dist/testing/global-setup/refuse-disabled-container-cleanup.d.ts +34 -0
  89. package/dist/testing/global-setup/refuse-disabled-container-cleanup.d.ts.map +1 -0
  90. package/dist/testing/global-setup/refuse-disabled-container-cleanup.js +45 -0
  91. package/dist/testing/global-setup/refuse-disabled-container-cleanup.js.map +1 -0
  92. package/dist/testing/global-setup/refuse-low-memory-runs.d.ts +176 -0
  93. package/dist/testing/global-setup/refuse-low-memory-runs.d.ts.map +1 -0
  94. package/dist/testing/global-setup/refuse-low-memory-runs.js +388 -0
  95. package/dist/testing/global-setup/refuse-low-memory-runs.js.map +1 -0
  96. package/dist/testing/global-setup/refuse-slow-local-test-mode.d.ts +5 -0
  97. package/dist/testing/global-setup/refuse-slow-local-test-mode.d.ts.map +1 -0
  98. package/dist/testing/global-setup/refuse-slow-local-test-mode.js +18 -0
  99. package/dist/testing/global-setup/refuse-slow-local-test-mode.js.map +1 -0
  100. package/dist/testing/global-setup/refuse-stacked-container-runs.d.ts +106 -0
  101. package/dist/testing/global-setup/refuse-stacked-container-runs.d.ts.map +1 -0
  102. package/dist/testing/global-setup/refuse-stacked-container-runs.js +284 -0
  103. package/dist/testing/global-setup/refuse-stacked-container-runs.js.map +1 -0
  104. package/dist/testing/global-setup/remove-stale-testcontainers.d.ts +33 -0
  105. package/dist/testing/global-setup/remove-stale-testcontainers.d.ts.map +1 -0
  106. package/dist/testing/global-setup/remove-stale-testcontainers.js +165 -0
  107. package/dist/testing/global-setup/remove-stale-testcontainers.js.map +1 -0
  108. package/dist/testing/global-setup/retired-database-touches.d.ts +16 -0
  109. package/dist/testing/global-setup/retired-database-touches.d.ts.map +1 -0
  110. package/dist/testing/global-setup/retired-database-touches.js +73 -0
  111. package/dist/testing/global-setup/retired-database-touches.js.map +1 -0
  112. package/dist/testing/global-setup/schema-keyed-coverage.d.ts +56 -0
  113. package/dist/testing/global-setup/schema-keyed-coverage.d.ts.map +1 -0
  114. package/dist/testing/global-setup/schema-keyed-coverage.js +84 -0
  115. package/dist/testing/global-setup/schema-keyed-coverage.js.map +1 -0
  116. package/dist/testing/global-setup/skip-unless-container-tests.d.ts +31 -0
  117. package/dist/testing/global-setup/skip-unless-container-tests.d.ts.map +1 -0
  118. package/dist/testing/global-setup/skip-unless-container-tests.js +33 -0
  119. package/dist/testing/global-setup/skip-unless-container-tests.js.map +1 -0
  120. package/dist/testing/global-setup/start-migrated-template-postgres.d.ts +20 -0
  121. package/dist/testing/global-setup/start-migrated-template-postgres.d.ts.map +1 -0
  122. package/dist/testing/global-setup/start-migrated-template-postgres.js +53 -0
  123. package/dist/testing/global-setup/start-migrated-template-postgres.js.map +1 -0
  124. package/dist/testing/global-setup/verify-schema-keyed-suite.d.ts +43 -0
  125. package/dist/testing/global-setup/verify-schema-keyed-suite.d.ts.map +1 -0
  126. package/dist/testing/global-setup/verify-schema-keyed-suite.js +201 -0
  127. package/dist/testing/global-setup/verify-schema-keyed-suite.js.map +1 -0
  128. package/dist/testing/global-setup/worktree-identity.d.ts +21 -0
  129. package/dist/testing/global-setup/worktree-identity.d.ts.map +1 -0
  130. package/dist/testing/global-setup/worktree-identity.js +30 -0
  131. package/dist/testing/global-setup/worktree-identity.js.map +1 -0
  132. package/dist/testing/index.d.ts +11 -0
  133. package/dist/testing/index.d.ts.map +1 -0
  134. package/dist/testing/index.js +11 -0
  135. package/dist/testing/index.js.map +1 -0
  136. package/dist/testing/rehearsal-postgres.d.ts +20 -0
  137. package/dist/testing/rehearsal-postgres.d.ts.map +1 -0
  138. package/dist/testing/rehearsal-postgres.js +61 -0
  139. package/dist/testing/rehearsal-postgres.js.map +1 -0
  140. package/dist/testing/start-test-postgres.d.ts +59 -0
  141. package/dist/testing/start-test-postgres.d.ts.map +1 -0
  142. package/dist/testing/start-test-postgres.js +241 -0
  143. package/dist/testing/start-test-postgres.js.map +1 -0
  144. package/dist/testing/test-postgres-storage.d.ts +44 -0
  145. package/dist/testing/test-postgres-storage.d.ts.map +1 -0
  146. package/dist/testing/test-postgres-storage.js +88 -0
  147. package/dist/testing/test-postgres-storage.js.map +1 -0
  148. package/dist/testing/truncate-tables.d.ts +31 -0
  149. package/dist/testing/truncate-tables.d.ts.map +1 -0
  150. package/dist/testing/truncate-tables.js +39 -0
  151. package/dist/testing/truncate-tables.js.map +1 -0
  152. package/dist/testing/violated-foreign-key.d.ts +14 -0
  153. package/dist/testing/violated-foreign-key.d.ts.map +1 -0
  154. package/dist/testing/violated-foreign-key.js +78 -0
  155. package/dist/testing/violated-foreign-key.js.map +1 -0
  156. package/dist/testing/with-database.d.ts +2 -0
  157. package/dist/testing/with-database.d.ts.map +1 -0
  158. package/dist/testing/with-database.js +6 -0
  159. package/dist/testing/with-database.js.map +1 -0
  160. package/package.json +88 -4
@@ -0,0 +1,165 @@
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
3
+ const run = promisify(execFile);
4
+ /**
5
+ * The preflight sweep: every run clears its predecessors' corpses.
6
+ *
7
+ * Ryuk cannot be the whole answer. `getReaper()` reuses the newest running
8
+ * reaper and adopts its session id, so every test process on the machine
9
+ * collapses onto ONE reaper holding ONE death pact — and that pact fires when
10
+ * the LAST client disconnects, not when one dies. Measured on 2026-08-02 with
11
+ * two lanes testing continuously: a SIGKILLed client's container was still
12
+ * running 60s later with a healthy reaper attached to its exact session. Worse,
13
+ * when a reaper generation dies without reaping (a `docker rm -f`, a Docker
14
+ * Desktop restart), everything it watched becomes unwatchable — 46 of the 83
15
+ * containers on the box carried a session whose reaper was already gone, and
16
+ * nothing in the world would ever have removed them.
17
+ *
18
+ * So cleanup cannot depend on anyone else's process exiting. It runs at the
19
+ * START of a run, where the only thing that has to work is this run. Nothing
20
+ * leaks permanently: the next container-tier run sweeps it.
21
+ *
22
+ * WHAT IT WILL REMOVE: containers carrying testcontainers' own harness label,
23
+ * started more than 15 minutes ago, whose session id is not the one this run
24
+ * is about to adopt.
25
+ *
26
+ * WHAT IT WILL NEVER REMOVE: reaper containers (removing another lane's reaper
27
+ * would orphan everything it watches — manufacturing the exact corpses this
28
+ * sweep exists to clear); anything younger than 15 minutes; anything carrying
29
+ * the session id this run will adopt, which is how a concurrent lane's live
30
+ * containers are spared, since reaper reuse means concurrent lanes normally
31
+ * share one session id; and anything the harness did not start, which is
32
+ * everything without the label — `docker compose` services included.
33
+ */
34
+ /** The label testcontainers puts on every container it starts. */
35
+ const HARNESS_LABEL = "org.testcontainers=true";
36
+ const SESSION_LABEL = "org.testcontainers.session-id";
37
+ const REAPER_LABEL = "org.testcontainers.ryuk";
38
+ /** Go templates render an absent label as this. */
39
+ const ABSENT = "<no value>";
40
+ /** How old a container must be before the sweep will treat it as a corpse. */
41
+ export const STALE_AFTER_MS = 15 * 60_000;
42
+ /**
43
+ * The session id this run will end up using.
44
+ *
45
+ * Not a guess: `getReaper()` lists running reaper containers, sorts them newest
46
+ * first, and adopts the session id of the first one that accepts a socket. Read
47
+ * the same way here, so "not the current session" means the same thing to the
48
+ * sweep as it does to the library.
49
+ */
50
+ function sessionThisRunWillAdopt(containers) {
51
+ const reapers = containers
52
+ // RUNNING reapers only, exactly as `findReaperContainers` filters. A
53
+ // stopped reaper watches nothing and will not be reused, so treating its
54
+ // session as current would spare a whole generation of corpses forever.
55
+ .filter((container) => container.isReaper && container.running)
56
+ .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
57
+ return reapers[0]?.sessionId ?? null;
58
+ }
59
+ /** Pure: which of these containers are corpses? */
60
+ export function selectStaleTestcontainers(containers, now) {
61
+ const adopted = sessionThisRunWillAdopt(containers);
62
+ return containers.filter((container) => {
63
+ if (now.getTime() - container.createdAt.getTime() <= STALE_AFTER_MS) {
64
+ return false;
65
+ }
66
+ // A container that is not running cannot belong to a live suite, so past
67
+ // the age floor it is garbage whatever its session — including a stopped
68
+ // reaper, and including the session this run is about to adopt.
69
+ if (!container.running)
70
+ return true;
71
+ return !container.isReaper && container.sessionId !== adopted;
72
+ });
73
+ }
74
+ /** Remove the corpses. Never throws: housekeeping does not fail a test run. */
75
+ export async function removeStaleTestcontainers(client, now) {
76
+ let containers;
77
+ try {
78
+ containers = await client.listTestcontainersContainers();
79
+ }
80
+ catch {
81
+ return { removed: 0, failed: 0, sessions: [], unavailable: true };
82
+ }
83
+ const stale = selectStaleTestcontainers(containers, now);
84
+ let removed = 0;
85
+ let failed = 0;
86
+ const sessions = new Set();
87
+ for (const container of stale) {
88
+ try {
89
+ await client.remove(container.id);
90
+ removed += 1;
91
+ sessions.add(container.sessionId);
92
+ }
93
+ catch {
94
+ // Vanished between the list and the remove — the normal race, and no
95
+ // reason to abandon the rest of the sweep.
96
+ failed += 1;
97
+ }
98
+ }
99
+ return { removed, failed, sessions: [...sessions], unavailable: false };
100
+ }
101
+ /** The one line a sweep is worth, or nothing at all when it found nothing. */
102
+ export function describeRemovedTestcontainers(report) {
103
+ if (report.removed === 0)
104
+ return null;
105
+ const failed = report.failed > 0 ? `, ${report.failed} already gone` : "";
106
+ return (`[test-harness] swept ${report.removed} stale container(s) older than ` +
107
+ `15m from dead session(s) ${report.sessions.join(", ")}${failed}`);
108
+ }
109
+ /** The real Docker, driven through its CLI so the harness gains no dependency. */
110
+ export function dockerCli() {
111
+ return {
112
+ listTestcontainersContainers: async () => {
113
+ // `--all`, not just running. Exited and never-started containers hold
114
+ // their disk and their name, and `docker ps` cannot see them — which is
115
+ // how 70 of them accumulated unnoticed on one machine.
116
+ const { stdout: ids } = await run("docker", [
117
+ "ps",
118
+ "--all",
119
+ "--filter",
120
+ `label=${HARNESS_LABEL}`,
121
+ "--format",
122
+ "{{.ID}}",
123
+ ]);
124
+ const found = ids.split("\n").filter((line) => line.trim() !== "");
125
+ if (found.length === 0)
126
+ return [];
127
+ const { stdout } = await run("docker", [
128
+ "inspect",
129
+ ...found,
130
+ "--format",
131
+ `{{.Id}}\t{{.Config.Image}}\t{{.Created}}\t{{.State.Running}}\t` +
132
+ `{{index .Config.Labels "${SESSION_LABEL}"}}\t` +
133
+ `{{index .Config.Labels "${REAPER_LABEL}"}}`,
134
+ ]);
135
+ return stdout
136
+ .split("\n")
137
+ .filter((line) => line.trim() !== "")
138
+ .map(parseInspectLine)
139
+ .filter((container) => container !== null);
140
+ },
141
+ remove: async (id) => {
142
+ // `--volumes` because a leaked container's anonymous volume leaks with
143
+ // it, and disk is the other half of what saturates the machine.
144
+ await run("docker", ["rm", "--force", "--volumes", id]);
145
+ },
146
+ };
147
+ }
148
+ function parseInspectLine(line) {
149
+ const [id, image, createdAt, running, sessionId, reaper] = line.split("\t");
150
+ if (id === undefined || sessionId === undefined || sessionId === ABSENT) {
151
+ return null;
152
+ }
153
+ const created = new Date(createdAt ?? "");
154
+ if (Number.isNaN(created.getTime()))
155
+ return null;
156
+ return {
157
+ id,
158
+ image: image ?? "",
159
+ sessionId,
160
+ isReaper: reaper === "true",
161
+ running: running === "true",
162
+ createdAt: created,
163
+ };
164
+ }
165
+ //# sourceMappingURL=remove-stale-testcontainers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-stale-testcontainers.js","sourceRoot":"","sources":["../../../src/testing/global-setup/remove-stale-testcontainers.ts"],"names":[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AAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;iBACpC,GAAG,CAAC,gBAAgB,CAAC;iBACrB,MAAM,CACL,CAAC,SAAS,EAAwC,EAAE,CAClD,SAAS,KAAK,IAAI,CACrB,CAAC;QACN,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,EAAU,EAAE,EAAE;YAC3B,uEAAuE;YACvE,gEAAgE;YAChE,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5E,IAAI,EAAE,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,OAAO;QACL,EAAE;QACF,KAAK,EAAE,KAAK,IAAI,EAAE;QAClB,SAAS;QACT,QAAQ,EAAE,MAAM,KAAK,MAAM;QAC3B,OAAO,EAAE,OAAO,KAAK,MAAM;QAC3B,SAAS,EAAE,OAAO;KACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ClientBase, Pool } from "pg";
2
+ export type RetiredTouch = {
3
+ readonly databaseName: string;
4
+ readonly schemaName: string | null;
5
+ readonly tableName: string | null;
6
+ };
7
+ /**
8
+ * Read `name`'s table activity through `database` — a connection to it the
9
+ * caller owns and closes — and write it to the ledger before a drop.
10
+ */
11
+ export declare function recordRetiredDatabaseTouches(admin: Pool, database: ClientBase, name: string): Promise<void>;
12
+ /** Ledger rows for databases whose names start with `test_<prefix>_`. */
13
+ export declare function readRetiredDatabaseTouches(admin: Pool, prefix: string): Promise<RetiredTouch[]>;
14
+ /** Ledger rows for the one database `name`. */
15
+ export declare function readRetiredDatabaseTouchesOf(admin: Pool, name: string): Promise<RetiredTouch[]>;
16
+ //# sourceMappingURL=retired-database-touches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retired-database-touches.d.ts","sourceRoot":"","sources":["../../../src/testing/global-setup/retired-database-touches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAc3C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED,yEAAyE;AACzE,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,EAAE,CAAC,CAEzB;AAED,+CAA+C;AAC/C,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,EAAE,CAAC,CAEzB"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Ledger, in the shared server's `postgres` database, of the tables each
3
+ * dropped private database touched. With `TEST_POSTGRES_STORAGE=ram` a file's
4
+ * database is dropped when it stops, so the schema-keyed teardown
5
+ * (verify-schema-keyed-suite.ts) reads these rows in place of the database.
6
+ * One row per touched table, plus one row with null names per database so a
7
+ * database that touched nothing is still counted.
8
+ */
9
+ const RETIRED_DATABASE_TOUCHES = "dads_test_retired_database_touches";
10
+ const DUPLICATE_OBJECT_CODES = new Set(["42P07", "23505"]);
11
+ /**
12
+ * Read `name`'s table activity through `database` — a connection to it the
13
+ * caller owns and closes — and write it to the ledger before a drop.
14
+ */
15
+ export async function recordRetiredDatabaseTouches(admin, database, name) {
16
+ const touched = (await database.query(`
17
+ SELECT schemaname, relname
18
+ FROM pg_stat_user_tables
19
+ WHERE coalesce(seq_scan, 0) + coalesce(idx_scan, 0) + n_tup_ins
20
+ + n_tup_upd + n_tup_del > 0
21
+ `)).rows;
22
+ await ensureLedger(admin);
23
+ await admin.query(`INSERT INTO ${RETIRED_DATABASE_TOUCHES} (datname, schemaname, relname)
24
+ SELECT $1, t.schemaname, t.relname
25
+ FROM unnest($2::text[], $3::text[]) AS t(schemaname, relname)
26
+ UNION ALL SELECT $1, NULL, NULL`, [
27
+ name,
28
+ touched.map((row) => row.schemaname),
29
+ touched.map((row) => row.relname),
30
+ ]);
31
+ }
32
+ /** Ledger rows for databases whose names start with `test_<prefix>_`. */
33
+ export async function readRetiredDatabaseTouches(admin, prefix) {
34
+ return readLedger(admin, "starts_with(datname, $1)", `test_${prefix}_`);
35
+ }
36
+ /** Ledger rows for the one database `name`. */
37
+ export async function readRetiredDatabaseTouchesOf(admin, name) {
38
+ return readLedger(admin, "datname = $1", name);
39
+ }
40
+ async function readLedger(admin, condition, value) {
41
+ const exists = await admin.query("SELECT to_regclass($1)::text AS ledger", [RETIRED_DATABASE_TOUCHES]);
42
+ if (exists.rows[0]?.ledger == null)
43
+ return [];
44
+ const rows = await admin.query(`SELECT datname, schemaname, relname FROM ${RETIRED_DATABASE_TOUCHES}
45
+ WHERE ${condition}`, [value]);
46
+ return rows.rows.map((row) => ({
47
+ databaseName: row.datname,
48
+ schemaName: row.schemaname,
49
+ tableName: row.relname,
50
+ }));
51
+ }
52
+ /** Concurrent first writers can race on CREATE ... IF NOT EXISTS; the loser's error is harmless. */
53
+ async function ensureLedger(admin) {
54
+ try {
55
+ await admin.query(`CREATE TABLE IF NOT EXISTS ${RETIRED_DATABASE_TOUCHES} (
56
+ datname text NOT NULL,
57
+ schemaname text,
58
+ relname text
59
+ )`);
60
+ }
61
+ catch (error) {
62
+ if (!isDuplicateObject(error))
63
+ throw error;
64
+ }
65
+ }
66
+ function isDuplicateObject(error) {
67
+ if (typeof error !== "object" || error === null || !("code" in error)) {
68
+ return false;
69
+ }
70
+ const { code } = error;
71
+ return typeof code === "string" && DUPLICATE_OBJECT_CODES.has(code);
72
+ }
73
+ //# sourceMappingURL=retired-database-touches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retired-database-touches.js","sourceRoot":"","sources":["../../../src/testing/global-setup/retired-database-touches.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,oCAAoC,CAAC;AAEtE,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAQ3D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAW,EACX,QAAoB,EACpB,IAAY;IAEZ,MAAM,OAAO,GAAG,CACd,MAAM,QAAQ,CAAC,KAAK,CAA0C;;;;;KAK7D,CAAC,CACH,CAAC,IAAI,CAAC;IAEP,MAAM,YAAY,CAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,KAAK,CAAC,KAAK,CACf,eAAe,wBAAwB;;;qCAGN,EACjC;QACE,IAAI;QACJ,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;KAClC,CACF,CAAC;AACJ,CAAC;AA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AC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Whether an integration suite's Nx hash covers every table it touched.
3
+ *
4
+ * Integration suites can hash every migration file in the workspace. A suite
5
+ * that opts into SCHEMA KEYING hashes, instead, the generated table modules of
6
+ * the tables it touches (each prints its table's schema fingerprint) plus one
7
+ * shared-state file for everything outside tables (functions, grants, seeded
8
+ * rows). That is only sound if the list of table modules really is the list
9
+ * of tables the suite reaches — directly, through a dependency's code, or
10
+ * through a trigger or function the database runs on its behalf.
11
+ *
12
+ * Postgres counts every scan, insert, update, delete and truncate per table,
13
+ * so after a run the suite's private databases say exactly which tables it
14
+ * reached. This module compares that against what the suite's `project.json`
15
+ * declares. A miss fails the run, which is what stops a suite from replaying
16
+ * a cached pass after a table it reads changed underneath it
17
+ * (docs/testing/speed.md#schema-keyed-integration-suites).
18
+ */
19
+ /** The named input that marks a project's `test:integration` as schema-keyed. */
20
+ export declare const SCHEMA_KEYED_INPUT = "databaseSharedState";
21
+ /** The input a suite that reads the migrations themselves must hash instead. */
22
+ export declare const ALL_MIGRATIONS_INPUT = "databaseMigrations";
23
+ export type TouchedTable = {
24
+ readonly schemaName: string;
25
+ readonly tableName: string;
26
+ };
27
+ export type SchemaKeyedDeclaration = {
28
+ /** True when the target lists {@link SCHEMA_KEYED_INPUT}. */
29
+ readonly schemaKeyed: boolean;
30
+ /** `generated-tables` folders the target hashes, workspace-relative. */
31
+ readonly tableModuleFolders: readonly string[];
32
+ };
33
+ /** Reads a `test:integration` target's `inputs` as a declaration. */
34
+ export declare function readSchemaKeyedDeclaration(inputs: readonly unknown[] | undefined): SchemaKeyedDeclaration;
35
+ /** The `inputs` line that makes a suite hash one folder of table modules. */
36
+ export declare function tableModuleInput(folder: string): string;
37
+ export type CoverageInput = {
38
+ readonly declaration: SchemaKeyedDeclaration;
39
+ /** Table name → the `generated-tables` folder whose module declares it. */
40
+ readonly tableOwners: ReadonlyMap<string, string>;
41
+ readonly touched: readonly TouchedTable[];
42
+ /** Private databases this run created WITHOUT the migrated template. */
43
+ readonly unmigratedDatabases: number;
44
+ };
45
+ export type CoverageReport = {
46
+ /** Folders the suite reached that its hash does not cover. */
47
+ readonly missingFolders: readonly string[];
48
+ /** Why the suite cannot be schema-keyed at all, if it cannot. */
49
+ readonly needsAllMigrations: readonly string[];
50
+ /** Every folder the suite reached, covered or not. */
51
+ readonly reachedFolders: readonly string[];
52
+ };
53
+ export declare function checkSchemaKeyedCoverage(input: CoverageInput): CoverageReport;
54
+ /** The failure a schema-keyed suite reports, with the exact fix. */
55
+ export declare function describeCoverageFailure(project: string, report: CoverageReport): string | null;
56
+ //# sourceMappingURL=schema-keyed-coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-keyed-coverage.d.ts","sourceRoot":"","sources":["../../../src/testing/global-setup/schema-keyed-coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAExD,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAQzD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;CAChD,CAAC;AAEF,qEAAqE;AACrE,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,GACrC,sBAAsB,CAUxB;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,wEAAwE;IACxE,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,iEAAiE;IACjE,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,sDAAsD;IACtD,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CA6B7E;AAED,oEAAoE;AACpE,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,GACrB,MAAM,GAAG,IAAI,CAiBf"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Whether an integration suite's Nx hash covers every table it touched.
3
+ *
4
+ * Integration suites can hash every migration file in the workspace. A suite
5
+ * that opts into SCHEMA KEYING hashes, instead, the generated table modules of
6
+ * the tables it touches (each prints its table's schema fingerprint) plus one
7
+ * shared-state file for everything outside tables (functions, grants, seeded
8
+ * rows). That is only sound if the list of table modules really is the list
9
+ * of tables the suite reaches — directly, through a dependency's code, or
10
+ * through a trigger or function the database runs on its behalf.
11
+ *
12
+ * Postgres counts every scan, insert, update, delete and truncate per table,
13
+ * so after a run the suite's private databases say exactly which tables it
14
+ * reached. This module compares that against what the suite's `project.json`
15
+ * declares. A miss fails the run, which is what stops a suite from replaying
16
+ * a cached pass after a table it reads changed underneath it
17
+ * (docs/testing/speed.md#schema-keyed-integration-suites).
18
+ */
19
+ /** The named input that marks a project's `test:integration` as schema-keyed. */
20
+ export const SCHEMA_KEYED_INPUT = "databaseSharedState";
21
+ /** The input a suite that reads the migrations themselves must hash instead. */
22
+ export const ALL_MIGRATIONS_INPUT = "databaseMigrations";
23
+ /** The migration runner records its journal in this schema. */
24
+ const MIGRATION_JOURNAL_SCHEMA = "dads_migration";
25
+ const TABLE_MODULE_GLOB = /^\{workspaceRoot\}\/(.+\/generated-tables)\/\*\.tables\.ts$/;
26
+ /** Reads a `test:integration` target's `inputs` as a declaration. */
27
+ export function readSchemaKeyedDeclaration(inputs) {
28
+ const strings = (inputs ?? []).filter((input) => typeof input === "string");
29
+ return {
30
+ schemaKeyed: strings.includes(SCHEMA_KEYED_INPUT),
31
+ tableModuleFolders: strings
32
+ .map((input) => TABLE_MODULE_GLOB.exec(input)?.[1])
33
+ .filter((folder) => folder !== undefined),
34
+ };
35
+ }
36
+ /** The `inputs` line that makes a suite hash one folder of table modules. */
37
+ export function tableModuleInput(folder) {
38
+ return `{workspaceRoot}/${folder}/*.tables.ts`;
39
+ }
40
+ export function checkSchemaKeyedCoverage(input) {
41
+ const declared = new Set(input.declaration.tableModuleFolders);
42
+ const reached = new Set();
43
+ const missing = new Set();
44
+ const needsAllMigrations = [];
45
+ if (input.unmigratedDatabases > 0) {
46
+ needsAllMigrations.push(`it built ${String(input.unmigratedDatabases)} database(s) from the migrations itself (startUnmigratedTestPostgres)`);
47
+ }
48
+ for (const table of input.touched) {
49
+ if (table.schemaName === MIGRATION_JOURNAL_SCHEMA) {
50
+ needsAllMigrations.push(`it read the migration journal (${table.schemaName}.${table.tableName})`);
51
+ continue;
52
+ }
53
+ const folder = input.tableOwners.get(table.tableName);
54
+ if (folder === undefined)
55
+ continue;
56
+ reached.add(folder);
57
+ if (!declared.has(folder))
58
+ missing.add(folder);
59
+ }
60
+ return {
61
+ missingFolders: [...missing].sort(),
62
+ needsAllMigrations,
63
+ reachedFolders: [...reached].sort(),
64
+ };
65
+ }
66
+ /** The failure a schema-keyed suite reports, with the exact fix. */
67
+ export function describeCoverageFailure(project, report) {
68
+ if (report.needsAllMigrations.length > 0) {
69
+ return [
70
+ `${project}:test:integration is schema-keyed (it lists "${SCHEMA_KEYED_INPUT}"), but ${report.needsAllMigrations.join("; ")}.`,
71
+ `Such a suite reads the migrations, not just the schema they produce: list "${ALL_MIGRATIONS_INPUT}" instead of "${SCHEMA_KEYED_INPUT}" in its test:integration inputs.`,
72
+ "See docs/testing/speed.md#schema-keyed-integration-suites.",
73
+ ].join("\n");
74
+ }
75
+ if (report.missingFolders.length === 0)
76
+ return null;
77
+ return [
78
+ `${project}:test:integration touched tables whose generated modules its Nx hash does not cover,`,
79
+ "so a migration to them would replay this suite's cached pass. Add to its test:integration inputs:",
80
+ ...report.missingFolders.map((folder) => ` "${tableModuleInput(folder)}",`),
81
+ "See docs/testing/speed.md#schema-keyed-integration-suites.",
82
+ ].join("\n");
83
+ }
84
+ //# sourceMappingURL=schema-keyed-coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-keyed-coverage.js","sourceRoot":"","sources":["../../../src/testing/global-setup/schema-keyed-coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAExD,gFAAgF;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAEzD,+DAA+D;AAC/D,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAElD,MAAM,iBAAiB,GACr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
+ /**
2
+ * Which Vitest target is running.
3
+ *
4
+ * The repo splits one file set into two tiers by FILE SUFFIX: the fast tier
5
+ * (`test`) runs the pure files, the container tier (`test:integration`) runs
6
+ * `*.integration.test.ts` and `*.e2e.test.ts` (docs/testing/speed.md). All 12
7
+ * `test:integration` targets set `VITEST_TIER=integration` and no `test`
8
+ * target sets it, so this one variable is a faithful answer to "will anything
9
+ * in this run touch a real vendor?".
10
+ *
11
+ * The shared globalSetup asks before it boots anything. It used to boot a
12
+ * Postgres and replay 21 migrations for every project that MIGHT run a
13
+ * container test, including on runs where the tier selection had already
14
+ * excluded every such file — `domain-ticketing` spent 51s of wall clock on 69
15
+ * tests whose own execution took 90ms.
16
+ *
17
+ * Skipping the boot cannot break a fast-tier test that turns out to need a
18
+ * database, for two independent reasons. The integration test tier check
19
+ * rejects any test file that imports `startTestPostgres` or a container module
20
+ * without a tier suffix, so such a file cannot sit in the fast tier in the
21
+ * first place; and if one somehow did, `startTestPostgres` falls back to
22
+ * booting its own container when the shared URL is absent. The gate can cost
23
+ * a run time. It cannot cost it a database.
24
+ */
25
+ /** Set by every `test:integration` target; unset by every `test` target. */
26
+ export declare const VITEST_TIER = "VITEST_TIER";
27
+ /** The one value the 12 `vitest.config.mts` files compare against. */
28
+ export declare const CONTAINER_TEST_TIER = "integration";
29
+ /** True when this run selected the files that boot a real vendor. */
30
+ export declare function isContainerTestRun(env: Readonly<Record<string, string | undefined>>): boolean;
31
+ //# sourceMappingURL=skip-unless-container-tests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skip-unless-container-tests.d.ts","sourceRoot":"","sources":["../../../src/testing/global-setup/skip-unless-container-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,qEAAqE;AACrE,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAChD,OAAO,CAET"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Which Vitest target is running.
3
+ *
4
+ * The repo splits one file set into two tiers by FILE SUFFIX: the fast tier
5
+ * (`test`) runs the pure files, the container tier (`test:integration`) runs
6
+ * `*.integration.test.ts` and `*.e2e.test.ts` (docs/testing/speed.md). All 12
7
+ * `test:integration` targets set `VITEST_TIER=integration` and no `test`
8
+ * target sets it, so this one variable is a faithful answer to "will anything
9
+ * in this run touch a real vendor?".
10
+ *
11
+ * The shared globalSetup asks before it boots anything. It used to boot a
12
+ * Postgres and replay 21 migrations for every project that MIGHT run a
13
+ * container test, including on runs where the tier selection had already
14
+ * excluded every such file — `domain-ticketing` spent 51s of wall clock on 69
15
+ * tests whose own execution took 90ms.
16
+ *
17
+ * Skipping the boot cannot break a fast-tier test that turns out to need a
18
+ * database, for two independent reasons. The integration test tier check
19
+ * rejects any test file that imports `startTestPostgres` or a container module
20
+ * without a tier suffix, so such a file cannot sit in the fast tier in the
21
+ * first place; and if one somehow did, `startTestPostgres` falls back to
22
+ * booting its own container when the shared URL is absent. The gate can cost
23
+ * a run time. It cannot cost it a database.
24
+ */
25
+ /** Set by every `test:integration` target; unset by every `test` target. */
26
+ export const VITEST_TIER = "VITEST_TIER";
27
+ /** The one value the 12 `vitest.config.mts` files compare against. */
28
+ export const CONTAINER_TEST_TIER = "integration";
29
+ /** True when this run selected the files that boot a real vendor. */
30
+ export function isContainerTestRun(env) {
31
+ return env[VITEST_TIER] === CONTAINER_TEST_TIER;
32
+ }
33
+ //# sourceMappingURL=skip-unless-container-tests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skip-unless-container-tests.js","sourceRoot":"","sources":["../../../src/testing/global-setup/skip-unless-container-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AAEzC,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEjD,qEAAqE;AACrE,MAAM,UAAU,kBAAkB,CAChC,GAAiD;IAEjD,OAAO,GAAG,CAAC,WAAW,CAAC,KAAK,mBAAmB,CAAC;AAClD,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `max_connections` on the shared test Postgres, set explicitly rather than
3
+ * left at the image's 100. Every Vitest worker of every project attached to
4
+ * one integration run opens its pools against this ONE server, so it is the
5
+ * ceiling those pools are budgeted against (application integration suites check their own
6
+ * worst case against it in `e2e-postgres-connection-budget.ts`). Idle
7
+ * slots cost nothing; a refused connection fails a test with
8
+ * `sorry, too many clients already`.
9
+ */
10
+ export declare const SHARED_TEST_POSTGRES_MAX_CONNECTIONS = 300;
11
+ /**
12
+ * Start the shared container and migrate the template. Called by the vitest
13
+ * `globalSetup`, once per process — never by a test.
14
+ */
15
+ export declare function startMigratedTemplatePostgres(): Promise<{
16
+ readonly url: string;
17
+ readonly containerId: string;
18
+ readonly stop: () => Promise<void>;
19
+ }>;
20
+ //# sourceMappingURL=start-migrated-template-postgres.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-migrated-template-postgres.d.ts","sourceRoot":"","sources":["../../../src/testing/global-setup/start-migrated-template-postgres.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAExD;;;GAGG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC;IAC7D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC,CAAC,CAUD"}
@@ -0,0 +1,53 @@
1
+ import { PostgreSqlContainer } from "@testcontainers/postgresql";
2
+ import { TEMPLATE_DATABASE, applyCheckedInSchema, } from "../start-test-postgres.js";
3
+ import { postgresStorageSettings, testPostgresStorage, withPostgresMemoryLimit, withPostgresStorage, } from "../test-postgres-storage.js";
4
+ /**
5
+ * `max_connections` on the shared test Postgres, set explicitly rather than
6
+ * left at the image's 100. Every Vitest worker of every project attached to
7
+ * one integration run opens its pools against this ONE server, so it is the
8
+ * ceiling those pools are budgeted against (application integration suites check their own
9
+ * worst case against it in `e2e-postgres-connection-budget.ts`). Idle
10
+ * slots cost nothing; a refused connection fails a test with
11
+ * `sorry, too many clients already`.
12
+ */
13
+ export const SHARED_TEST_POSTGRES_MAX_CONNECTIONS = 300;
14
+ /**
15
+ * Start the shared container and migrate the template. Called by the vitest
16
+ * `globalSetup`, once per process — never by a test.
17
+ */
18
+ export async function startMigratedTemplatePostgres() {
19
+ const container = await startSharedPostgresContainer();
20
+ const url = container.getConnectionUri();
21
+ await applyCheckedInSchema(url);
22
+ return {
23
+ url,
24
+ containerId: container.getId(),
25
+ stop: () => container.stop().then(() => undefined),
26
+ };
27
+ }
28
+ async function startSharedPostgresContainer() {
29
+ const previousRyuk = process.env["TESTCONTAINERS_RYUK_DISABLED"];
30
+ process.env["TESTCONTAINERS_RYUK_DISABLED"] = "true";
31
+ try {
32
+ const storage = testPostgresStorage();
33
+ const container = new PostgreSqlContainer("postgres:16-alpine")
34
+ .withDatabase(TEMPLATE_DATABASE)
35
+ .withLabels({ "dads.test.shared-postgres": "1" })
36
+ .withCommand([
37
+ "postgres",
38
+ "-c",
39
+ `max_connections=${String(SHARED_TEST_POSTGRES_MAX_CONNECTIONS)}`,
40
+ ...postgresStorageSettings(storage),
41
+ ]);
42
+ return await withPostgresMemoryLimit(withPostgresStorage(container, storage), storage).start();
43
+ }
44
+ finally {
45
+ if (previousRyuk === undefined) {
46
+ Reflect.deleteProperty(process.env, "TESTCONTAINERS_RYUK_DISABLED");
47
+ }
48
+ else {
49
+ process.env["TESTCONTAINERS_RYUK_DISABLED"] = previousRyuk;
50
+ }
51
+ }
52
+ }
53
+ //# sourceMappingURL=start-migrated-template-postgres.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-migrated-template-postgres.js","sourceRoot":"","sources":["../../../src/testing/global-setup/start-migrated-template-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,GAAG,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B;IAKjD,MAAM,SAAS,GAAG,MAAM,4BAA4B,EAAE,CAAC;IACvD,MAAM,GAAG,GAAG,SAAS,CAAC,gBAAgB,EAAE,CAAC;IACzC,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO;QACL,GAAG;QACH,WAAW,EAAE,SAAS,CAAC,KAAK,EAAE;QAC9B,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,4BAA4B;IACzC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,MAAM,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,IAAI,mBAAmB,CAAC,oBAAoB,CAAC;aAC5D,YAAY,CAAC,iBAAiB,CAAC;aAC/B,UAAU,CAAC,EAAE,2BAA2B,EAAE,GAAG,EAAE,CAAC;aAChD,WAAW,CAAC;YACX,UAAU;YACV,IAAI;YACJ,mBAAmB,MAAM,CAAC,oCAAoC,CAAC,EAAE;YACjE,GAAG,uBAAuB,CAAC,OAAO,CAAC;SACpC,CAAC,CAAC;QACL,OAAO,MAAM,uBAAuB,CAClC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,EACvC,OAAO,CACR,CAAC,KAAK,EAAE,CAAC;IACZ,CAAC;YAAS,CAAC;QACT,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,8BAA8B,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,YAAY,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Names each private database this vitest process creates, so the teardown
3
+ * can find exactly its own among the ones other projects made in the same
4
+ * shared container. Set by the globalSetup; inherited by the test workers.
5
+ */
6
+ export declare const TEST_DATABASE_RUN_PREFIX = "TEST_DATABASE_RUN_PREFIX";
7
+ /**
8
+ * Write every suite's reach to this file instead of failing — how a suite's
9
+ * table-module inputs are first written down. Never set in CI.
10
+ */
11
+ export declare const RECORD_SCHEMA_KEYED_REACH = "RECORD_SCHEMA_KEYED_REACH";
12
+ /** `test_<prefix>_m_<uuid>` from the template, `test_<prefix>_u_<uuid>` without. */
13
+ export declare function privateDatabaseName(prefix: string | undefined, migrated: boolean, unique: string): string;
14
+ /**
15
+ * Teardown check for a schema-keyed `test:integration` run: read which tables
16
+ * this run's private databases touched and fail when the project's hash does
17
+ * not cover one of them (schema-keyed-coverage.ts says why).
18
+ *
19
+ * Runs only under Nx (it needs to know whose run this is) and only on the
20
+ * shared container. On disk every private database outlives its test file
21
+ * and is read directly; under `TEST_POSTGRES_STORAGE=ram` a stopped database
22
+ * is dropped, so its touches are read from the retired-database ledger
23
+ * (retired-database-touches.ts). The per-file container mode is the nightly
24
+ * honesty job, which never reuses a cached result.
25
+ */
26
+ export declare function verifySchemaKeyedSuite(input: {
27
+ readonly sharedUrl: string;
28
+ readonly prefix: string;
29
+ readonly env: Readonly<Record<string, string | undefined>>;
30
+ readonly workspaceRoot: string;
31
+ }): Promise<void>;
32
+ /**
33
+ * A schema-keyed suite that boots its own container (no shared one, so no
34
+ * teardown check) would pass without anyone reading what it touched. Refuse
35
+ * it under Nx unless it is the per-file honesty mode, which never feeds the
36
+ * cache a result another run reuses.
37
+ */
38
+ export declare function refuseUnverifiableSchemaKeyedRun(input: {
39
+ readonly env: Readonly<Record<string, string | undefined>>;
40
+ readonly containerPerFile: boolean;
41
+ readonly workspaceRoot: string;
42
+ }): void;
43
+ //# sourceMappingURL=verify-schema-keyed-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-schema-keyed-suite.d.ts","sourceRoot":"","sources":["../../../src/testing/global-setup/verify-schema-keyed-suite.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAKrE,oFAAoF;AACpF,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CAkChB;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,GAAG,IAAI,CAgBP"}