rivetkit 2.0.42 → 2.0.43-rc.1
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/tsup/{chunk-FJ3KTN4V.js → chunk-2NJQ3DJ5.js} +2 -2
- package/dist/tsup/chunk-2NJQ3DJ5.js.map +1 -0
- package/dist/tsup/{chunk-EJVBH5VF.cjs → chunk-3HKN5HQ7.cjs} +3 -3
- package/dist/tsup/{chunk-EJVBH5VF.cjs.map → chunk-3HKN5HQ7.cjs.map} +1 -1
- package/dist/tsup/{chunk-RZW2DNND.cjs → chunk-BEMEUFS2.cjs} +58 -58
- package/dist/tsup/{chunk-RZW2DNND.cjs.map → chunk-BEMEUFS2.cjs.map} +1 -1
- package/dist/tsup/{chunk-TCOEBUUE.js → chunk-CKBPIXRM.js} +3 -3
- package/dist/tsup/{chunk-RUW5CZ5Z.cjs → chunk-ETNL2HZL.cjs} +46 -46
- package/dist/tsup/{chunk-RUW5CZ5Z.cjs.map → chunk-ETNL2HZL.cjs.map} +1 -1
- package/dist/tsup/{chunk-GMAVRZSF.js → chunk-F7ZL4T63.js} +2 -2
- package/dist/tsup/{chunk-X35U3YNX.cjs → chunk-MQ3PTGWH.cjs} +110 -94
- package/dist/tsup/chunk-MQ3PTGWH.cjs.map +1 -0
- package/dist/tsup/{chunk-XXGJCOL6.js → chunk-NENM5PQN.js} +2 -2
- package/dist/tsup/{chunk-2IJTYN6K.cjs → chunk-R33VIC3W.cjs} +11 -11
- package/dist/tsup/{chunk-2IJTYN6K.cjs.map → chunk-R33VIC3W.cjs.map} +1 -1
- package/dist/tsup/{chunk-3VP5CSHV.cjs → chunk-ROVVTBUE.cjs} +9 -9
- package/dist/tsup/{chunk-3VP5CSHV.cjs.map → chunk-ROVVTBUE.cjs.map} +1 -1
- package/dist/tsup/{chunk-JDAD2YFA.js → chunk-S22E2HUH.js} +23 -7
- package/dist/tsup/chunk-S22E2HUH.js.map +1 -0
- package/dist/tsup/{chunk-Q6W7RJJP.js → chunk-TFMRMA5S.js} +4 -4
- package/dist/tsup/{chunk-GD7UXGOE.cjs → chunk-YR6H6STI.cjs} +248 -248
- package/dist/tsup/{chunk-GD7UXGOE.cjs.map → chunk-YR6H6STI.cjs.map} +1 -1
- package/dist/tsup/{chunk-H4TB4X25.cjs → chunk-YZZF7DES.cjs} +2 -2
- package/dist/tsup/chunk-YZZF7DES.cjs.map +1 -0
- package/dist/tsup/{chunk-AQFSQMBG.js → chunk-Z3BORZE2.js} +5 -5
- package/dist/tsup/{chunk-KCOVZOPS.js → chunk-ZKCVZA7Z.js} +4 -4
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.js +4 -4
- 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 +3 -3
- package/dist/tsup/driver-helpers/mod.js +2 -2
- package/dist/tsup/driver-test-suite/mod.cjs +191 -55
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.js +782 -646
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/mod.cjs +7 -7
- package/dist/tsup/mod.js +6 -6
- package/dist/tsup/serve-test-suite/mod.cjs +139 -57
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +90 -8
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/package.json +2 -2
- package/src/driver-test-suite/mod.ts +3 -0
- package/src/driver-test-suite/tests/actor-driver.ts +4 -0
- package/src/driver-test-suite/tests/actor-lifecycle.ts +157 -0
- package/src/driver-test-suite/tests/conn-error-serialization.ts +64 -0
- package/src/drivers/engine/actor-driver.ts +24 -4
- package/dist/tsup/chunk-FJ3KTN4V.js.map +0 -1
- package/dist/tsup/chunk-H4TB4X25.cjs.map +0 -1
- package/dist/tsup/chunk-JDAD2YFA.js.map +0 -1
- package/dist/tsup/chunk-X35U3YNX.cjs.map +0 -1
- /package/dist/tsup/{chunk-TCOEBUUE.js.map → chunk-CKBPIXRM.js.map} +0 -0
- /package/dist/tsup/{chunk-GMAVRZSF.js.map → chunk-F7ZL4T63.js.map} +0 -0
- /package/dist/tsup/{chunk-XXGJCOL6.js.map → chunk-NENM5PQN.js.map} +0 -0
- /package/dist/tsup/{chunk-Q6W7RJJP.js.map → chunk-TFMRMA5S.js.map} +0 -0
- /package/dist/tsup/{chunk-AQFSQMBG.js.map → chunk-Z3BORZE2.js.map} +0 -0
- /package/dist/tsup/{chunk-KCOVZOPS.js.map → chunk-ZKCVZA7Z.js.map} +0 -0
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkR33VIC3Wcjs = require('../chunk-R33VIC3W.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
8
|
+
var _chunkROVVTBUEcjs = require('../chunk-ROVVTBUE.cjs');
|
|
9
|
+
require('../chunk-MQ3PTGWH.cjs');
|
|
10
|
+
require('../chunk-ETNL2HZL.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkYR6H6STIcjs = require('../chunk-YR6H6STI.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk3HKN5HQ7cjs = require('../chunk-3HKN5HQ7.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -27,11 +27,11 @@ var _chunkEJVBH5VFcjs = require('../chunk-EJVBH5VF.cjs');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunkBEMEUFS2cjs = require('../chunk-BEMEUFS2.cjs');
|
|
31
31
|
require('../chunk-KDFWJKMJ.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkYZZF7DEScjs = require('../chunk-YZZF7DES.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -80,20 +80,20 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
80
80
|
const oldUrl = new URL(actorRequest.url);
|
|
81
81
|
const normalizedPath = oldUrl.pathname.startsWith("/") ? oldUrl.pathname.slice(1) : oldUrl.pathname;
|
|
82
82
|
const pathWithQuery = normalizedPath + oldUrl.search;
|
|
83
|
-
|
|
83
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).debug({
|
|
84
84
|
msg: "sending raw http request via test inline driver",
|
|
85
85
|
actorId,
|
|
86
86
|
encoding,
|
|
87
87
|
path: pathWithQuery
|
|
88
88
|
});
|
|
89
89
|
const url = `${endpoint}/.test/inline-driver/send-request/${pathWithQuery}`;
|
|
90
|
-
|
|
90
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).debug({
|
|
91
91
|
msg: "rewriting http url",
|
|
92
92
|
from: oldUrl,
|
|
93
93
|
to: url
|
|
94
94
|
});
|
|
95
95
|
const headers = new Headers(actorRequest.headers);
|
|
96
|
-
headers.set(
|
|
96
|
+
headers.set(_chunkBEMEUFS2cjs.HEADER_ACTOR_ID, actorId);
|
|
97
97
|
const response = await fetch(
|
|
98
98
|
new Request(url, {
|
|
99
99
|
method: actorRequest.method,
|
|
@@ -109,7 +109,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
109
109
|
const errorData = await clonedResponse.json();
|
|
110
110
|
if (errorData.error) {
|
|
111
111
|
if (typeof errorData.error === "object") {
|
|
112
|
-
throw new (0,
|
|
112
|
+
throw new (0, _chunkYR6H6STIcjs.ActorError)(
|
|
113
113
|
errorData.error.code,
|
|
114
114
|
errorData.error.message,
|
|
115
115
|
errorData.error.metadata
|
|
@@ -117,7 +117,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
} catch (e) {
|
|
120
|
-
if (!(e instanceof
|
|
120
|
+
if (!(e instanceof _chunkYR6H6STIcjs.ActorError)) {
|
|
121
121
|
return response;
|
|
122
122
|
}
|
|
123
123
|
throw e;
|
|
@@ -126,33 +126,33 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
126
126
|
return response;
|
|
127
127
|
},
|
|
128
128
|
async openWebSocket(path, actorId, encoding2, params) {
|
|
129
|
-
const WebSocket2 = await
|
|
129
|
+
const WebSocket2 = await _chunk3HKN5HQ7cjs.importWebSocket.call(void 0, );
|
|
130
130
|
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
131
131
|
const wsUrl = new URL(
|
|
132
132
|
`${endpoint}/.test/inline-driver/connect-websocket/ws`
|
|
133
133
|
);
|
|
134
|
-
|
|
134
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).debug({
|
|
135
135
|
msg: "creating websocket connection via test inline driver",
|
|
136
136
|
url: wsUrl.toString()
|
|
137
137
|
});
|
|
138
138
|
const wsProtocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
139
139
|
const finalWsUrl = `${wsProtocol}//${wsUrl.host}${wsUrl.pathname}`;
|
|
140
140
|
const protocols = [];
|
|
141
|
-
protocols.push(
|
|
142
|
-
protocols.push(`${
|
|
141
|
+
protocols.push(_chunkBEMEUFS2cjs.WS_PROTOCOL_STANDARD);
|
|
142
|
+
protocols.push(`${_chunkBEMEUFS2cjs.WS_PROTOCOL_TARGET}actor`);
|
|
143
143
|
protocols.push(
|
|
144
|
-
`${
|
|
144
|
+
`${_chunkBEMEUFS2cjs.WS_PROTOCOL_ACTOR}${encodeURIComponent(actorId)}`
|
|
145
145
|
);
|
|
146
|
-
protocols.push(`${
|
|
146
|
+
protocols.push(`${_chunkBEMEUFS2cjs.WS_PROTOCOL_ENCODING}${encoding2}`);
|
|
147
147
|
protocols.push(
|
|
148
|
-
`${
|
|
148
|
+
`${_chunkBEMEUFS2cjs.WS_TEST_PROTOCOL_PATH}${encodeURIComponent(normalizedPath)}`
|
|
149
149
|
);
|
|
150
150
|
if (params !== void 0) {
|
|
151
151
|
protocols.push(
|
|
152
|
-
`${
|
|
152
|
+
`${_chunkBEMEUFS2cjs.WS_PROTOCOL_CONN_PARAMS}${encodeURIComponent(JSON.stringify(params))}`
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).debug({
|
|
156
156
|
msg: "connecting to websocket",
|
|
157
157
|
url: finalWsUrl,
|
|
158
158
|
protocols
|
|
@@ -172,7 +172,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
172
172
|
encoding2,
|
|
173
173
|
params
|
|
174
174
|
);
|
|
175
|
-
return upgradeWebSocket(() => wsHandler)(c,
|
|
175
|
+
return upgradeWebSocket(() => wsHandler)(c, _chunkYZZF7DEScjs.noopNext.call(void 0, ));
|
|
176
176
|
},
|
|
177
177
|
async buildGatewayUrl(actorId) {
|
|
178
178
|
return `${endpoint}/gateway/${actorId}`;
|
|
@@ -189,7 +189,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
async function makeInlineRequest(endpoint, encoding, method, args) {
|
|
192
|
-
|
|
192
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).debug({
|
|
193
193
|
msg: "sending inline request",
|
|
194
194
|
encoding,
|
|
195
195
|
method,
|
|
@@ -219,14 +219,14 @@ async function makeInlineRequest(endpoint, encoding, method, args) {
|
|
|
219
219
|
if ("ok" in callResponse) {
|
|
220
220
|
return callResponse.ok;
|
|
221
221
|
} else if ("err" in callResponse) {
|
|
222
|
-
throw new (0,
|
|
222
|
+
throw new (0, _chunkYR6H6STIcjs.ActorError)(
|
|
223
223
|
callResponse.err.group,
|
|
224
224
|
callResponse.err.code,
|
|
225
225
|
callResponse.err.message,
|
|
226
226
|
callResponse.err.metadata
|
|
227
227
|
);
|
|
228
228
|
} else {
|
|
229
|
-
|
|
229
|
+
_chunkBEMEUFS2cjs.assertUnreachable.call(void 0, callResponse);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
@@ -239,12 +239,12 @@ async function setupDriverTest(c, driverTestConfig) {
|
|
|
239
239
|
}
|
|
240
240
|
const { endpoint, namespace, runnerName, cleanup } = await driverTestConfig.start();
|
|
241
241
|
c.onTestFinished(() => {
|
|
242
|
-
|
|
242
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).info("cleaning up test");
|
|
243
243
|
cleanup();
|
|
244
244
|
});
|
|
245
245
|
let client;
|
|
246
246
|
if (driverTestConfig.clientType === "http") {
|
|
247
|
-
client =
|
|
247
|
+
client = _chunkYR6H6STIcjs.createClient.call(void 0, {
|
|
248
248
|
endpoint,
|
|
249
249
|
namespace,
|
|
250
250
|
runnerName,
|
|
@@ -257,12 +257,12 @@ async function setupDriverTest(c, driverTestConfig) {
|
|
|
257
257
|
} else if (driverTestConfig.clientType === "inline") {
|
|
258
258
|
const encoding = _nullishCoalesce(driverTestConfig.encoding, () => ( "bare"));
|
|
259
259
|
const managerDriver = createTestInlineClientDriver(endpoint, encoding);
|
|
260
|
-
const runConfig =
|
|
260
|
+
const runConfig = _chunkYR6H6STIcjs.ClientConfigSchema.parse({
|
|
261
261
|
encoding
|
|
262
262
|
});
|
|
263
|
-
client =
|
|
263
|
+
client = _chunkYR6H6STIcjs.createClientWithDriver.call(void 0, managerDriver, runConfig);
|
|
264
264
|
} else {
|
|
265
|
-
|
|
265
|
+
_chunkBEMEUFS2cjs.assertUnreachable.call(void 0, driverTestConfig.clientType);
|
|
266
266
|
}
|
|
267
267
|
if (!driverTestConfig.HACK_skipCleanupNet) {
|
|
268
268
|
c.onTestFinished(async () => await client.dispose());
|
|
@@ -796,7 +796,7 @@ function runActorConnHibernationTests(driverTestConfig) {
|
|
|
796
796
|
await hibernatingActor.triggerSleep();
|
|
797
797
|
await waitFor(
|
|
798
798
|
driverTestConfig,
|
|
799
|
-
|
|
799
|
+
_chunkR33VIC3Wcjs.HIBERNATION_SLEEP_TIMEOUT + 100
|
|
800
800
|
);
|
|
801
801
|
const ping2 = await hibernatingActor.ping();
|
|
802
802
|
_vitest.expect.call(void 0, ping2).toBe("pong");
|
|
@@ -818,7 +818,7 @@ function runActorConnHibernationTests(driverTestConfig) {
|
|
|
818
818
|
await hibernatingActor.triggerSleep();
|
|
819
819
|
await waitFor(
|
|
820
820
|
driverTestConfig,
|
|
821
|
-
|
|
821
|
+
_chunkR33VIC3Wcjs.HIBERNATION_SLEEP_TIMEOUT + 100
|
|
822
822
|
);
|
|
823
823
|
const count3 = await hibernatingActor.getConnCount();
|
|
824
824
|
_vitest.expect.call(void 0, count3).toBe(2);
|
|
@@ -840,7 +840,7 @@ function runActorConnHibernationTests(driverTestConfig) {
|
|
|
840
840
|
await conn1.triggerSleep();
|
|
841
841
|
await waitFor(
|
|
842
842
|
driverTestConfig,
|
|
843
|
-
|
|
843
|
+
_chunkR33VIC3Wcjs.HIBERNATION_SLEEP_TIMEOUT + 100
|
|
844
844
|
);
|
|
845
845
|
await conn1.dispose();
|
|
846
846
|
await waitFor(driverTestConfig, 250);
|
|
@@ -1046,6 +1046,44 @@ function runActorConnStateTests(driverTestConfig) {
|
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
1048
|
|
|
1049
|
+
// src/driver-test-suite/tests/conn-error-serialization.ts
|
|
1050
|
+
|
|
1051
|
+
function runConnErrorSerializationTests(driverTestConfig) {
|
|
1052
|
+
_vitest.describe.call(void 0, "Connection Error Serialization Tests", () => {
|
|
1053
|
+
_vitest.test.call(void 0, "error thrown in createConnState preserves group and code through WebSocket serialization", async (c) => {
|
|
1054
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1055
|
+
const actorKey = `test-error-serialization-${Date.now()}`;
|
|
1056
|
+
const actor = client.connErrorSerializationActor.getOrCreate(
|
|
1057
|
+
[actorKey],
|
|
1058
|
+
{ params: { shouldThrow: true } }
|
|
1059
|
+
);
|
|
1060
|
+
const conn = actor.connect();
|
|
1061
|
+
let caughtError;
|
|
1062
|
+
try {
|
|
1063
|
+
await conn.getValue();
|
|
1064
|
+
} catch (err) {
|
|
1065
|
+
caughtError = err;
|
|
1066
|
+
}
|
|
1067
|
+
_vitest.expect.call(void 0, caughtError).toBeDefined();
|
|
1068
|
+
_vitest.expect.call(void 0, caughtError.group).toBe("connection");
|
|
1069
|
+
_vitest.expect.call(void 0, caughtError.code).toBe("custom_error");
|
|
1070
|
+
await conn.dispose();
|
|
1071
|
+
});
|
|
1072
|
+
_vitest.test.call(void 0, "successful createConnState does not throw error", async (c) => {
|
|
1073
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1074
|
+
const actorKey = `test-no-error-${Date.now()}`;
|
|
1075
|
+
const actor = client.connErrorSerializationActor.getOrCreate(
|
|
1076
|
+
[actorKey],
|
|
1077
|
+
{ params: { shouldThrow: false } }
|
|
1078
|
+
);
|
|
1079
|
+
const conn = actor.connect();
|
|
1080
|
+
const value = await conn.getValue();
|
|
1081
|
+
_vitest.expect.call(void 0, value).toBe(0);
|
|
1082
|
+
await conn.dispose();
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1049
1087
|
// src/driver-test-suite/tests/actor-destroy.ts
|
|
1050
1088
|
|
|
1051
1089
|
function runActorDestroyTests(driverTestConfig) {
|
|
@@ -1234,6 +1272,102 @@ function runActorDestroyTests(driverTestConfig) {
|
|
|
1234
1272
|
// src/driver-test-suite/tests/actor-driver.ts
|
|
1235
1273
|
|
|
1236
1274
|
|
|
1275
|
+
// src/driver-test-suite/tests/actor-lifecycle.ts
|
|
1276
|
+
|
|
1277
|
+
function runActorLifecycleTests(driverTestConfig) {
|
|
1278
|
+
_vitest.describe.call(void 0, "Actor Lifecycle Tests", () => {
|
|
1279
|
+
_vitest.test.call(void 0, "actor stop during start waits for start to complete", async (c) => {
|
|
1280
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1281
|
+
const actorKey = `test-stop-during-start-${Date.now()}`;
|
|
1282
|
+
const actor = client.startStopRaceActor.getOrCreate([actorKey]);
|
|
1283
|
+
const pingPromise = actor.ping();
|
|
1284
|
+
const actorId = await actor.resolve();
|
|
1285
|
+
await actor.destroy();
|
|
1286
|
+
const result = await pingPromise;
|
|
1287
|
+
_vitest.expect.call(void 0, result).toBe("pong");
|
|
1288
|
+
let destroyed = false;
|
|
1289
|
+
try {
|
|
1290
|
+
await client.startStopRaceActor.getForId(actorId).ping();
|
|
1291
|
+
} catch (err) {
|
|
1292
|
+
destroyed = true;
|
|
1293
|
+
_vitest.expect.call(void 0, err.group).toBe("actor");
|
|
1294
|
+
_vitest.expect.call(void 0, err.code).toBe("not_found");
|
|
1295
|
+
}
|
|
1296
|
+
_vitest.expect.call(void 0, destroyed).toBe(true);
|
|
1297
|
+
});
|
|
1298
|
+
_vitest.test.call(void 0, "actor stop before actor instantiation completes cleans up handler", async (c) => {
|
|
1299
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1300
|
+
const actorKey = `test-stop-before-instantiation-${Date.now()}`;
|
|
1301
|
+
const actors = Array.from(
|
|
1302
|
+
{ length: 5 },
|
|
1303
|
+
(_, i) => client.startStopRaceActor.getOrCreate([
|
|
1304
|
+
`${actorKey}-${i}`
|
|
1305
|
+
])
|
|
1306
|
+
);
|
|
1307
|
+
const ids = await Promise.all(actors.map((a) => a.resolve()));
|
|
1308
|
+
await Promise.all(actors.map((a) => a.destroy()));
|
|
1309
|
+
for (const id of ids) {
|
|
1310
|
+
let destroyed = false;
|
|
1311
|
+
try {
|
|
1312
|
+
await client.startStopRaceActor.getForId(id).ping();
|
|
1313
|
+
} catch (err) {
|
|
1314
|
+
destroyed = true;
|
|
1315
|
+
_vitest.expect.call(void 0, err.group).toBe("actor");
|
|
1316
|
+
_vitest.expect.call(void 0, err.code).toBe("not_found");
|
|
1317
|
+
}
|
|
1318
|
+
_vitest.expect.call(void 0, destroyed, `actor ${id} should be destroyed`).toBe(
|
|
1319
|
+
true
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
_vitest.test.call(void 0, "onBeforeActorStart completes before stop proceeds", async (c) => {
|
|
1324
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1325
|
+
const actorKey = `test-before-actor-start-${Date.now()}`;
|
|
1326
|
+
const actor = client.startStopRaceActor.getOrCreate([actorKey]);
|
|
1327
|
+
const statePromise = actor.getState();
|
|
1328
|
+
await actor.destroy();
|
|
1329
|
+
const state = await statePromise;
|
|
1330
|
+
_vitest.expect.call(void 0, state.initialized).toBe(true);
|
|
1331
|
+
_vitest.expect.call(void 0, state.startCompleted).toBe(true);
|
|
1332
|
+
});
|
|
1333
|
+
_vitest.test.call(void 0, "multiple rapid create/destroy cycles handle race correctly", async (c) => {
|
|
1334
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1335
|
+
for (let i = 0; i < 10; i++) {
|
|
1336
|
+
const actorKey = `test-rapid-cycle-${Date.now()}-${i}`;
|
|
1337
|
+
const actor = client.startStopRaceActor.getOrCreate([
|
|
1338
|
+
actorKey
|
|
1339
|
+
]);
|
|
1340
|
+
const resolvePromise = actor.resolve();
|
|
1341
|
+
const destroyPromise = actor.destroy();
|
|
1342
|
+
await Promise.all([resolvePromise, destroyPromise]);
|
|
1343
|
+
}
|
|
1344
|
+
_vitest.expect.call(void 0, true).toBe(true);
|
|
1345
|
+
});
|
|
1346
|
+
_vitest.test.call(void 0, "actor stop called with no actor instance cleans up handler", async (c) => {
|
|
1347
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1348
|
+
const actorKey = `test-cleanup-no-instance-${Date.now()}`;
|
|
1349
|
+
const actor = client.startStopRaceActor.getOrCreate([actorKey]);
|
|
1350
|
+
const id = await actor.resolve();
|
|
1351
|
+
await actor.destroy();
|
|
1352
|
+
const newActor = client.startStopRaceActor.getOrCreate([
|
|
1353
|
+
actorKey
|
|
1354
|
+
]);
|
|
1355
|
+
const result = await newActor.ping();
|
|
1356
|
+
_vitest.expect.call(void 0, result).toBe("pong");
|
|
1357
|
+
await newActor.destroy();
|
|
1358
|
+
});
|
|
1359
|
+
_vitest.test.call(void 0, "onDestroy is called even when actor is destroyed during start", async (c) => {
|
|
1360
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
1361
|
+
const actorKey = `test-ondestroy-during-start-${Date.now()}`;
|
|
1362
|
+
const actor = client.startStopRaceActor.getOrCreate([actorKey]);
|
|
1363
|
+
const statePromise = actor.getState();
|
|
1364
|
+
await actor.destroy();
|
|
1365
|
+
const state = await statePromise;
|
|
1366
|
+
_vitest.expect.call(void 0, state.destroyCalled).toBe(true);
|
|
1367
|
+
});
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1237
1371
|
// src/driver-test-suite/tests/actor-schedule.ts
|
|
1238
1372
|
|
|
1239
1373
|
function runActorScheduleTests(driverTestConfig) {
|
|
@@ -1325,7 +1459,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1325
1459
|
}
|
|
1326
1460
|
await sleepActor.triggerSleep();
|
|
1327
1461
|
await sleepActor.dispose();
|
|
1328
|
-
await waitFor(driverTestConfig,
|
|
1462
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1329
1463
|
const sleepActor2 = client.sleep.getOrCreate();
|
|
1330
1464
|
{
|
|
1331
1465
|
const { startCount, sleepCount } = await sleepActor2.getCounts();
|
|
@@ -1341,7 +1475,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1341
1475
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1342
1476
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1343
1477
|
}
|
|
1344
|
-
await waitFor(driverTestConfig,
|
|
1478
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1345
1479
|
{
|
|
1346
1480
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1347
1481
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1357,7 +1491,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1357
1491
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1358
1492
|
}
|
|
1359
1493
|
await sleepActor.dispose();
|
|
1360
|
-
await waitFor(driverTestConfig,
|
|
1494
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1361
1495
|
const sleepActor2 = client.sleep.getOrCreate();
|
|
1362
1496
|
{
|
|
1363
1497
|
const { startCount, sleepCount } = await sleepActor2.getCounts();
|
|
@@ -1373,19 +1507,19 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1373
1507
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1374
1508
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1375
1509
|
}
|
|
1376
|
-
await waitFor(driverTestConfig,
|
|
1510
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT - 250);
|
|
1377
1511
|
{
|
|
1378
1512
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1379
1513
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1380
1514
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1381
1515
|
}
|
|
1382
|
-
await waitFor(driverTestConfig,
|
|
1516
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT - 250);
|
|
1383
1517
|
{
|
|
1384
1518
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1385
1519
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1386
1520
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1387
1521
|
}
|
|
1388
|
-
await waitFor(driverTestConfig,
|
|
1522
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1389
1523
|
{
|
|
1390
1524
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1391
1525
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1400,8 +1534,8 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1400
1534
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1401
1535
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1402
1536
|
}
|
|
1403
|
-
await sleepActor.setAlarm(
|
|
1404
|
-
await waitFor(driverTestConfig,
|
|
1537
|
+
await sleepActor.setAlarm(_chunkR33VIC3Wcjs.SLEEP_TIMEOUT - 250);
|
|
1538
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1405
1539
|
{
|
|
1406
1540
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1407
1541
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
@@ -1416,8 +1550,8 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1416
1550
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1417
1551
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1418
1552
|
}
|
|
1419
|
-
await sleepActor.setAlarm(
|
|
1420
|
-
await waitFor(driverTestConfig,
|
|
1553
|
+
await sleepActor.setAlarm(_chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1554
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 200);
|
|
1421
1555
|
{
|
|
1422
1556
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1423
1557
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1437,7 +1571,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1437
1571
|
);
|
|
1438
1572
|
const longRunningPromise = sleepActor.longRunningRpc();
|
|
1439
1573
|
await waitPromise;
|
|
1440
|
-
await waitFor(driverTestConfig,
|
|
1574
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1441
1575
|
await sleepActor.finishLongRunningRpc();
|
|
1442
1576
|
await longRunningPromise;
|
|
1443
1577
|
{
|
|
@@ -1446,7 +1580,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1446
1580
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1447
1581
|
}
|
|
1448
1582
|
await sleepActor.dispose();
|
|
1449
|
-
await waitFor(driverTestConfig,
|
|
1583
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1450
1584
|
const sleepActor2 = client.sleepWithLongRpc.getOrCreate();
|
|
1451
1585
|
{
|
|
1452
1586
|
const { startCount, sleepCount } = await sleepActor2.getCounts();
|
|
@@ -1478,7 +1612,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1478
1612
|
}
|
|
1479
1613
|
};
|
|
1480
1614
|
});
|
|
1481
|
-
await waitFor(driverTestConfig,
|
|
1615
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1482
1616
|
ws.send(JSON.stringify({ type: "getCounts" }));
|
|
1483
1617
|
const counts = await new Promise((resolve) => {
|
|
1484
1618
|
ws.onmessage = (event) => {
|
|
@@ -1491,7 +1625,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1491
1625
|
_vitest.expect.call(void 0, counts.sleepCount).toBe(0);
|
|
1492
1626
|
_vitest.expect.call(void 0, counts.startCount).toBe(1);
|
|
1493
1627
|
ws.close();
|
|
1494
|
-
await waitFor(driverTestConfig,
|
|
1628
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1495
1629
|
{
|
|
1496
1630
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1497
1631
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1509,7 +1643,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1509
1643
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1510
1644
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1511
1645
|
}
|
|
1512
|
-
const fetchDuration =
|
|
1646
|
+
const fetchDuration = _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250;
|
|
1513
1647
|
const fetchPromise = sleepActor.fetch(
|
|
1514
1648
|
`long-request?duration=${fetchDuration}`
|
|
1515
1649
|
);
|
|
@@ -1522,7 +1656,7 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1522
1656
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1523
1657
|
_vitest.expect.call(void 0, requestCount).toBe(1);
|
|
1524
1658
|
}
|
|
1525
|
-
await waitFor(driverTestConfig,
|
|
1659
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1526
1660
|
{
|
|
1527
1661
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1528
1662
|
_vitest.expect.call(void 0, sleepCount).toBe(1);
|
|
@@ -1537,13 +1671,13 @@ function runActorSleepTests(driverTestConfig) {
|
|
|
1537
1671
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1538
1672
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1539
1673
|
}
|
|
1540
|
-
await waitFor(driverTestConfig,
|
|
1674
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1541
1675
|
{
|
|
1542
1676
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1543
1677
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
1544
1678
|
_vitest.expect.call(void 0, startCount).toBe(1);
|
|
1545
1679
|
}
|
|
1546
|
-
await waitFor(driverTestConfig,
|
|
1680
|
+
await waitFor(driverTestConfig, _chunkR33VIC3Wcjs.SLEEP_TIMEOUT + 250);
|
|
1547
1681
|
{
|
|
1548
1682
|
const { startCount, sleepCount } = await sleepActor.getCounts();
|
|
1549
1683
|
_vitest.expect.call(void 0, sleepCount).toBe(0);
|
|
@@ -1596,6 +1730,7 @@ function runActorDriverTests(driverTestConfig) {
|
|
|
1596
1730
|
runActorStateTests(driverTestConfig);
|
|
1597
1731
|
runActorScheduleTests(driverTestConfig);
|
|
1598
1732
|
runActorSleepTests(driverTestConfig);
|
|
1733
|
+
runActorLifecycleTests(driverTestConfig);
|
|
1599
1734
|
});
|
|
1600
1735
|
}
|
|
1601
1736
|
|
|
@@ -3544,6 +3679,7 @@ function runDriverTests(driverTestConfigPartial) {
|
|
|
3544
3679
|
runActorConnTests(driverTestConfig);
|
|
3545
3680
|
runActorConnStateTests(driverTestConfig);
|
|
3546
3681
|
runActorConnHibernationTests(driverTestConfig);
|
|
3682
|
+
runConnErrorSerializationTests(driverTestConfig);
|
|
3547
3683
|
runActorDestroyTests(driverTestConfig);
|
|
3548
3684
|
runRequestAccessTests(driverTestConfig);
|
|
3549
3685
|
runActorHandleTests(driverTestConfig);
|
|
@@ -3591,7 +3727,7 @@ async function createTestRuntime(registryPath, driverFactory) {
|
|
|
3591
3727
|
const parsedConfig = registry.parseConfig();
|
|
3592
3728
|
const managerDriver = (_a = driver.manager) == null ? void 0 : _a.call(driver, parsedConfig);
|
|
3593
3729
|
_invariant2.default.call(void 0, managerDriver, "missing manager driver");
|
|
3594
|
-
const { router } =
|
|
3730
|
+
const { router } = _chunkBEMEUFS2cjs.buildManagerRouter.call(void 0,
|
|
3595
3731
|
parsedConfig,
|
|
3596
3732
|
managerDriver,
|
|
3597
3733
|
() => upgradeWebSocket
|
|
@@ -3599,7 +3735,7 @@ async function createTestRuntime(registryPath, driverFactory) {
|
|
|
3599
3735
|
const nodeWebSocket = _nodews.createNodeWebSocket.call(void 0, { app: router });
|
|
3600
3736
|
upgradeWebSocket = nodeWebSocket.upgradeWebSocket;
|
|
3601
3737
|
managerDriver.setGetUpgradeWebSocket(() => upgradeWebSocket);
|
|
3602
|
-
const port = await
|
|
3738
|
+
const port = await _chunkROVVTBUEcjs.getPort.call(void 0, );
|
|
3603
3739
|
const server = _nodeserver.serve.call(void 0, {
|
|
3604
3740
|
fetch: router.fetch,
|
|
3605
3741
|
hostname: "127.0.0.1",
|
|
@@ -3611,7 +3747,7 @@ async function createTestRuntime(registryPath, driverFactory) {
|
|
|
3611
3747
|
);
|
|
3612
3748
|
nodeWebSocket.injectWebSocket(server);
|
|
3613
3749
|
const serverEndpoint = `http://127.0.0.1:${port}`;
|
|
3614
|
-
|
|
3750
|
+
_chunkR33VIC3Wcjs.logger.call(void 0, ).info({ msg: "test serer listening", port });
|
|
3615
3751
|
const cleanup = async () => {
|
|
3616
3752
|
await new Promise(
|
|
3617
3753
|
(resolve) => server.close(() => resolve(void 0))
|