@hot-updater/test-utils 1.2.0-rc.6 → 1.2.0-rc.60
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 +5 -1
- package/dist/index.d.mts +202 -106
- package/dist/index.mjs +2189 -232
- package/dist/node.cjs +11195 -19141
- package/dist/node.d.cts +1 -7
- package/dist/node.d.mts +1 -7
- package/dist/node.mjs +11196 -19141
- package/dist/react-native.d.cts +5 -1
- package/dist/react-native.d.mts +5 -1
- package/package.json +18 -13
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ test executors of `@hot-updater/test-utils/node` take `pg`, `mysql2` or
|
|
|
17
17
|
|
|
18
18
|
## Database adapters and providers
|
|
19
19
|
|
|
20
|
-
Register
|
|
20
|
+
Register four suites against a disposable test database:
|
|
21
21
|
|
|
22
22
|
- `setupDatabaseAdapterConformanceSuite` runs the database adapter contract case
|
|
23
23
|
by case: value round-trips, ordering, guards, all-or-nothing writes, unique
|
|
@@ -28,6 +28,10 @@ Register three suites against a disposable test database:
|
|
|
28
28
|
over `meterReads({ name, adapter: verifyAdapter(adapter) })` from
|
|
29
29
|
`@hot-updater/plugin-core`. `postgresRowsExamined` and `mysqlRowsExamined`
|
|
30
30
|
also count the rows a SQL database examined.
|
|
31
|
+
Register `setupReleaseLabelEngineTestSuite` beside it with the same options:
|
|
32
|
+
it writes releases as a server of an earlier release left them, without
|
|
33
|
+
labels, and checks the label fill, its catalog rebuilds, concurrent fills,
|
|
34
|
+
and the label index's uniqueness on your adapter.
|
|
31
35
|
- `setupDatabaseTestSuite` runs core, Bundles and the Release Catalog contract
|
|
32
36
|
through the admin and client HTTP APIs of `createHotUpdater`, then the suites
|
|
33
37
|
of the server plugins listed in `plugins`, such as the Insights plugin's
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { AnyHotUpdaterPlugin, BundlePatchRow, BundleRow, ChannelRow, ClientAuth, DatabaseAdapter, DeployReleasePolicy, EngineDatabase, HotUpdaterCoreApi, HotUpdaterDatabase, KeyValueStore, ModuleSchema, PhysicalTable, PluginApis, ReadMeasurement, ReleaseRow, StorageAdapter, StorageOperation, createEngine } from "@hot-updater/plugin-core";
|
|
1
2
|
import { ArtifactFiles, ArtifactInfo, Bundle } from "@hot-updater/protocol";
|
|
2
|
-
import { AnyHotUpdaterPlugin, BundlePatchRow, BundleRow, ChannelRow, ClientAuth, DatabaseAdapter, DeployReleasePolicy, EngineDatabase, HotUpdaterCoreApi, HotUpdaterDatabase, KeyValueStore, ModuleSchema, PhysicalTable, PluginApis, ReadMeasurement, ReleaseRow, StorageAdapter, StorageOperation } from "@hot-updater/plugin-core";
|
|
3
3
|
import { BundleEventRow, InsightsModel } from "@hot-updater/plugin-insights/server";
|
|
4
4
|
//#region src/httpTestClient.d.ts
|
|
5
5
|
type HttpTestRequestInit = NonNullable<ConstructorParameters<typeof Request>[1]>;
|
|
@@ -52,6 +52,16 @@ declare const createAdminApiTestClient: (getClient: () => HttpTestClient) => {
|
|
|
52
52
|
};
|
|
53
53
|
type AdminApiTestClient = ReturnType<typeof createAdminApiTestClient>;
|
|
54
54
|
//#endregion
|
|
55
|
+
//#region src/catalogFromLaterRelease.d.ts
|
|
56
|
+
/** A field no release of Hot Updater compiles, as a later release may add one. */
|
|
57
|
+
declare const LATER_RELEASE_CATALOG_FIELD = "laterReleaseField";
|
|
58
|
+
/**
|
|
59
|
+
* Rewrites a scope's stored catalog as a later release would compile it: a
|
|
60
|
+
* field this release does not know on each release descriptor, with the
|
|
61
|
+
* payload's hash and size to match. Returns the payload it wrote.
|
|
62
|
+
*/
|
|
63
|
+
declare const writeCatalogFromLaterRelease: (core: ReturnType<typeof createEngine>["core"], scopeKey: string) => Promise<string>;
|
|
64
|
+
//#endregion
|
|
55
65
|
//#region src/setupBundleMethodsTestSuite.d.ts
|
|
56
66
|
/**
|
|
57
67
|
* Bundles through admin API protocol 2: deployed with a release, read by
|
|
@@ -65,14 +75,148 @@ declare const setupBundleMethodsTestSuite: (options: {
|
|
|
65
75
|
/**
|
|
66
76
|
* Core's operations through admin API protocol 2 that the bundle and catalog
|
|
67
77
|
* suites leave out: channels, deploy refusals, promotion, preflights, a
|
|
68
|
-
* bundle's patch children,
|
|
69
|
-
* what it wrote, except a native build, which the
|
|
70
|
-
* and channel are the test's own.
|
|
78
|
+
* bundle's patch children, the native build registry, and the iOS device
|
|
79
|
+
* registry. Each test deletes what it wrote, except a native build, which the
|
|
80
|
+
* registry keeps: its IDs and channel are the test's own.
|
|
71
81
|
*/
|
|
72
82
|
declare const setupCoreAdminTestSuite: (options: {
|
|
73
83
|
readonly getClient: () => HttpTestClient;
|
|
74
84
|
}) => void;
|
|
75
85
|
//#endregion
|
|
86
|
+
//#region src/sqlRowsExamined.d.ts
|
|
87
|
+
/**
|
|
88
|
+
* Rows a SQL database examined for the reads a database adapter made: what
|
|
89
|
+
* read-budget suites compare with the rows the adapter read.
|
|
90
|
+
*/
|
|
91
|
+
interface RowsExamined {
|
|
92
|
+
/** Counts the reads from now on, and only those. */
|
|
93
|
+
reset(): void;
|
|
94
|
+
/** Rows examined for the reads since `reset`. */
|
|
95
|
+
total(): Promise<number>;
|
|
96
|
+
/** Rows the backend examines natively for each row it returns (default 1). */
|
|
97
|
+
readonly perRow?: number;
|
|
98
|
+
/** Rows the backend examines natively for each read beyond those (default 0). */
|
|
99
|
+
readonly perRead?: number;
|
|
100
|
+
}
|
|
101
|
+
/** A statement as the SQL core runs it. */
|
|
102
|
+
interface SqlStatementLike {
|
|
103
|
+
readonly sql: string;
|
|
104
|
+
readonly params: readonly unknown[];
|
|
105
|
+
}
|
|
106
|
+
/** A SQL core executor: its top-level `execute` runs the adapter's reads. */
|
|
107
|
+
interface SqlExecutorLike {
|
|
108
|
+
execute(statement: SqlStatementLike): Promise<unknown>;
|
|
109
|
+
}
|
|
110
|
+
/** Runs one statement on the session reads are explained on. */
|
|
111
|
+
type SqlQuery = (sql: string, params: readonly unknown[]) => Promise<readonly Record<string, unknown>[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Rows examined on PostgreSQL (PGlite or a server). Each SELECT a wrapped
|
|
114
|
+
* executor runs is first run under `EXPLAIN (ANALYZE, FORMAT JSON)` on
|
|
115
|
+
* `query`, one session with the planner settings above; each `reset` first
|
|
116
|
+
* vacuums and analyzes, as autovacuum keeps a production database. A plan
|
|
117
|
+
* then takes the index path a production-sized table takes, and a read no
|
|
118
|
+
* index serves still scans. A statement counts the rows its busiest table
|
|
119
|
+
* read examined, so an exact plan counts the rows it returns, a multi-valued
|
|
120
|
+
* index's own table included.
|
|
121
|
+
*/
|
|
122
|
+
declare const postgresRowsExamined: (query: SqlQuery) => {
|
|
123
|
+
/** The executor, examining each SELECT it runs outside a transaction. */
|
|
124
|
+
wrap: <T extends SqlExecutorLike>(executor: T) => T;
|
|
125
|
+
examined: {
|
|
126
|
+
reset(): void;
|
|
127
|
+
total(): Promise<number>;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Rows examined on MySQL. Each SELECT a wrapped executor runs is first run
|
|
132
|
+
* under `EXPLAIN ANALYZE` on `query`, one session, after `ANALYZE TABLE` of
|
|
133
|
+
* the tables it reads once per `reset`, and with multi-range reads always
|
|
134
|
+
* on, so a secondary index's range is costed with sorted row reads, as a
|
|
135
|
+
* production-sized table's is. A statement counts the rows its busiest table
|
|
136
|
+
* read examined; a filter above a table read drops rows that read produced.
|
|
137
|
+
*/
|
|
138
|
+
declare const mysqlRowsExamined: (query: SqlQuery) => {
|
|
139
|
+
/** The executor, examining each SELECT it runs outside a transaction. */
|
|
140
|
+
wrap: <T extends SqlExecutorLike>(executor: T) => T;
|
|
141
|
+
examined: {
|
|
142
|
+
reset(): void;
|
|
143
|
+
total(): Promise<number>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/setupReadBudgetTestSuite.d.ts
|
|
148
|
+
interface ReadBudgetAdapterContext {
|
|
149
|
+
/**
|
|
150
|
+
* Core's tables, those of the plugins the suite measures, and the settings
|
|
151
|
+
* table, where the retention passes keep their lease.
|
|
152
|
+
*/
|
|
153
|
+
readonly tables: readonly PhysicalTable[];
|
|
154
|
+
/** Test-only: the adapter must fetch at most this many rows per native page. */
|
|
155
|
+
readonly nativePageSize: number;
|
|
156
|
+
}
|
|
157
|
+
interface ReadBudgetSuiteOptions {
|
|
158
|
+
readonly name: string;
|
|
159
|
+
/** Returns an adapter over freshly created, empty tables. */
|
|
160
|
+
readonly createAdapter: (context: ReadBudgetAdapterContext) => Promise<{
|
|
161
|
+
readonly adapter: DatabaseAdapter;
|
|
162
|
+
readonly cleanup?: () => Promise<void>;
|
|
163
|
+
/** SQL backends: the rows the database examined for the adapter's reads. */
|
|
164
|
+
readonly examined?: RowsExamined;
|
|
165
|
+
/**
|
|
166
|
+
* The rows each statement of the adapter's writes and prunes read, as D1
|
|
167
|
+
* bills them, since `reset`.
|
|
168
|
+
*/
|
|
169
|
+
readonly written?: {
|
|
170
|
+
reset(): void;
|
|
171
|
+
rows(): Promise<readonly number[]>;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Index reads return row copies without `_v`, as the key-value adapter's
|
|
175
|
+
* do, so a transaction reads the rows it guards again, whole.
|
|
176
|
+
*/
|
|
177
|
+
readonly indexCopies?: boolean;
|
|
178
|
+
}>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The read-budget suite (PRD S4) on one backend: core and the server's
|
|
182
|
+
* built-in plugins on `createMeasuredDatabase` over the backend's adapter,
|
|
183
|
+
* native pages capped at two rows. Every API in the read-budget list reads
|
|
184
|
+
* exactly its budget at the adapter and at the engine; with `examined`, the
|
|
185
|
+
* database examines no more rows than the adapter read, within the backend's
|
|
186
|
+
* native multipliers. It loads `@hot-updater/server`, an optional peer.
|
|
187
|
+
*/
|
|
188
|
+
declare const setupReadBudgetTestSuite: (options: ReadBudgetSuiteOptions) => void;
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/setupReleaseLabelEngineTestSuite.d.ts
|
|
191
|
+
/** The backend under test, as `setupReadBudgetTestSuite` takes it. */
|
|
192
|
+
type ReleaseLabelEngineSuiteOptions = Pick<ReadBudgetSuiteOptions, "name" | "createAdapter">;
|
|
193
|
+
/**
|
|
194
|
+
* Release labels on a backend's own rows, which no HTTP API writes: the
|
|
195
|
+
* releases a server of an earlier release left without labels and without
|
|
196
|
+
* counters, which the fill labels per channel and platform in ID order,
|
|
197
|
+
* concurrent fills and a deploy included, rebuilding the catalogs compiled
|
|
198
|
+
* without them; and the label index, which refuses a second row with a label
|
|
199
|
+
* and holds any number without one. Rows are written as an earlier server
|
|
200
|
+
* wrote them through a second engine on the same adapter. It also writes a
|
|
201
|
+
* catalog as a later release compiles it, with a field this one does not
|
|
202
|
+
* know, which core verifies, never rewrites, and refuses to change. Register
|
|
203
|
+
* it beside `setupReadBudgetTestSuite`, with the same options.
|
|
204
|
+
*/
|
|
205
|
+
declare const setupReleaseLabelEngineTestSuite: (options: ReleaseLabelEngineSuiteOptions) => void;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/setupReleaseLabelTestSuite.d.ts
|
|
208
|
+
/**
|
|
209
|
+
* Release labels through a provider's admin and client HTTP APIs: deploys
|
|
210
|
+
* take each channel and platform's next label, concurrent ones never the
|
|
211
|
+
* same, a promotion takes the target's next, a delete leaves a gap, the
|
|
212
|
+
* list, detail and label lookup answer it, and the scope's catalog serves
|
|
213
|
+
* it. The backfill and the label index's uniqueness, which need rows an
|
|
214
|
+
* earlier server wrote, are `setupReleaseLabelEngineTestSuite`'s.
|
|
215
|
+
*/
|
|
216
|
+
declare const setupReleaseLabelTestSuite: (options: {
|
|
217
|
+
readonly getClient: () => HttpTestClient;
|
|
218
|
+
}) => void;
|
|
219
|
+
//#endregion
|
|
76
220
|
//#region src/setupSemverSatisfiesTestSuite.d.ts
|
|
77
221
|
/**
|
|
78
222
|
*
|
|
@@ -212,102 +356,6 @@ interface StorageAdapterTestSuiteOptions {
|
|
|
212
356
|
*/
|
|
213
357
|
declare const setupStorageAdapterTestSuite: (options: StorageAdapterTestSuiteOptions) => void;
|
|
214
358
|
//#endregion
|
|
215
|
-
//#region src/sqlRowsExamined.d.ts
|
|
216
|
-
/**
|
|
217
|
-
* Rows a SQL database examined for the reads a database adapter made: what
|
|
218
|
-
* read-budget suites compare with the rows the adapter read.
|
|
219
|
-
*/
|
|
220
|
-
interface RowsExamined {
|
|
221
|
-
/** Counts the reads from now on, and only those. */
|
|
222
|
-
reset(): void;
|
|
223
|
-
/** Rows examined for the reads since `reset`. */
|
|
224
|
-
total(): Promise<number>;
|
|
225
|
-
/** Rows the backend examines natively for each row it returns (default 1). */
|
|
226
|
-
readonly perRow?: number;
|
|
227
|
-
/** Rows the backend examines natively for each read beyond those (default 0). */
|
|
228
|
-
readonly perRead?: number;
|
|
229
|
-
}
|
|
230
|
-
/** A statement as the SQL core runs it. */
|
|
231
|
-
interface SqlStatementLike {
|
|
232
|
-
readonly sql: string;
|
|
233
|
-
readonly params: readonly unknown[];
|
|
234
|
-
}
|
|
235
|
-
/** A SQL core executor: its top-level `execute` runs the adapter's reads. */
|
|
236
|
-
interface SqlExecutorLike {
|
|
237
|
-
execute(statement: SqlStatementLike): Promise<unknown>;
|
|
238
|
-
}
|
|
239
|
-
/** Runs one statement on the session reads are explained on. */
|
|
240
|
-
type SqlQuery = (sql: string, params: readonly unknown[]) => Promise<readonly Record<string, unknown>[]>;
|
|
241
|
-
/**
|
|
242
|
-
* Rows examined on PostgreSQL (PGlite or a server). Each SELECT a wrapped
|
|
243
|
-
* executor runs is first run under `EXPLAIN (ANALYZE, FORMAT JSON)` on
|
|
244
|
-
* `query`, one session with the planner settings above; each `reset` first
|
|
245
|
-
* vacuums and analyzes, as autovacuum keeps a production database. A plan
|
|
246
|
-
* then takes the index path a production-sized table takes, and a read no
|
|
247
|
-
* index serves still scans. A statement counts the rows its busiest table
|
|
248
|
-
* read examined, so an exact plan counts the rows it returns, a multi-valued
|
|
249
|
-
* index's own table included.
|
|
250
|
-
*/
|
|
251
|
-
declare const postgresRowsExamined: (query: SqlQuery) => {
|
|
252
|
-
/** The executor, examining each SELECT it runs outside a transaction. */
|
|
253
|
-
wrap: <T extends SqlExecutorLike>(executor: T) => T;
|
|
254
|
-
examined: {
|
|
255
|
-
reset(): void;
|
|
256
|
-
total(): Promise<number>;
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Rows examined on MySQL. Each SELECT a wrapped executor runs is first run
|
|
261
|
-
* under `EXPLAIN ANALYZE` on `query`, one session, after `ANALYZE TABLE` of
|
|
262
|
-
* the tables it reads once per `reset`, and with multi-range reads always
|
|
263
|
-
* on, so a secondary index's range is costed with sorted row reads, as a
|
|
264
|
-
* production-sized table's is. A statement counts the rows its busiest table
|
|
265
|
-
* read examined; a filter above a table read drops rows that read produced.
|
|
266
|
-
*/
|
|
267
|
-
declare const mysqlRowsExamined: (query: SqlQuery) => {
|
|
268
|
-
/** The executor, examining each SELECT it runs outside a transaction. */
|
|
269
|
-
wrap: <T extends SqlExecutorLike>(executor: T) => T;
|
|
270
|
-
examined: {
|
|
271
|
-
reset(): void;
|
|
272
|
-
total(): Promise<number>;
|
|
273
|
-
};
|
|
274
|
-
};
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/setupReadBudgetTestSuite.d.ts
|
|
277
|
-
interface ReadBudgetAdapterContext {
|
|
278
|
-
/**
|
|
279
|
-
* Core's tables, those of the plugins the suite measures, and the settings
|
|
280
|
-
* table, where the retention passes keep their lease.
|
|
281
|
-
*/
|
|
282
|
-
readonly tables: readonly PhysicalTable[];
|
|
283
|
-
/** Test-only: the adapter must fetch at most this many rows per native page. */
|
|
284
|
-
readonly nativePageSize: number;
|
|
285
|
-
}
|
|
286
|
-
interface ReadBudgetSuiteOptions {
|
|
287
|
-
readonly name: string;
|
|
288
|
-
/** Returns an adapter over freshly created, empty tables. */
|
|
289
|
-
readonly createAdapter: (context: ReadBudgetAdapterContext) => Promise<{
|
|
290
|
-
readonly adapter: DatabaseAdapter;
|
|
291
|
-
readonly cleanup?: () => Promise<void>;
|
|
292
|
-
/** SQL backends: the rows the database examined for the adapter's reads. */
|
|
293
|
-
readonly examined?: RowsExamined;
|
|
294
|
-
/**
|
|
295
|
-
* Index reads return row copies without `_v`, as the key-value adapter's
|
|
296
|
-
* do, so a transaction reads the rows it guards again, whole.
|
|
297
|
-
*/
|
|
298
|
-
readonly indexCopies?: boolean;
|
|
299
|
-
}>;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* The read-budget suite (PRD S4) on one backend: core and the server's
|
|
303
|
-
* built-in plugins on `createMeasuredDatabase` over the backend's adapter,
|
|
304
|
-
* native pages capped at two rows. Every API in the read-budget list reads
|
|
305
|
-
* exactly its budget at the adapter and at the engine; with `examined`, the
|
|
306
|
-
* database examines no more rows than the adapter read, within the backend's
|
|
307
|
-
* native multipliers. It loads `@hot-updater/server`, an optional peer.
|
|
308
|
-
*/
|
|
309
|
-
declare const setupReadBudgetTestSuite: (options: ReadBudgetSuiteOptions) => void;
|
|
310
|
-
//#endregion
|
|
311
359
|
//#region src/setupAggregateBatchingTestSuite.d.ts
|
|
312
360
|
interface AggregateBatchingSuiteOptions {
|
|
313
361
|
readonly name: string;
|
|
@@ -321,8 +369,8 @@ interface AggregateBatchingSuiteOptions {
|
|
|
321
369
|
}
|
|
322
370
|
/**
|
|
323
371
|
* Aggregates declared `batched` on a key-value store: log rows the store
|
|
324
|
-
* writes with each transaction and a compaction merges once,
|
|
325
|
-
*
|
|
372
|
+
* writes with each transaction and a compaction merges once, read back
|
|
373
|
+
* exactly as transactional writes read.
|
|
326
374
|
*/
|
|
327
375
|
declare const setupAggregateBatchingTestSuite: ({ name, createAdapter, oversizedRows }: AggregateBatchingSuiteOptions) => void;
|
|
328
376
|
//#endregion
|
|
@@ -454,6 +502,21 @@ declare const createBundleEventRowFixture: (suffix: string, receivedAtMs: number
|
|
|
454
502
|
type: "UPDATE_APPLIED" | "RECOVERED";
|
|
455
503
|
}>;
|
|
456
504
|
//#endregion
|
|
505
|
+
//#region src/insights/insights11.d.ts
|
|
506
|
+
/**
|
|
507
|
+
* A 1.1 server's `insights()` as far as the release-ref backfill reads it:
|
|
508
|
+
* its API's `record(row)` stores an event and counts its outcome hours by
|
|
509
|
+
* artifact, as 1.1's `countOutcome` did, to test the backfill and `db
|
|
510
|
+
* migrate` on rows a 1.1 server wrote. It stands in for the official
|
|
511
|
+
* plugin, so it takes its id and brand; serve it over a database whose
|
|
512
|
+
* Insights tables `insights()` created.
|
|
513
|
+
*/
|
|
514
|
+
declare const insights11TestPlugin: () => AnyHotUpdaterPlugin;
|
|
515
|
+
/** What `insights11TestPlugin()` serves as `api.insights`. */
|
|
516
|
+
type Insights11TestApi = {
|
|
517
|
+
readonly record: (event: BundleEventRow) => Promise<void>;
|
|
518
|
+
};
|
|
519
|
+
//#endregion
|
|
457
520
|
//#region src/insights/setupInsightsHttpTestSuite.d.ts
|
|
458
521
|
/**
|
|
459
522
|
* The Insights plugin's routes on a database: a client reports an event, and
|
|
@@ -475,13 +538,17 @@ declare const setupInsightsModelTestSuite: (lifecycle: DatabaseTestLifecycle<Ins
|
|
|
475
538
|
//#region src/insights/index.d.ts
|
|
476
539
|
/**
|
|
477
540
|
* The Insights plugin's tests, for `setupDatabaseTestSuite`'s `plugins`: its
|
|
478
|
-
* HTTP routes on the provider's server, which must run `insights()
|
|
479
|
-
*
|
|
541
|
+
* HTTP routes on the provider's server, which must run `insights()`; with
|
|
542
|
+
* `createModel` its report contract on the provider's database, such as
|
|
480
543
|
* `(database) => createInsightsModel(createHotUpdater({ database, storage,
|
|
481
|
-
* plugins: [insights()], clientAccess: "public" }).api.insights)
|
|
544
|
+
* plugins: [insights()], clientAccess: "public" }).api.insights)`; and with
|
|
545
|
+
* `createApi` the backfill of a 1.1 server's rows, such as `(database,
|
|
546
|
+
* plugin = insights()) => createHotUpdater({ database, storage, plugins:
|
|
547
|
+
* [plugin], clientAccess: "public" }).api.insights`.
|
|
482
548
|
*/
|
|
483
549
|
declare const insightsTestSuite: <TDatabase = EngineDatabase>(options?: {
|
|
484
550
|
readonly createModel?: (database: TDatabase) => InsightsModel;
|
|
551
|
+
readonly createApi?: (database: TDatabase, plugin?: AnyHotUpdaterPlugin) => unknown;
|
|
485
552
|
}) => {
|
|
486
553
|
name: string;
|
|
487
554
|
register: (context: {
|
|
@@ -538,4 +605,33 @@ declare const RELEASE_CATALOG_STORAGE_FIXTURES: Readonly<Record<string, string>>
|
|
|
538
605
|
/** Storage boundary shared by provider and separately spawned server tests. */
|
|
539
606
|
declare const createReleaseCatalogTestStorage: () => StorageAdapter;
|
|
540
607
|
//#endregion
|
|
541
|
-
|
|
608
|
+
//#region src/capacityCappedStore.d.ts
|
|
609
|
+
interface CapacityCappedStoreOptions {
|
|
610
|
+
/** The write units the store admits a second, as DynamoDB's `MaxWriteRequestUnits`. */
|
|
611
|
+
readonly unitsPerSecond: number;
|
|
612
|
+
/** Virtual time an admitted write takes; 300 ms by default. */
|
|
613
|
+
readonly writeMs?: number;
|
|
614
|
+
/**
|
|
615
|
+
* Virtual time a throttled write takes before the store reports it: the
|
|
616
|
+
* client's own throttling retries; 3 s by default.
|
|
617
|
+
*/
|
|
618
|
+
readonly throttledMs?: number;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* `store` behind a strict write-capacity cap: a token bucket refilled at
|
|
622
|
+
* `unitsPerSecond` on a virtual clock, holding one second of units, with
|
|
623
|
+
* writes priced as DynamoDB prices transactional ones. A write that costs
|
|
624
|
+
* more than the bucket holds is refused as DynamoDB's store reports a
|
|
625
|
+
* throttle, `{ ok: false, retry: true }`, so one costing more than a second
|
|
626
|
+
* of capacity is never admitted. DynamoDB with
|
|
627
|
+
* `OnDemandThroughput.MaxWriteRequestUnits` is looser, since it admits such a
|
|
628
|
+
* write from burst capacity when it has some and refuses by time window
|
|
629
|
+
* otherwise; the strict cap makes a transaction too large for the cap fail
|
|
630
|
+
* every time instead of by chance. Reads and `deleteConsumed` are not capped.
|
|
631
|
+
*/
|
|
632
|
+
declare const createCapacityCappedStore: (store: KeyValueStore, { unitsPerSecond, writeMs, throttledMs }: CapacityCappedStoreOptions) => KeyValueStore & {
|
|
633
|
+
/** Writes refused for capacity so far. */
|
|
634
|
+
readonly throttles: () => number;
|
|
635
|
+
};
|
|
636
|
+
//#endregion
|
|
637
|
+
export { AdminApiTestClient, AggregateBatchingSuiteOptions, CapacityCappedStoreOptions, ContentionOptions, ContentionReport, DatabaseAdapterConformanceContext, DatabaseAdapterConformanceOptions, DatabasePluginTestSuite, type DatabaseTestLifecycle, DatabaseTestSuiteOptions, HttpTestClient, HttpTestHandlers, HttpTestRequest, HttpTestRequestInit, HttpTestServer, type Insights11TestApi, LATER_RELEASE_CATALOG_FIELD, MeasuredDatabase, MeasuredDatabaseOptions, MeasuredDatabaseStorage, MemoryKeyValueStoreOptions, PluginTestHarnessOptions, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, ReadBudgetAdapterContext, ReadBudgetSuiteOptions, ReleaseLabelEngineSuiteOptions, RowsExamined, SqlExecutorLike, SqlQuery, SqlStatementLike, StorageAdapterTestSuiteOptions, conformanceCounters, conformanceExpiring, conformanceItems, createAdminApiTestClient, createBundleEventRowFixture, createBundleFixture, createBundlePatchRowFixture, createBundleRowFixture, createCapacityCappedStore, createChannelRowFixture, createHandlerHttpTestClient, createHttpTestClient, createMeasuredDatabase, createMemoryKeyValueStore, createPluginTestHarness, createReleaseCatalogTestStorage, createReleaseRowFixture, expectInsightsIndex, insights11TestPlugin, insightsTestSuite, jsonRequest, mysqlRowsExamined, postgresRowsExamined, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, runContentionHarness, setupAggregateBatchingTestSuite, setupBundleMethodsTestSuite, setupCoreAdminTestSuite, setupDatabaseAdapterConformanceSuite, setupDatabaseTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite, setupReadBudgetTestSuite, setupReleaseCatalogTestSuite, setupReleaseLabelEngineTestSuite, setupReleaseLabelTestSuite, setupSemverSatisfiesTestSuite, setupStorageAdapterTestSuite, startHttpTestServer, storeBundles, toDeployBundle, withAdapterLatency, writeCatalogFromLaterRelease };
|