rivetkit 2.1.2 → 2.1.3
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/dist/browser/client.js +1 -1
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/inspector.tar.gz +0 -0
- package/dist/tsup/{chunk-NXEHFUDB.cjs → chunk-5AZ6UPEF.cjs} +24 -21
- package/dist/tsup/chunk-5AZ6UPEF.cjs.map +1 -0
- package/dist/tsup/{chunk-YQ5P6KMN.js → chunk-6LHZQSWJ.js} +8 -5
- package/dist/tsup/{chunk-YQ5P6KMN.js.map → chunk-6LHZQSWJ.js.map} +1 -1
- package/dist/tsup/{chunk-BFI4LYS2.js → chunk-6T3WSP5M.js} +4 -4
- package/dist/tsup/{chunk-772NPMTY.cjs → chunk-BMNB6YRQ.cjs} +160 -103
- package/dist/tsup/chunk-BMNB6YRQ.cjs.map +1 -0
- package/dist/tsup/{chunk-GVQAVU7R.cjs → chunk-DADGS67O.cjs} +4 -4
- package/dist/tsup/{chunk-GVQAVU7R.cjs.map → chunk-DADGS67O.cjs.map} +1 -1
- package/dist/tsup/{chunk-RHUII57M.js → chunk-GNGRMP5E.js} +10 -6
- package/dist/tsup/chunk-GNGRMP5E.js.map +1 -0
- package/dist/tsup/{chunk-PZAV6PP2.cjs → chunk-HPAX7L72.cjs} +152 -152
- package/dist/tsup/{chunk-PZAV6PP2.cjs.map → chunk-HPAX7L72.cjs.map} +1 -1
- package/dist/tsup/{chunk-UZV7NXC6.cjs → chunk-IJAGZS57.cjs} +30 -30
- package/dist/tsup/{chunk-UZV7NXC6.cjs.map → chunk-IJAGZS57.cjs.map} +1 -1
- package/dist/tsup/{chunk-HFWRHT5T.cjs → chunk-KSZZRTOD.cjs} +3 -3
- package/dist/tsup/{chunk-HFWRHT5T.cjs.map → chunk-KSZZRTOD.cjs.map} +1 -1
- package/dist/tsup/{chunk-PSUVV4HM.js → chunk-MAXIXG56.js} +2 -2
- package/dist/tsup/{chunk-HB4RGGMC.js → chunk-N7ASEZ2Y.js} +5 -5
- package/dist/tsup/{chunk-PW3YONDJ.js → chunk-OAOF23ZY.js} +2 -2
- package/dist/tsup/{chunk-TDFDR7AO.js → chunk-POUBQA6Z.js} +2 -2
- package/dist/tsup/{chunk-VMX4I4MP.js → chunk-QUDLEWGD.js} +3 -3
- package/dist/tsup/{chunk-MNS5LY6M.cjs → chunk-R64EFI6F.cjs} +74 -74
- package/dist/tsup/{chunk-MNS5LY6M.cjs.map → chunk-R64EFI6F.cjs.map} +1 -1
- package/dist/tsup/{chunk-QABDKI3W.cjs → chunk-T6MM5RTW.cjs} +248 -244
- package/dist/tsup/chunk-T6MM5RTW.cjs.map +1 -0
- package/dist/tsup/{chunk-ZHQDRRMY.cjs → chunk-U6VWVHVW.cjs} +3 -3
- package/dist/tsup/{chunk-ZHQDRRMY.cjs.map → chunk-U6VWVHVW.cjs.map} +1 -1
- package/dist/tsup/{chunk-WUXR722E.js → chunk-YET3IZD6.js} +2 -2
- package/dist/tsup/{chunk-WUXR722E.js.map → chunk-YET3IZD6.js.map} +1 -1
- package/dist/tsup/{chunk-BSIJG3LG.js → chunk-YLDDENCZ.js} +69 -12
- package/dist/tsup/chunk-YLDDENCZ.js.map +1 -0
- package/dist/tsup/{chunk-RMJJE43B.cjs → chunk-ZSJ2OTY4.cjs} +2 -2
- package/dist/tsup/{chunk-RMJJE43B.cjs.map → chunk-ZSJ2OTY4.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/driver-helpers/mod.cjs +4 -4
- package/dist/tsup/driver-helpers/mod.js +3 -3
- package/dist/tsup/driver-test-suite/mod.cjs +425 -338
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.js +376 -289
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +3 -3
- package/dist/tsup/inspector/mod.js +2 -2
- package/dist/tsup/mod.cjs +8 -8
- package/dist/tsup/mod.js +7 -7
- package/dist/tsup/serve-test-suite/mod.cjs +111 -99
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +22 -10
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -10
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +5 -5
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +5 -5
- package/src/actor/instance/mod.ts +13 -2
- package/src/driver-test-suite/tests/actor-db.ts +299 -216
- package/src/driver-test-suite/tests/actor-queue.ts +10 -9
- package/src/driver-test-suite/tests/actor-workflow.ts +12 -2
- package/src/driver-test-suite/utils.ts +8 -8
- package/src/drivers/engine/actor-driver.ts +77 -7
- package/src/workflow/driver.ts +4 -1
- package/dist/tsup/chunk-772NPMTY.cjs.map +0 -1
- package/dist/tsup/chunk-BSIJG3LG.js.map +0 -1
- package/dist/tsup/chunk-NXEHFUDB.cjs.map +0 -1
- package/dist/tsup/chunk-QABDKI3W.cjs.map +0 -1
- package/dist/tsup/chunk-RHUII57M.js.map +0 -1
- /package/dist/tsup/{chunk-BFI4LYS2.js.map → chunk-6T3WSP5M.js.map} +0 -0
- /package/dist/tsup/{chunk-PSUVV4HM.js.map → chunk-MAXIXG56.js.map} +0 -0
- /package/dist/tsup/{chunk-HB4RGGMC.js.map → chunk-N7ASEZ2Y.js.map} +0 -0
- /package/dist/tsup/{chunk-PW3YONDJ.js.map → chunk-OAOF23ZY.js.map} +0 -0
- /package/dist/tsup/{chunk-TDFDR7AO.js.map → chunk-POUBQA6Z.js.map} +0 -0
- /package/dist/tsup/{chunk-VMX4I4MP.js.map → chunk-QUDLEWGD.js.map} +0 -0
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('../chunk-
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-
|
|
7
|
+
var _chunkIJAGZS57cjs = require('../chunk-IJAGZS57.cjs');
|
|
8
|
+
require('../chunk-5AZ6UPEF.cjs');
|
|
9
|
+
require('../chunk-DADGS67O.cjs');
|
|
10
|
+
require('../chunk-BMNB6YRQ.cjs');
|
|
11
|
+
require('../chunk-T6MM5RTW.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkHPAX7L72cjs = require('../chunk-HPAX7L72.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkU6VWVHVWcjs = require('../chunk-U6VWVHVW.cjs');
|
|
21
21
|
require('../chunk-6LJAZ5R4.cjs');
|
|
22
22
|
require('../chunk-SR3KQE7Q.cjs');
|
|
23
23
|
|
|
@@ -29,14 +29,14 @@ require('../chunk-SR3KQE7Q.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkR64EFI6Fcjs = require('../chunk-R64EFI6F.cjs');
|
|
33
33
|
require('../chunk-NIYZDWMW.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _chunkKSZZRTODcjs = require('../chunk-KSZZRTOD.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkZSJ2OTY4cjs = require('../chunk-ZSJ2OTY4.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -85,20 +85,20 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
85
85
|
const oldUrl = new URL(actorRequest.url);
|
|
86
86
|
const normalizedPath = oldUrl.pathname.startsWith("/") ? oldUrl.pathname.slice(1) : oldUrl.pathname;
|
|
87
87
|
const pathWithQuery = normalizedPath + oldUrl.search;
|
|
88
|
-
|
|
88
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).debug({
|
|
89
89
|
msg: "sending raw http request via test inline driver",
|
|
90
90
|
actorId,
|
|
91
91
|
encoding,
|
|
92
92
|
path: pathWithQuery
|
|
93
93
|
});
|
|
94
94
|
const url = `${endpoint}/.test/inline-driver/send-request/${pathWithQuery}`;
|
|
95
|
-
|
|
95
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).debug({
|
|
96
96
|
msg: "rewriting http url",
|
|
97
97
|
from: oldUrl,
|
|
98
98
|
to: url
|
|
99
99
|
});
|
|
100
100
|
const headers = new Headers(actorRequest.headers);
|
|
101
|
-
headers.set(
|
|
101
|
+
headers.set(_chunkR64EFI6Fcjs.HEADER_ACTOR_ID, actorId);
|
|
102
102
|
const response = await fetch(
|
|
103
103
|
new Request(url, {
|
|
104
104
|
method: actorRequest.method,
|
|
@@ -114,7 +114,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
114
114
|
const errorData = await clonedResponse.json();
|
|
115
115
|
if (errorData.error) {
|
|
116
116
|
if (typeof errorData.error === "object") {
|
|
117
|
-
throw new (0,
|
|
117
|
+
throw new (0, _chunkHPAX7L72cjs.ActorError)(
|
|
118
118
|
errorData.error.code,
|
|
119
119
|
errorData.error.message,
|
|
120
120
|
errorData.error.metadata
|
|
@@ -122,7 +122,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
} catch (e) {
|
|
125
|
-
if (!(e instanceof
|
|
125
|
+
if (!(e instanceof _chunkHPAX7L72cjs.ActorError)) {
|
|
126
126
|
return response;
|
|
127
127
|
}
|
|
128
128
|
throw e;
|
|
@@ -131,33 +131,33 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
131
131
|
return response;
|
|
132
132
|
},
|
|
133
133
|
async openWebSocket(path, actorId, encoding2, params) {
|
|
134
|
-
const WebSocket2 = await
|
|
134
|
+
const WebSocket2 = await _chunkU6VWVHVWcjs.importWebSocket.call(void 0, );
|
|
135
135
|
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
136
136
|
const wsUrl = new URL(
|
|
137
137
|
`${endpoint}/.test/inline-driver/connect-websocket/ws`
|
|
138
138
|
);
|
|
139
|
-
|
|
139
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).debug({
|
|
140
140
|
msg: "creating websocket connection via test inline driver",
|
|
141
141
|
url: wsUrl.toString()
|
|
142
142
|
});
|
|
143
143
|
const wsProtocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
144
144
|
const finalWsUrl = `${wsProtocol}//${wsUrl.host}${wsUrl.pathname}`;
|
|
145
145
|
const protocols = [];
|
|
146
|
-
protocols.push(
|
|
147
|
-
protocols.push(`${
|
|
146
|
+
protocols.push(_chunkR64EFI6Fcjs.WS_PROTOCOL_STANDARD);
|
|
147
|
+
protocols.push(`${_chunkR64EFI6Fcjs.WS_PROTOCOL_TARGET}actor`);
|
|
148
148
|
protocols.push(
|
|
149
|
-
`${
|
|
149
|
+
`${_chunkR64EFI6Fcjs.WS_PROTOCOL_ACTOR}${encodeURIComponent(actorId)}`
|
|
150
150
|
);
|
|
151
|
-
protocols.push(`${
|
|
151
|
+
protocols.push(`${_chunkR64EFI6Fcjs.WS_PROTOCOL_ENCODING}${encoding2}`);
|
|
152
152
|
protocols.push(
|
|
153
|
-
`${
|
|
153
|
+
`${_chunkR64EFI6Fcjs.WS_TEST_PROTOCOL_PATH}${encodeURIComponent(normalizedPath)}`
|
|
154
154
|
);
|
|
155
155
|
if (params !== void 0) {
|
|
156
156
|
protocols.push(
|
|
157
|
-
`${
|
|
157
|
+
`${_chunkR64EFI6Fcjs.WS_PROTOCOL_CONN_PARAMS}${encodeURIComponent(JSON.stringify(params))}`
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).debug({
|
|
161
161
|
msg: "connecting to websocket",
|
|
162
162
|
url: finalWsUrl,
|
|
163
163
|
protocols
|
|
@@ -177,7 +177,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
177
177
|
encoding2,
|
|
178
178
|
params
|
|
179
179
|
);
|
|
180
|
-
return upgradeWebSocket(() => wsHandler)(c,
|
|
180
|
+
return upgradeWebSocket(() => wsHandler)(c, _chunkZSJ2OTY4cjs.noopNext.call(void 0, ));
|
|
181
181
|
},
|
|
182
182
|
async buildGatewayUrl(actorId) {
|
|
183
183
|
return `${endpoint}/gateway/${actorId}`;
|
|
@@ -194,7 +194,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
async function makeInlineRequest(endpoint, encoding, method, args) {
|
|
197
|
-
|
|
197
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).debug({
|
|
198
198
|
msg: "sending inline request",
|
|
199
199
|
encoding,
|
|
200
200
|
method,
|
|
@@ -224,14 +224,14 @@ async function makeInlineRequest(endpoint, encoding, method, args) {
|
|
|
224
224
|
if ("ok" in callResponse) {
|
|
225
225
|
return callResponse.ok;
|
|
226
226
|
} else if ("err" in callResponse) {
|
|
227
|
-
throw new (0,
|
|
227
|
+
throw new (0, _chunkHPAX7L72cjs.ActorError)(
|
|
228
228
|
callResponse.err.group,
|
|
229
229
|
callResponse.err.code,
|
|
230
230
|
callResponse.err.message,
|
|
231
231
|
callResponse.err.metadata
|
|
232
232
|
);
|
|
233
233
|
} else {
|
|
234
|
-
|
|
234
|
+
_chunkKSZZRTODcjs.assertUnreachable.call(void 0, callResponse);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -243,13 +243,9 @@ async function setupDriverTest(c, driverTestConfig) {
|
|
|
243
243
|
_vitest.vi.setSystemTime(FAKE_TIME);
|
|
244
244
|
}
|
|
245
245
|
const { endpoint, namespace, runnerName, cleanup } = await driverTestConfig.start();
|
|
246
|
-
c.onTestFinished(() => {
|
|
247
|
-
_chunkUZV7NXC6cjs.logger.call(void 0, ).info("cleaning up test");
|
|
248
|
-
cleanup();
|
|
249
|
-
});
|
|
250
246
|
let client;
|
|
251
247
|
if (driverTestConfig.clientType === "http") {
|
|
252
|
-
client =
|
|
248
|
+
client = _chunkHPAX7L72cjs.createClient.call(void 0, {
|
|
253
249
|
endpoint,
|
|
254
250
|
namespace,
|
|
255
251
|
runnerName,
|
|
@@ -262,16 +258,20 @@ async function setupDriverTest(c, driverTestConfig) {
|
|
|
262
258
|
} else if (driverTestConfig.clientType === "inline") {
|
|
263
259
|
const encoding = _nullishCoalesce(driverTestConfig.encoding, () => ( "bare"));
|
|
264
260
|
const managerDriver = createTestInlineClientDriver(endpoint, encoding);
|
|
265
|
-
const runConfig =
|
|
261
|
+
const runConfig = _chunkHPAX7L72cjs.ClientConfigSchema.parse({
|
|
266
262
|
encoding
|
|
267
263
|
});
|
|
268
|
-
client =
|
|
264
|
+
client = _chunkHPAX7L72cjs.createClientWithDriver.call(void 0, managerDriver, runConfig);
|
|
269
265
|
} else {
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
if (!driverTestConfig.HACK_skipCleanupNet) {
|
|
273
|
-
c.onTestFinished(async () => await client.dispose());
|
|
266
|
+
_chunkKSZZRTODcjs.assertUnreachable.call(void 0, driverTestConfig.clientType);
|
|
274
267
|
}
|
|
268
|
+
c.onTestFinished(async () => {
|
|
269
|
+
if (!driverTestConfig.HACK_skipCleanupNet) {
|
|
270
|
+
await client.dispose();
|
|
271
|
+
}
|
|
272
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).info("cleaning up test");
|
|
273
|
+
await cleanup();
|
|
274
|
+
});
|
|
275
275
|
return {
|
|
276
276
|
client,
|
|
277
277
|
endpoint
|
|
@@ -989,7 +989,7 @@ function runActorConnHibernationTests(driverTestConfig) {
|
|
|
989
989
|
await hibernatingActor.triggerSleep();
|
|
990
990
|
await waitFor(
|
|
991
991
|
driverTestConfig,
|
|
992
|
-
|
|
992
|
+
_chunkIJAGZS57cjs.HIBERNATION_SLEEP_TIMEOUT + 100
|
|
993
993
|
);
|
|
994
994
|
const ping2 = await hibernatingActor.ping();
|
|
995
995
|
_vitest.expect.call(void 0, ping2).toBe("pong");
|
|
@@ -1011,7 +1011,7 @@ function runActorConnHibernationTests(driverTestConfig) {
|
|
|
1011
1011
|
await hibernatingActor.triggerSleep();
|
|
1012
1012
|
await waitFor(
|
|
1013
1013
|
driverTestConfig,
|
|
1014
|
-
|
|
1014
|
+
_chunkIJAGZS57cjs.HIBERNATION_SLEEP_TIMEOUT + 100
|
|
1015
1015
|
);
|
|
1016
1016
|
const count3 = await hibernatingActor.getConnCount();
|
|
1017
1017
|
_vitest.expect.call(void 0, count3).toBe(2);
|
|
@@ -1033,7 +1033,7 @@ function runActorConnHibernationTests(driverTestConfig) {
|
|
|
1033
1033
|
await conn1.triggerSleep();
|
|
1034
1034
|
await waitFor(
|
|
1035
1035
|
driverTestConfig,
|
|
1036
|
-
|
|
1036
|
+
_chunkIJAGZS57cjs.HIBERNATION_SLEEP_TIMEOUT + 100
|
|
1037
1037
|
);
|
|
1038
1038
|
await conn1.dispose();
|
|
1039
1039
|
await waitFor(driverTestConfig, 250);
|
|
@@ -1247,6 +1247,7 @@ var HIGH_VOLUME_COUNT = 1e3;
|
|
|
1247
1247
|
var SLEEP_WAIT_MS = 150;
|
|
1248
1248
|
var LIFECYCLE_POLL_INTERVAL_MS = 25;
|
|
1249
1249
|
var LIFECYCLE_POLL_ATTEMPTS = 40;
|
|
1250
|
+
var REAL_TIMER_DB_TIMEOUT_MS = 18e4;
|
|
1250
1251
|
var CHUNK_BOUNDARY_SIZES = [
|
|
1251
1252
|
CHUNK_SIZE - 1,
|
|
1252
1253
|
CHUNK_SIZE,
|
|
@@ -1271,294 +1272,373 @@ function getDbActor(client, variant) {
|
|
|
1271
1272
|
}
|
|
1272
1273
|
function runActorDbTests(driverTestConfig) {
|
|
1273
1274
|
const variants = ["raw", "drizzle"];
|
|
1275
|
+
const dbTestTimeout = driverTestConfig.useRealTimers ? REAL_TIMER_DB_TIMEOUT_MS : void 0;
|
|
1276
|
+
const lifecycleTestTimeout = driverTestConfig.useRealTimers ? REAL_TIMER_DB_TIMEOUT_MS : void 0;
|
|
1274
1277
|
for (const variant of variants) {
|
|
1275
1278
|
_vitest.describe.call(void 0, `Actor Database (${variant}) Tests`, () => {
|
|
1276
|
-
_vitest.test.call(void 0,
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1279
|
+
_vitest.test.call(void 0,
|
|
1280
|
+
"bootstraps schema on startup",
|
|
1281
|
+
async (c) => {
|
|
1282
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1283
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1284
|
+
`db-${variant}-bootstrap-${crypto.randomUUID()}`
|
|
1285
|
+
]);
|
|
1286
|
+
const count = await actor.getCount();
|
|
1287
|
+
_vitest.expect.call(void 0, count).toBe(0);
|
|
1288
|
+
},
|
|
1289
|
+
dbTestTimeout
|
|
1290
|
+
);
|
|
1291
|
+
_vitest.test.call(void 0,
|
|
1292
|
+
"supports CRUD, raw SQL, and multi-statement exec",
|
|
1293
|
+
async (c) => {
|
|
1294
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1295
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1296
|
+
`db-${variant}-crud-${crypto.randomUUID()}`
|
|
1297
|
+
]);
|
|
1298
|
+
await actor.reset();
|
|
1299
|
+
const first = await actor.insertValue("alpha");
|
|
1300
|
+
const second = await actor.insertValue("beta");
|
|
1301
|
+
const values = await actor.getValues();
|
|
1302
|
+
_vitest.expect.call(void 0, values.length).toBeGreaterThanOrEqual(2);
|
|
1303
|
+
_vitest.expect.call(void 0, values.some((row) => row.value === "alpha")).toBeTruthy();
|
|
1304
|
+
_vitest.expect.call(void 0, values.some((row) => row.value === "beta")).toBeTruthy();
|
|
1305
|
+
await actor.updateValue(first.id, "alpha-updated");
|
|
1306
|
+
const updated = await actor.getValue(first.id);
|
|
1307
|
+
_vitest.expect.call(void 0, updated).toBe("alpha-updated");
|
|
1308
|
+
await actor.deleteValue(second.id);
|
|
1309
|
+
const count = await actor.getCount();
|
|
1310
|
+
if (driverTestConfig.useRealTimers) {
|
|
1311
|
+
_vitest.expect.call(void 0, count).toBeGreaterThanOrEqual(1);
|
|
1312
|
+
} else {
|
|
1313
|
+
_vitest.expect.call(void 0, count).toBe(1);
|
|
1314
|
+
}
|
|
1315
|
+
const rawCount = await actor.rawSelectCount();
|
|
1316
|
+
if (driverTestConfig.useRealTimers) {
|
|
1317
|
+
_vitest.expect.call(void 0, rawCount).toBeGreaterThanOrEqual(1);
|
|
1318
|
+
} else {
|
|
1319
|
+
_vitest.expect.call(void 0, rawCount).toBe(1);
|
|
1320
|
+
}
|
|
1321
|
+
const multiValue = await actor.multiStatementInsert("gamma");
|
|
1322
|
+
_vitest.expect.call(void 0, multiValue).toBe("gamma-updated");
|
|
1323
|
+
},
|
|
1324
|
+
dbTestTimeout
|
|
1325
|
+
);
|
|
1326
|
+
_vitest.test.call(void 0,
|
|
1327
|
+
"handles transactions",
|
|
1328
|
+
async (c) => {
|
|
1329
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1330
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1331
|
+
`db-${variant}-tx-${crypto.randomUUID()}`
|
|
1332
|
+
]);
|
|
1333
|
+
await actor.reset();
|
|
1334
|
+
await actor.transactionCommit("commit");
|
|
1329
1335
|
_vitest.expect.call(void 0, await actor.getCount()).toBe(1);
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1336
|
+
await actor.transactionRollback("rollback");
|
|
1337
|
+
_vitest.expect.call(void 0, await actor.getCount()).toBe(1);
|
|
1338
|
+
},
|
|
1339
|
+
dbTestTimeout
|
|
1340
|
+
);
|
|
1341
|
+
_vitest.test.call(void 0,
|
|
1342
|
+
"persists across sleep and wake cycles",
|
|
1343
|
+
async (c) => {
|
|
1344
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1345
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1346
|
+
`db-${variant}-sleep-${crypto.randomUUID()}`
|
|
1347
|
+
]);
|
|
1348
|
+
await actor.reset();
|
|
1349
|
+
await actor.insertValue("sleepy");
|
|
1350
|
+
const baselineCount = await actor.getCount();
|
|
1351
|
+
_vitest.expect.call(void 0, baselineCount).toBeGreaterThan(0);
|
|
1352
|
+
for (let i = 0; i < 3; i++) {
|
|
1353
|
+
await actor.triggerSleep();
|
|
1354
|
+
await waitFor(driverTestConfig, SLEEP_WAIT_MS);
|
|
1355
|
+
_vitest.expect.call(void 0, await actor.getCount()).toBe(baselineCount);
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
dbTestTimeout
|
|
1359
|
+
);
|
|
1360
|
+
_vitest.test.call(void 0,
|
|
1361
|
+
"completes onDisconnect DB writes before sleeping",
|
|
1362
|
+
async (c) => {
|
|
1363
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1364
|
+
const key = `db-${variant}-disconnect-${crypto.randomUUID()}`;
|
|
1365
|
+
const actor = getDbActor(client, variant).getOrCreate([key]);
|
|
1366
|
+
await actor.reset();
|
|
1367
|
+
await actor.configureDisconnectInsert(true, 250);
|
|
1368
|
+
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 250);
|
|
1369
|
+
await actor.configureDisconnectInsert(false, 0);
|
|
1370
|
+
_vitest.expect.call(void 0, await actor.getDisconnectInsertCount()).toBe(1);
|
|
1371
|
+
},
|
|
1372
|
+
dbTestTimeout
|
|
1373
|
+
);
|
|
1374
|
+
_vitest.test.call(void 0,
|
|
1375
|
+
"handles high-volume inserts",
|
|
1376
|
+
async (c) => {
|
|
1377
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1378
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1379
|
+
`db-${variant}-high-volume-${crypto.randomUUID()}`
|
|
1380
|
+
]);
|
|
1381
|
+
await actor.reset();
|
|
1382
|
+
await actor.insertMany(HIGH_VOLUME_COUNT);
|
|
1383
|
+
const count = await actor.getCount();
|
|
1384
|
+
if (driverTestConfig.useRealTimers) {
|
|
1385
|
+
_vitest.expect.call(void 0, count).toBeGreaterThanOrEqual(HIGH_VOLUME_COUNT);
|
|
1386
|
+
} else {
|
|
1387
|
+
_vitest.expect.call(void 0, count).toBe(HIGH_VOLUME_COUNT);
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
dbTestTimeout
|
|
1391
|
+
);
|
|
1392
|
+
_vitest.test.call(void 0,
|
|
1393
|
+
"handles payloads across chunk boundaries",
|
|
1394
|
+
async (c) => {
|
|
1395
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1396
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1397
|
+
`db-${variant}-chunk-${crypto.randomUUID()}`
|
|
1398
|
+
]);
|
|
1399
|
+
await actor.reset();
|
|
1400
|
+
for (const size of CHUNK_BOUNDARY_SIZES) {
|
|
1401
|
+
const { id } = await actor.insertPayloadOfSize(size);
|
|
1402
|
+
const storedSize = await actor.getPayloadSize(id);
|
|
1403
|
+
_vitest.expect.call(void 0, storedSize).toBe(size);
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
dbTestTimeout
|
|
1407
|
+
);
|
|
1408
|
+
_vitest.test.call(void 0,
|
|
1409
|
+
"handles large payloads",
|
|
1410
|
+
async (c) => {
|
|
1411
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1412
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1413
|
+
`db-${variant}-large-${crypto.randomUUID()}`
|
|
1414
|
+
]);
|
|
1415
|
+
await actor.reset();
|
|
1416
|
+
const { id } = await actor.insertPayloadOfSize(LARGE_PAYLOAD_SIZE);
|
|
1417
|
+
const storedSize = await actor.getPayloadSize(id);
|
|
1418
|
+
_vitest.expect.call(void 0, storedSize).toBe(LARGE_PAYLOAD_SIZE);
|
|
1419
|
+
},
|
|
1420
|
+
dbTestTimeout
|
|
1421
|
+
);
|
|
1422
|
+
_vitest.test.call(void 0,
|
|
1423
|
+
"supports shrink and regrow workloads with vacuum",
|
|
1424
|
+
async (c) => {
|
|
1425
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1426
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1427
|
+
`db-${variant}-shrink-regrow-${crypto.randomUUID()}`
|
|
1428
|
+
]);
|
|
1429
|
+
await actor.reset();
|
|
1430
|
+
await actor.vacuum();
|
|
1431
|
+
const baselinePages = await actor.getPageCount();
|
|
1432
|
+
await actor.insertPayloadRows(
|
|
1433
|
+
SHRINK_GROW_INITIAL_ROWS,
|
|
1434
|
+
SHRINK_GROW_INITIAL_PAYLOAD
|
|
1435
|
+
);
|
|
1436
|
+
const grownPages = await actor.getPageCount();
|
|
1437
|
+
await actor.reset();
|
|
1438
|
+
await actor.vacuum();
|
|
1439
|
+
const shrunkPages = await actor.getPageCount();
|
|
1440
|
+
await actor.insertPayloadRows(
|
|
1441
|
+
SHRINK_GROW_REGROW_ROWS,
|
|
1442
|
+
SHRINK_GROW_REGROW_PAYLOAD
|
|
1443
|
+
);
|
|
1444
|
+
const regrownPages = await actor.getPageCount();
|
|
1445
|
+
_vitest.expect.call(void 0, grownPages).toBeGreaterThanOrEqual(baselinePages);
|
|
1446
|
+
_vitest.expect.call(void 0, shrunkPages).toBeLessThanOrEqual(grownPages);
|
|
1447
|
+
_vitest.expect.call(void 0, regrownPages).toBeGreaterThan(shrunkPages);
|
|
1448
|
+
},
|
|
1449
|
+
dbTestTimeout
|
|
1450
|
+
);
|
|
1451
|
+
_vitest.test.call(void 0,
|
|
1452
|
+
"handles repeated updates to the same row",
|
|
1453
|
+
async (c) => {
|
|
1454
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1455
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1456
|
+
`db-${variant}-updates-${crypto.randomUUID()}`
|
|
1457
|
+
]);
|
|
1458
|
+
await actor.reset();
|
|
1459
|
+
const { id } = await actor.insertValue("base");
|
|
1460
|
+
const result = await actor.repeatUpdate(id, 50);
|
|
1461
|
+
_vitest.expect.call(void 0, result.value).toBe("Updated 49");
|
|
1462
|
+
const value = await actor.getValue(id);
|
|
1463
|
+
_vitest.expect.call(void 0, value).toBe("Updated 49");
|
|
1464
|
+
const hotRowIds = [];
|
|
1465
|
+
for (let i = 0; i < HOT_ROW_COUNT; i++) {
|
|
1466
|
+
const row = await actor.insertValue(`init-${i}`);
|
|
1467
|
+
hotRowIds.push(row.id);
|
|
1468
|
+
}
|
|
1469
|
+
const updatedRows = await actor.roundRobinUpdateValues(
|
|
1470
|
+
hotRowIds,
|
|
1471
|
+
HOT_ROW_UPDATES
|
|
1472
|
+
);
|
|
1473
|
+
_vitest.expect.call(void 0, updatedRows).toHaveLength(HOT_ROW_COUNT);
|
|
1474
|
+
for (const row of updatedRows) {
|
|
1475
|
+
_vitest.expect.call(void 0, row.value).toMatch(/^v-\d+$/);
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
dbTestTimeout
|
|
1479
|
+
);
|
|
1480
|
+
_vitest.test.call(void 0,
|
|
1481
|
+
"passes integrity checks after mixed workload and sleep",
|
|
1482
|
+
async (c) => {
|
|
1483
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1484
|
+
const actor = getDbActor(client, variant).getOrCreate([
|
|
1485
|
+
`db-${variant}-integrity-${crypto.randomUUID()}`
|
|
1486
|
+
]);
|
|
1487
|
+
await actor.reset();
|
|
1488
|
+
await actor.runMixedWorkload(
|
|
1489
|
+
INTEGRITY_SEED_COUNT,
|
|
1490
|
+
INTEGRITY_CHURN_COUNT
|
|
1491
|
+
);
|
|
1492
|
+
_vitest.expect.call(void 0, (await actor.integrityCheck()).toLowerCase()).toBe("ok");
|
|
1493
|
+
await actor.triggerSleep();
|
|
1494
|
+
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1495
|
+
_vitest.expect.call(void 0, (await actor.integrityCheck()).toLowerCase()).toBe("ok");
|
|
1496
|
+
},
|
|
1497
|
+
dbTestTimeout
|
|
1498
|
+
);
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
_vitest.describe.call(void 0, "Actor Database Lifecycle Cleanup Tests", () => {
|
|
1502
|
+
_vitest.test.call(void 0,
|
|
1503
|
+
"runs db provider cleanup on sleep",
|
|
1504
|
+
async (c) => {
|
|
1343
1505
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1506
|
+
const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
|
|
1507
|
+
const lifecycle = client.dbLifecycle.getOrCreate([
|
|
1508
|
+
`db-lifecycle-sleep-${crypto.randomUUID()}`
|
|
1346
1509
|
]);
|
|
1347
|
-
await
|
|
1348
|
-
await
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1510
|
+
const actorId = await lifecycle.getActorId();
|
|
1511
|
+
const before = await observer.getCounts(actorId);
|
|
1512
|
+
await lifecycle.insertValue("before-sleep");
|
|
1513
|
+
await lifecycle.triggerSleep();
|
|
1514
|
+
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1515
|
+
await lifecycle.ping();
|
|
1516
|
+
let after = before;
|
|
1517
|
+
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1518
|
+
after = await observer.getCounts(actorId);
|
|
1519
|
+
if (after.cleanup >= before.cleanup + 1) {
|
|
1520
|
+
break;
|
|
1521
|
+
}
|
|
1522
|
+
await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
|
|
1523
|
+
}
|
|
1524
|
+
_vitest.expect.call(void 0, after.create).toBeGreaterThanOrEqual(before.create);
|
|
1525
|
+
_vitest.expect.call(void 0, after.migrate).toBeGreaterThanOrEqual(before.migrate);
|
|
1526
|
+
_vitest.expect.call(void 0, after.cleanup).toBeGreaterThanOrEqual(before.cleanup + 1);
|
|
1527
|
+
},
|
|
1528
|
+
lifecycleTestTimeout
|
|
1529
|
+
);
|
|
1530
|
+
_vitest.test.call(void 0,
|
|
1531
|
+
"runs db provider cleanup on destroy",
|
|
1532
|
+
async (c) => {
|
|
1352
1533
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1534
|
+
const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
|
|
1535
|
+
const lifecycle = client.dbLifecycle.getOrCreate([
|
|
1536
|
+
`db-lifecycle-destroy-${crypto.randomUUID()}`
|
|
1355
1537
|
]);
|
|
1356
|
-
await
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1538
|
+
const actorId = await lifecycle.getActorId();
|
|
1539
|
+
const before = await observer.getCounts(actorId);
|
|
1540
|
+
await lifecycle.insertValue("before-destroy");
|
|
1541
|
+
await lifecycle.triggerDestroy();
|
|
1542
|
+
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1543
|
+
let cleanupCount = before.cleanup;
|
|
1544
|
+
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1545
|
+
const counts = await observer.getCounts(actorId);
|
|
1546
|
+
cleanupCount = counts.cleanup;
|
|
1547
|
+
if (cleanupCount >= before.cleanup + 1) {
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
|
|
1361
1551
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1552
|
+
_vitest.expect.call(void 0, cleanupCount).toBeGreaterThanOrEqual(before.cleanup + 1);
|
|
1553
|
+
},
|
|
1554
|
+
lifecycleTestTimeout
|
|
1555
|
+
);
|
|
1556
|
+
_vitest.test.call(void 0,
|
|
1557
|
+
"runs db provider cleanup when migration fails",
|
|
1558
|
+
async (c) => {
|
|
1364
1559
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1560
|
+
const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
|
|
1561
|
+
const beforeTotalCleanup = await observer.getTotalCleanupCount();
|
|
1562
|
+
const key = `db-lifecycle-migrate-failure-${crypto.randomUUID()}`;
|
|
1563
|
+
const lifecycle = client.dbLifecycleFailing.getOrCreate([key]);
|
|
1564
|
+
let threw = false;
|
|
1565
|
+
try {
|
|
1566
|
+
await lifecycle.ping();
|
|
1567
|
+
} catch (e3) {
|
|
1568
|
+
threw = true;
|
|
1569
|
+
}
|
|
1570
|
+
_vitest.expect.call(void 0, threw).toBeTruthy();
|
|
1571
|
+
let cleanupCount = beforeTotalCleanup;
|
|
1572
|
+
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1573
|
+
cleanupCount = await observer.getTotalCleanupCount();
|
|
1574
|
+
if (cleanupCount >= beforeTotalCleanup + 1) {
|
|
1575
|
+
break;
|
|
1576
|
+
}
|
|
1577
|
+
await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
|
|
1578
|
+
}
|
|
1579
|
+
_vitest.expect.call(void 0, cleanupCount).toBeGreaterThanOrEqual(beforeTotalCleanup + 1);
|
|
1580
|
+
},
|
|
1581
|
+
lifecycleTestTimeout
|
|
1582
|
+
);
|
|
1583
|
+
_vitest.test.call(void 0,
|
|
1584
|
+
"handles parallel actor lifecycle churn",
|
|
1585
|
+
async (c) => {
|
|
1374
1586
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
await actor.insertPayloadRows(
|
|
1382
|
-
SHRINK_GROW_INITIAL_ROWS,
|
|
1383
|
-
SHRINK_GROW_INITIAL_PAYLOAD
|
|
1587
|
+
const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
|
|
1588
|
+
const actorHandles = Array.from(
|
|
1589
|
+
{ length: 12 },
|
|
1590
|
+
(_, i) => client.dbLifecycle.getOrCreate([
|
|
1591
|
+
`db-lifecycle-stress-${i}-${crypto.randomUUID()}`
|
|
1592
|
+
])
|
|
1384
1593
|
);
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
await actor.vacuum();
|
|
1388
|
-
const shrunkPages = await actor.getPageCount();
|
|
1389
|
-
await actor.insertPayloadRows(
|
|
1390
|
-
SHRINK_GROW_REGROW_ROWS,
|
|
1391
|
-
SHRINK_GROW_REGROW_PAYLOAD
|
|
1594
|
+
const actorIds = await Promise.all(
|
|
1595
|
+
actorHandles.map((handle) => handle.getActorId())
|
|
1392
1596
|
);
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
_vitest.expect.call(void 0, shrunkPages).toBeLessThanOrEqual(grownPages);
|
|
1396
|
-
_vitest.expect.call(void 0, regrownPages).toBeGreaterThan(shrunkPages);
|
|
1397
|
-
});
|
|
1398
|
-
_vitest.test.call(void 0, "handles repeated updates to the same row", async (c) => {
|
|
1399
|
-
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1400
|
-
const actor = getDbActor(client, variant).getOrCreate([
|
|
1401
|
-
`db-${variant}-updates-${crypto.randomUUID()}`
|
|
1402
|
-
]);
|
|
1403
|
-
await actor.reset();
|
|
1404
|
-
const { id } = await actor.insertValue("base");
|
|
1405
|
-
const result = await actor.repeatUpdate(id, 50);
|
|
1406
|
-
_vitest.expect.call(void 0, result.value).toBe("Updated 49");
|
|
1407
|
-
const value = await actor.getValue(id);
|
|
1408
|
-
_vitest.expect.call(void 0, value).toBe("Updated 49");
|
|
1409
|
-
const hotRowIds = [];
|
|
1410
|
-
for (let i = 0; i < HOT_ROW_COUNT; i++) {
|
|
1411
|
-
const row = await actor.insertValue(`init-${i}`);
|
|
1412
|
-
hotRowIds.push(row.id);
|
|
1413
|
-
}
|
|
1414
|
-
const updatedRows = await actor.roundRobinUpdateValues(
|
|
1415
|
-
hotRowIds,
|
|
1416
|
-
HOT_ROW_UPDATES
|
|
1597
|
+
await Promise.all(
|
|
1598
|
+
actorHandles.map((handle, i) => handle.insertValue(`phase-1-${i}`))
|
|
1417
1599
|
);
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
});
|
|
1423
|
-
_vitest.test.call(void 0, "passes integrity checks after mixed workload and sleep", async (c) => {
|
|
1424
|
-
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1425
|
-
const actor = getDbActor(client, variant).getOrCreate([
|
|
1426
|
-
`db-${variant}-integrity-${crypto.randomUUID()}`
|
|
1427
|
-
]);
|
|
1428
|
-
await actor.reset();
|
|
1429
|
-
await actor.runMixedWorkload(
|
|
1430
|
-
INTEGRITY_SEED_COUNT,
|
|
1431
|
-
INTEGRITY_CHURN_COUNT
|
|
1600
|
+
await Promise.all(actorHandles.map((handle) => handle.triggerSleep()));
|
|
1601
|
+
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1602
|
+
await Promise.all(
|
|
1603
|
+
actorHandles.map((handle, i) => handle.insertValue(`phase-2-${i}`))
|
|
1432
1604
|
);
|
|
1433
|
-
|
|
1434
|
-
|
|
1605
|
+
const survivors = actorHandles.slice(0, 6);
|
|
1606
|
+
const destroyed = actorHandles.slice(6);
|
|
1607
|
+
await Promise.all(destroyed.map((handle) => handle.triggerDestroy()));
|
|
1608
|
+
await Promise.all(survivors.map((handle) => handle.triggerSleep()));
|
|
1435
1609
|
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
]);
|
|
1447
|
-
const actorId = await lifecycle.getActorId();
|
|
1448
|
-
const before = await observer.getCounts(actorId);
|
|
1449
|
-
await lifecycle.insertValue("before-sleep");
|
|
1450
|
-
await lifecycle.triggerSleep();
|
|
1451
|
-
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1452
|
-
await lifecycle.ping();
|
|
1453
|
-
let after = before;
|
|
1454
|
-
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1455
|
-
after = await observer.getCounts(actorId);
|
|
1456
|
-
if (after.cleanup >= before.cleanup + 1) {
|
|
1457
|
-
break;
|
|
1458
|
-
}
|
|
1459
|
-
await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
|
|
1460
|
-
}
|
|
1461
|
-
_vitest.expect.call(void 0, after.create).toBeGreaterThanOrEqual(before.create);
|
|
1462
|
-
_vitest.expect.call(void 0, after.migrate).toBeGreaterThanOrEqual(before.migrate);
|
|
1463
|
-
_vitest.expect.call(void 0, after.cleanup).toBeGreaterThanOrEqual(before.cleanup + 1);
|
|
1464
|
-
});
|
|
1465
|
-
_vitest.test.call(void 0, "runs db provider cleanup on destroy", async (c) => {
|
|
1466
|
-
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1467
|
-
const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
|
|
1468
|
-
const lifecycle = client.dbLifecycle.getOrCreate([
|
|
1469
|
-
`db-lifecycle-destroy-${crypto.randomUUID()}`
|
|
1470
|
-
]);
|
|
1471
|
-
const actorId = await lifecycle.getActorId();
|
|
1472
|
-
const before = await observer.getCounts(actorId);
|
|
1473
|
-
await lifecycle.insertValue("before-destroy");
|
|
1474
|
-
await lifecycle.triggerDestroy();
|
|
1475
|
-
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1476
|
-
let cleanupCount = before.cleanup;
|
|
1477
|
-
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1478
|
-
const counts = await observer.getCounts(actorId);
|
|
1479
|
-
cleanupCount = counts.cleanup;
|
|
1480
|
-
if (cleanupCount >= before.cleanup + 1) {
|
|
1481
|
-
break;
|
|
1482
|
-
}
|
|
1483
|
-
await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
|
|
1484
|
-
}
|
|
1485
|
-
_vitest.expect.call(void 0, cleanupCount).toBeGreaterThanOrEqual(before.cleanup + 1);
|
|
1486
|
-
});
|
|
1487
|
-
_vitest.test.call(void 0, "runs db provider cleanup when migration fails", async (c) => {
|
|
1488
|
-
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1489
|
-
const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
|
|
1490
|
-
const key = `db-lifecycle-migrate-failure-${crypto.randomUUID()}`;
|
|
1491
|
-
const lifecycle = client.dbLifecycleFailing.getOrCreate([key]);
|
|
1492
|
-
let threw = false;
|
|
1493
|
-
try {
|
|
1494
|
-
await lifecycle.ping();
|
|
1495
|
-
} catch (e3) {
|
|
1496
|
-
threw = true;
|
|
1497
|
-
}
|
|
1498
|
-
_vitest.expect.call(void 0, threw).toBeTruthy();
|
|
1499
|
-
const actorId = await client.dbLifecycleFailing.get([key]).resolve();
|
|
1500
|
-
let cleanupCount = 0;
|
|
1501
|
-
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1502
|
-
const counts = await observer.getCounts(actorId);
|
|
1503
|
-
cleanupCount = counts.cleanup;
|
|
1504
|
-
if (cleanupCount >= 1) {
|
|
1505
|
-
break;
|
|
1610
|
+
await Promise.all(survivors.map((handle) => handle.ping()));
|
|
1611
|
+
const survivorCounts = await Promise.all(
|
|
1612
|
+
survivors.map((handle) => handle.getCount())
|
|
1613
|
+
);
|
|
1614
|
+
for (const count of survivorCounts) {
|
|
1615
|
+
if (driverTestConfig.useRealTimers) {
|
|
1616
|
+
_vitest.expect.call(void 0, count).toBeGreaterThanOrEqual(2);
|
|
1617
|
+
} else {
|
|
1618
|
+
_vitest.expect.call(void 0, count).toBe(2);
|
|
1619
|
+
}
|
|
1506
1620
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
);
|
|
1520
|
-
const actorIds = await Promise.all(
|
|
1521
|
-
actorHandles.map((handle) => handle.getActorId())
|
|
1522
|
-
);
|
|
1523
|
-
await Promise.all(
|
|
1524
|
-
actorHandles.map((handle, i) => handle.insertValue(`phase-1-${i}`))
|
|
1525
|
-
);
|
|
1526
|
-
await Promise.all(actorHandles.map((handle) => handle.triggerSleep()));
|
|
1527
|
-
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1528
|
-
await Promise.all(
|
|
1529
|
-
actorHandles.map((handle, i) => handle.insertValue(`phase-2-${i}`))
|
|
1530
|
-
);
|
|
1531
|
-
const survivors = actorHandles.slice(0, 6);
|
|
1532
|
-
const destroyed = actorHandles.slice(6);
|
|
1533
|
-
await Promise.all(destroyed.map((handle) => handle.triggerDestroy()));
|
|
1534
|
-
await Promise.all(survivors.map((handle) => handle.triggerSleep()));
|
|
1535
|
-
await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
|
|
1536
|
-
await Promise.all(survivors.map((handle) => handle.ping()));
|
|
1537
|
-
const survivorCounts = await Promise.all(
|
|
1538
|
-
survivors.map((handle) => handle.getCount())
|
|
1539
|
-
);
|
|
1540
|
-
for (const count of survivorCounts) {
|
|
1541
|
-
_vitest.expect.call(void 0, count).toBe(2);
|
|
1542
|
-
}
|
|
1543
|
-
const lifecycleCleanup = /* @__PURE__ */ new Map();
|
|
1544
|
-
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1545
|
-
let allCleaned = true;
|
|
1546
|
-
for (const actorId of actorIds) {
|
|
1547
|
-
const counts = await observer.getCounts(actorId);
|
|
1548
|
-
lifecycleCleanup.set(actorId, counts.cleanup);
|
|
1549
|
-
if (counts.cleanup < 1) {
|
|
1550
|
-
allCleaned = false;
|
|
1621
|
+
const lifecycleCleanup = /* @__PURE__ */ new Map();
|
|
1622
|
+
for (let i = 0; i < LIFECYCLE_POLL_ATTEMPTS; i++) {
|
|
1623
|
+
let allCleaned = true;
|
|
1624
|
+
for (const actorId of actorIds) {
|
|
1625
|
+
const counts = await observer.getCounts(actorId);
|
|
1626
|
+
lifecycleCleanup.set(actorId, counts.cleanup);
|
|
1627
|
+
if (counts.cleanup < 1) {
|
|
1628
|
+
allCleaned = false;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
if (allCleaned) {
|
|
1632
|
+
break;
|
|
1551
1633
|
}
|
|
1634
|
+
await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
|
|
1552
1635
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1636
|
+
for (const actorId of actorIds) {
|
|
1637
|
+
_vitest.expect.call(void 0, _nullishCoalesce(lifecycleCleanup.get(actorId), () => ( 0))).toBeGreaterThanOrEqual(1);
|
|
1555
1638
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
_vitest.expect.call(void 0, _nullishCoalesce(lifecycleCleanup.get(actorId), () => ( 0))).toBeGreaterThanOrEqual(1);
|
|
1560
|
-
}
|
|
1561
|
-
});
|
|
1639
|
+
},
|
|
1640
|
+
lifecycleTestTimeout
|
|
1641
|
+
);
|
|
1562
1642
|
});
|
|
1563
1643
|
}
|
|
1564
1644
|
|
|
@@ -1844,7 +1924,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1844
1924
|
}
|
|
1845
1925
|
await sleepActor.triggerSleep();
|
|
1846
1926
|
await sleepActor.dispose();
|
|
1847
|
-
await waitFor(driverTestConfig,
|
|
1927
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1848
1928
|
const sleepActor2 = client.sleep.getOrCreate();
|
|
1849
1929
|
{
|
|
1850
1930
|
const { startCount, sleepCount } = await sleepActor2.getCounts();
|
|
@@ -1860,7 +1940,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1860
1940
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1861
1941
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1862
1942
|
}
|
|
1863
|
-
await waitFor(driverTestConfig,
|
|
1943
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1864
1944
|
{
|
|
1865
1945
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1866
1946
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1876,7 +1956,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1876
1956
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1877
1957
|
}
|
|
1878
1958
|
await sleepActor.dispose();
|
|
1879
|
-
await waitFor(driverTestConfig,
|
|
1959
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1880
1960
|
const sleepActor2 = client.sleep.getOrCreate();
|
|
1881
1961
|
{
|
|
1882
1962
|
const { startCount, sleepCount } = await sleepActor2.getCounts();
|
|
@@ -1892,19 +1972,19 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1892
1972
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1893
1973
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1894
1974
|
}
|
|
1895
|
-
await waitFor(driverTestConfig,
|
|
1975
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT - 250);
|
|
1896
1976
|
{
|
|
1897
1977
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1898
1978
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1899
1979
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1900
1980
|
}
|
|
1901
|
-
await waitFor(driverTestConfig,
|
|
1981
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT - 250);
|
|
1902
1982
|
{
|
|
1903
1983
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1904
1984
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1905
1985
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1906
1986
|
}
|
|
1907
|
-
await waitFor(driverTestConfig,
|
|
1987
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1908
1988
|
{
|
|
1909
1989
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1910
1990
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1919,8 +1999,8 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1919
1999
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1920
2000
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1921
2001
|
}
|
|
1922
|
-
await sleepActor.setAlarm(
|
|
1923
|
-
await waitFor(driverTestConfig,
|
|
2002
|
+
await sleepActor.setAlarm(_chunkIJAGZS57cjs.SLEEP_TIMEOUT - 250);
|
|
2003
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1924
2004
|
{
|
|
1925
2005
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1926
2006
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
@@ -1935,8 +2015,8 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1935
2015
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1936
2016
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1937
2017
|
}
|
|
1938
|
-
await sleepActor.setAlarm(
|
|
1939
|
-
await waitFor(driverTestConfig,
|
|
2018
|
+
await sleepActor.setAlarm(_chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
2019
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 200);
|
|
1940
2020
|
{
|
|
1941
2021
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1942
2022
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1956,7 +2036,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1956
2036
|
);
|
|
1957
2037
|
const longRunningPromise = sleepActor.longRunningRpc();
|
|
1958
2038
|
await waitPromise;
|
|
1959
|
-
await waitFor(driverTestConfig,
|
|
2039
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1960
2040
|
await sleepActor.finishLongRunningRpc();
|
|
1961
2041
|
await longRunningPromise;
|
|
1962
2042
|
{
|
|
@@ -1965,7 +2045,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1965
2045
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1966
2046
|
}
|
|
1967
2047
|
await sleepActor.dispose();
|
|
1968
|
-
await waitFor(driverTestConfig,
|
|
2048
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
1969
2049
|
const sleepActor2 = client.sleepWithLongRpc.getOrCreate();
|
|
1970
2050
|
{
|
|
1971
2051
|
const { startCount, sleepCount } = await sleepActor2.getCounts();
|
|
@@ -1997,7 +2077,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1997
2077
|
}
|
|
1998
2078
|
};
|
|
1999
2079
|
});
|
|
2000
|
-
await waitFor(driverTestConfig,
|
|
2080
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
2001
2081
|
ws.send(JSON.stringify({ type: "getCounts" }));
|
|
2002
2082
|
const counts = await new Promise((resolve) => {
|
|
2003
2083
|
ws.onmessage = (event) => {
|
|
@@ -2010,7 +2090,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
2010
2090
|
_vitest.expect.call(void 0, counts.sleepCount).toBe(0);
|
|
2011
2091
|
_vitest.expect.call(void 0, counts.startCount).toBe(1);
|
|
2012
2092
|
ws.close();
|
|
2013
|
-
await waitFor(driverTestConfig,
|
|
2093
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
2014
2094
|
{
|
|
2015
2095
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
2016
2096
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -2028,7 +2108,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
2028
2108
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
2029
2109
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
2030
2110
|
}
|
|
2031
|
-
const fetchDuration =
|
|
2111
|
+
const fetchDuration = _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250;
|
|
2032
2112
|
const fetchPromise = sleepActor.fetch(
|
|
2033
2113
|
`long-request?duration=${fetchDuration}`
|
|
2034
2114
|
);
|
|
@@ -2041,7 +2121,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
2041
2121
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
2042
2122
|
_vitest.expect.call(void 0, requestCount).toBe(1);
|
|
2043
2123
|
}
|
|
2044
|
-
await waitFor(driverTestConfig,
|
|
2124
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
2045
2125
|
{
|
|
2046
2126
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
2047
2127
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -2056,13 +2136,13 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
2056
2136
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
2057
2137
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
2058
2138
|
}
|
|
2059
|
-
await waitFor(driverTestConfig,
|
|
2139
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
2060
2140
|
{
|
|
2061
2141
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
2062
2142
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
2063
2143
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
2064
2144
|
}
|
|
2065
|
-
await waitFor(driverTestConfig,
|
|
2145
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.SLEEP_TIMEOUT + 250);
|
|
2066
2146
|
{
|
|
2067
2147
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
2068
2148
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
@@ -3042,11 +3122,12 @@ function runActorQueueTests(driverTestConfig) {
|
|
|
3042
3122
|
_vitest.test.call(void 0, "wait send returns completion response", async (c) => {
|
|
3043
3123
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
3044
3124
|
const handle = client.queueActor.getOrCreate(["wait-complete"]);
|
|
3125
|
+
const waitTimeout = driverTestConfig.useRealTimers ? 5e3 : 1e3;
|
|
3045
3126
|
const actionPromise = handle.receiveAndComplete("tasks");
|
|
3046
3127
|
const result = await handle.send(
|
|
3047
3128
|
"tasks",
|
|
3048
3129
|
{ value: 123 },
|
|
3049
|
-
{ wait: true, timeout:
|
|
3130
|
+
{ wait: true, timeout: waitTimeout }
|
|
3050
3131
|
);
|
|
3051
3132
|
await actionPromise;
|
|
3052
3133
|
_vitest.expect.call(void 0, result).toEqual({
|
|
@@ -3189,7 +3270,7 @@ function runActorRunTests(driverTestConfig) {
|
|
|
3189
3270
|
const state1 = await actor.getState();
|
|
3190
3271
|
_vitest.expect.call(void 0, state1.runStarted).toBe(true);
|
|
3191
3272
|
const tickCount1 = state1.tickCount;
|
|
3192
|
-
await waitFor(driverTestConfig,
|
|
3273
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.RUN_SLEEP_TIMEOUT + 300);
|
|
3193
3274
|
const state2 = await actor.getState();
|
|
3194
3275
|
_vitest.expect.call(void 0, state2.runStarted).toBe(true);
|
|
3195
3276
|
_vitest.expect.call(void 0, state2.runExited).toBe(false);
|
|
@@ -3202,7 +3283,7 @@ function runActorRunTests(driverTestConfig) {
|
|
|
3202
3283
|
]);
|
|
3203
3284
|
const state = await actor.getState();
|
|
3204
3285
|
_vitest.expect.call(void 0, state.wakeCount).toBe(1);
|
|
3205
|
-
await waitFor(driverTestConfig,
|
|
3286
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.RUN_SLEEP_TIMEOUT + 300);
|
|
3206
3287
|
const state2 = await actor.getState();
|
|
3207
3288
|
_vitest.expect.call(void 0, state2.wakeCount).toBe(2);
|
|
3208
3289
|
});
|
|
@@ -3240,7 +3321,7 @@ function runActorRunTests(driverTestConfig) {
|
|
|
3240
3321
|
await waitFor(driverTestConfig, 100);
|
|
3241
3322
|
const state1 = await actor.getState();
|
|
3242
3323
|
_vitest.expect.call(void 0, state1.runStarted).toBe(true);
|
|
3243
|
-
await waitFor(driverTestConfig,
|
|
3324
|
+
await waitFor(driverTestConfig, _chunkIJAGZS57cjs.RUN_SLEEP_TIMEOUT + 500);
|
|
3244
3325
|
const state2 = await actor.getState();
|
|
3245
3326
|
_vitest.expect.call(void 0, state2.wakeCount).toBeGreaterThan(state1.wakeCount);
|
|
3246
3327
|
});
|
|
@@ -3396,8 +3477,14 @@ function runActorWorkflowTests(driverTestConfig) {
|
|
|
3396
3477
|
const actor = client.workflowCounterActor.getOrCreate([
|
|
3397
3478
|
"workflow-basic"
|
|
3398
3479
|
]);
|
|
3399
|
-
await
|
|
3400
|
-
|
|
3480
|
+
let state = await actor.getState();
|
|
3481
|
+
for (let i = 0; i < 50; i++) {
|
|
3482
|
+
if (state.runCount > 0 && state.history.length > 0 && state.guardTriggered) {
|
|
3483
|
+
break;
|
|
3484
|
+
}
|
|
3485
|
+
await waitFor(driverTestConfig, 100);
|
|
3486
|
+
state = await actor.getState();
|
|
3487
|
+
}
|
|
3401
3488
|
_vitest.expect.call(void 0, state.runCount).toBeGreaterThan(0);
|
|
3402
3489
|
_vitest.expect.call(void 0, state.history.length).toBeGreaterThan(0);
|
|
3403
3490
|
_vitest.expect.call(void 0, state.guardTriggered).toBe(true);
|
|
@@ -3405,7 +3492,7 @@ function runActorWorkflowTests(driverTestConfig) {
|
|
|
3405
3492
|
_vitest.test.call(void 0, "consumes queue messages via workflow queue.next", async (c) => {
|
|
3406
3493
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
3407
3494
|
const actor = client.workflowQueueActor.getOrCreate(["workflow-queue"]);
|
|
3408
|
-
await actor.send(
|
|
3495
|
+
await actor.send(_chunkIJAGZS57cjs.WORKFLOW_QUEUE_NAME, {
|
|
3409
3496
|
hello: "world"
|
|
3410
3497
|
});
|
|
3411
3498
|
await waitFor(driverTestConfig, 200);
|
|
@@ -4838,7 +4925,7 @@ async function createTestRuntime(registryPath, driverFactory) {
|
|
|
4838
4925
|
const parsedConfig = registry.parseConfig();
|
|
4839
4926
|
const managerDriver = (_a = driver.manager) == null ? void 0 : _a.call(driver, parsedConfig);
|
|
4840
4927
|
_invariant2.default.call(void 0, managerDriver, "missing manager driver");
|
|
4841
|
-
const { router } =
|
|
4928
|
+
const { router } = _chunkR64EFI6Fcjs.buildManagerRouter.call(void 0,
|
|
4842
4929
|
parsedConfig,
|
|
4843
4930
|
managerDriver,
|
|
4844
4931
|
() => upgradeWebSocket
|
|
@@ -4865,7 +4952,7 @@ async function createTestRuntime(registryPath, driverFactory) {
|
|
|
4865
4952
|
_invariant2.default.call(void 0, address && typeof address !== "string", "missing server address");
|
|
4866
4953
|
const port = address.port;
|
|
4867
4954
|
const serverEndpoint = `http://127.0.0.1:${port}`;
|
|
4868
|
-
|
|
4955
|
+
_chunkIJAGZS57cjs.logger.call(void 0, ).info({ msg: "test serer listening", port });
|
|
4869
4956
|
const cleanup = async () => {
|
|
4870
4957
|
await new Promise(
|
|
4871
4958
|
(resolve) => server.close(() => resolve(void 0))
|