Skip to content

Commit 25f7b00

Browse files
committed
fix github actions failing tests
1 parent cfea6b3 commit 25f7b00

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/modules/network/implementation/libp2p-service.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ class Libp2pService {
116116
this.logger.info(`Network ID is ${this.config.id}, connection port is ${port}`);
117117
}
118118

119+
async stop() {
120+
if (this.node) {
121+
this.logger.info('Stopping libp2p node...');
122+
await this.node.stop();
123+
this.logger.info('Libp2p node stopped');
124+
}
125+
}
126+
119127
async onPeerConnected(listener) {
120128
this.node.connectionManager.on('peer:connect', listener);
121129
}

src/modules/network/network-module-manager.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ class NetworkModuleManager extends BaseModuleManager {
1111
}
1212
}
1313

14+
async stop() {
15+
if (this.initialized) {
16+
return this.getImplementation().module.stop();
17+
}
18+
}
19+
1420
async onPeerConnected(listener) {
1521
if (this.initialized) {
1622
return this.getImplementation().module.onPeerConnected(listener);

test/utilities/MockOTNode.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export default class MockOTNode extends OTNode {
2121
await httpClientModuleManager.close();
2222
}
2323

24+
// Stop network module (libp2p)
25+
const networkModuleManager = this.container?.resolve('networkModuleManager');
26+
if (networkModuleManager?.stop) {
27+
await networkModuleManager.stop();
28+
}
29+
2430
// Cleanup proofing service intervals
2531
const proofingService = this.container?.resolve('proofingService');
2632
if (proofingService?.cleanup) {
@@ -45,4 +51,4 @@ export default class MockOTNode extends OTNode {
4551
throw error;
4652
}
4753
}
48-
}
54+
}

0 commit comments

Comments
 (0)