Skip to content

Commit 3a12344

Browse files
committed
tests: fixed node tests
* Related #527 [ci skip]
1 parent b75ec6f commit 3a12344

File tree

6 files changed

+95
-134
lines changed

6 files changed

+95
-134
lines changed

tests/nodes/NodeConnectionManager.lifecycle.test.ts

Lines changed: 31 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
5757
let nodeManager: NodeManager;
5858

5959
let nodeConnectionManager: NodeConnectionManager;
60+
const handleStream = () => {};
6061

6162
beforeEach(async () => {
6263
dataDir = await fs.promises.mkdtemp(
@@ -80,7 +81,10 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
8081
key: serverTlsConfig.keyPrivatePem,
8182
cert: serverTlsConfig.certChainPem,
8283
},
83-
crypto,
84+
crypto: {
85+
key: keysUtils.generateKey(),
86+
ops: crypto,
87+
},
8488
socket: serverSocket,
8589
logger: logger.getChild(`${QUICServer.name}`),
8690
});
@@ -172,11 +176,8 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
172176
keyRing,
173177
logger: logger.getChild(NodeConnectionManager.name),
174178
nodeGraph,
175-
quicClientConfig: {
176-
key: clientTlsConfig.keyPrivatePem,
177-
cert: clientTlsConfig.certChainPem,
178-
},
179179
crypto,
180+
tlsConfig: clientTlsConfig,
180181
quicSocket: clientSocket,
181182
seedNodes: undefined,
182183
});
@@ -193,6 +194,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
193194
await nodeManager.start();
194195
await nodeConnectionManager.start({
195196
nodeManager,
197+
handleStream,
196198
});
197199

198200
await nodeConnectionManager.stop();
@@ -204,10 +206,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
204206
keyRing,
205207
logger: logger.getChild(NodeConnectionManager.name),
206208
nodeGraph,
207-
quicClientConfig: {
208-
key: clientTlsConfig.keyPrivatePem,
209-
cert: clientTlsConfig.certChainPem,
210-
},
209+
tlsConfig: clientTlsConfig,
211210
crypto,
212211
quicSocket: clientSocket,
213212
seedNodes: undefined,
@@ -225,6 +224,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
225224
await nodeManager.start();
226225
await nodeConnectionManager.start({
227226
nodeManager,
227+
handleStream,
228228
});
229229
await taskManager.startProcessing();
230230

@@ -240,10 +240,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
240240
keyRing,
241241
logger: logger.getChild(NodeConnectionManager.name),
242242
nodeGraph,
243-
quicClientConfig: {
244-
key: clientTlsConfig.keyPrivatePem,
245-
cert: clientTlsConfig.certChainPem,
246-
},
243+
tlsConfig: clientTlsConfig,
247244
crypto,
248245
quicSocket: clientSocket,
249246
seedNodes: undefined,
@@ -261,6 +258,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
261258
await nodeManager.start();
262259
await nodeConnectionManager.start({
263260
nodeManager,
261+
handleStream,
264262
});
265263
await taskManager.startProcessing();
266264

@@ -276,10 +274,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
276274
keyRing,
277275
logger: logger.getChild(NodeConnectionManager.name),
278276
nodeGraph,
279-
quicClientConfig: {
280-
key: clientTlsConfig.keyPrivatePem,
281-
cert: clientTlsConfig.certChainPem,
282-
},
277+
tlsConfig: clientTlsConfig,
283278
crypto,
284279
quicSocket: clientSocket,
285280
seedNodes: undefined,
@@ -297,6 +292,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
297292
await nodeManager.start();
298293
await nodeConnectionManager.start({
299294
nodeManager,
295+
handleStream,
300296
});
301297
await taskManager.startProcessing();
302298

@@ -320,10 +316,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
320316
keyRing,
321317
logger: logger.getChild(NodeConnectionManager.name),
322318
nodeGraph,
323-
quicClientConfig: {
324-
key: clientTlsConfig.keyPrivatePem,
325-
cert: clientTlsConfig.certChainPem,
326-
},
319+
tlsConfig: clientTlsConfig,
327320
crypto,
328321
quicSocket: clientSocket,
329322
seedNodes: undefined,
@@ -341,6 +334,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
341334
await nodeManager.start();
342335
await nodeConnectionManager.start({
343336
nodeManager,
337+
handleStream,
344338
});
345339
await taskManager.startProcessing();
346340
// @ts-ignore: kidnap protected property
@@ -364,10 +358,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
364358
keyRing,
365359
logger: logger.getChild(NodeConnectionManager.name),
366360
nodeGraph,
367-
quicClientConfig: {
368-
key: clientTlsConfig.keyPrivatePem,
369-
cert: clientTlsConfig.certChainPem,
370-
},
361+
tlsConfig: clientTlsConfig,
371362
crypto,
372363
quicSocket: clientSocket,
373364
seedNodes: undefined,
@@ -385,6 +376,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
385376
await nodeManager.start();
386377
await nodeConnectionManager.start({
387378
nodeManager,
379+
handleStream,
388380
});
389381
await taskManager.startProcessing();
390382
// @ts-ignore: kidnap protected property
@@ -416,10 +408,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
416408
keyRing,
417409
logger: logger.getChild(NodeConnectionManager.name),
418410
nodeGraph,
419-
quicClientConfig: {
420-
key: clientTlsConfig.keyPrivatePem,
421-
cert: clientTlsConfig.certChainPem,
422-
},
411+
tlsConfig: clientTlsConfig,
423412
crypto,
424413
quicSocket: clientSocket,
425414
seedNodes: undefined,
@@ -437,6 +426,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
437426
await nodeManager.start();
438427
await nodeConnectionManager.start({
439428
nodeManager,
429+
handleStream,
440430
});
441431
await taskManager.startProcessing();
442432
await nodeConnectionManager.withConnF(serverNodeId, async () => {
@@ -458,10 +448,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
458448
keyRing,
459449
logger: logger.getChild(NodeConnectionManager.name),
460450
nodeGraph,
461-
quicClientConfig: {
462-
key: clientTlsConfig.keyPrivatePem,
463-
cert: clientTlsConfig.certChainPem,
464-
},
451+
tlsConfig: clientTlsConfig,
465452
crypto,
466453
quicSocket: clientSocket,
467454
seedNodes: undefined,
@@ -479,6 +466,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
479466
await nodeManager.start();
480467
await nodeConnectionManager.start({
481468
nodeManager,
469+
handleStream,
482470
});
483471
await taskManager.startProcessing();
484472
const waitProm = promise<void>();
@@ -508,10 +496,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
508496
keyRing,
509497
logger: logger.getChild(NodeConnectionManager.name),
510498
nodeGraph,
511-
quicClientConfig: {
512-
key: clientTlsConfig.keyPrivatePem,
513-
cert: clientTlsConfig.certChainPem,
514-
},
499+
tlsConfig: clientTlsConfig,
515500
crypto,
516501
quicSocket: clientSocket,
517502
seedNodes: undefined,
@@ -529,6 +514,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
529514
await nodeManager.start();
530515
await nodeConnectionManager.start({
531516
nodeManager,
517+
handleStream,
532518
});
533519
await taskManager.startProcessing();
534520
await nodeConnectionManager.withConnF(serverNodeId, async () => {
@@ -557,10 +543,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
557543
keyRing,
558544
logger: logger.getChild(NodeConnectionManager.name),
559545
nodeGraph,
560-
quicClientConfig: {
561-
key: clientTlsConfig.keyPrivatePem,
562-
cert: clientTlsConfig.certChainPem,
563-
},
546+
tlsConfig: clientTlsConfig,
564547
crypto,
565548
quicSocket: clientSocket,
566549
seedNodes: undefined,
@@ -578,6 +561,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
578561
await nodeManager.start();
579562
await nodeConnectionManager.start({
580563
nodeManager,
564+
handleStream,
581565
});
582566
await taskManager.startProcessing();
583567
await nodeConnectionManager.withConnF(serverNodeId, async () => {
@@ -598,10 +582,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
598582
keyRing,
599583
logger: logger.getChild(NodeConnectionManager.name),
600584
nodeGraph,
601-
quicClientConfig: {
602-
key: clientTlsConfig.keyPrivatePem,
603-
cert: clientTlsConfig.certChainPem,
604-
},
585+
tlsConfig: clientTlsConfig,
605586
crypto,
606587
quicSocket: clientSocket,
607588
seedNodes: undefined,
@@ -619,6 +600,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
619600
await nodeManager.start();
620601
await nodeConnectionManager.start({
621602
nodeManager,
603+
handleStream,
622604
});
623605
await taskManager.startProcessing();
624606
const result = await nodeConnectionManager.pingNode(
@@ -636,10 +618,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
636618
keyRing,
637619
logger: logger.getChild(NodeConnectionManager.name),
638620
nodeGraph,
639-
quicClientConfig: {
640-
key: clientTlsConfig.keyPrivatePem,
641-
cert: clientTlsConfig.certChainPem,
642-
},
621+
tlsConfig: clientTlsConfig,
643622
crypto,
644623
quicSocket: clientSocket,
645624
seedNodes: undefined,
@@ -657,6 +636,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
657636
await nodeManager.start();
658637
await nodeConnectionManager.start({
659638
nodeManager,
639+
handleStream,
660640
});
661641
await taskManager.startProcessing();
662642
const result = await nodeConnectionManager.pingNode(
@@ -675,10 +655,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
675655
keyRing,
676656
logger: logger.getChild(NodeConnectionManager.name),
677657
nodeGraph,
678-
quicClientConfig: {
679-
key: clientTlsConfig.keyPrivatePem,
680-
cert: clientTlsConfig.certChainPem,
681-
},
658+
tlsConfig: clientTlsConfig,
682659
crypto,
683660
quicSocket: clientSocket,
684661
seedNodes: undefined,
@@ -696,6 +673,7 @@ describe(`${NodeConnectionManager.name} lifecycle test`, () => {
696673
await nodeManager.start();
697674
await nodeConnectionManager.start({
698675
nodeManager,
676+
handleStream,
699677
});
700678
await taskManager.startProcessing();
701679
const result = await nodeConnectionManager.pingNode(

0 commit comments

Comments
 (0)