Skip to content

Commit 8f0c8cb

Browse files
committed
test: added test for consecutive start stops on server
1 parent c9fab57 commit 8f0c8cb

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/QUICServer.test.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,30 @@ describe(QUICServer.name, () => {
149149
expect(typeof quicServer.port).toBe('number');
150150
await quicServer.stop();
151151
});
152+
test('repeated stop and start', async () => {
153+
const quicServer = new QUICServer({
154+
crypto: {
155+
key,
156+
ops: serverCryptoOps,
157+
},
158+
config: {
159+
key: keyPairRSAPEM.privateKey,
160+
cert: certRSAPEM,
161+
},
162+
logger: logger.getChild('QUICServer'),
163+
});
164+
socketCleanMethods.extractSocket(quicServer);
165+
await quicServer.start();
166+
// Default to dual-stack
167+
expect(quicServer.host).toBe('::');
168+
expect(typeof quicServer.port).toBe('number');
169+
await quicServer.stop();
170+
await quicServer.start();
171+
// Default to dual-stack
172+
expect(quicServer.host).toBe('::');
173+
expect(typeof quicServer.port).toBe('number');
174+
await quicServer.stop();
175+
})
152176
});
153177
describe('binding to host and port', () => {
154178
test('listen on IPv4', async () => {
@@ -211,7 +235,6 @@ describe(QUICServer.name, () => {
211235
expect(typeof quicServer.port).toBe('number');
212236
await quicServer.stop();
213237
});
214-
// FIXME: this is holding the process open, needs a fix
215238
test('listen on IPv4 mapped IPv6', async () => {
216239
// NOT RECOMMENDED, because send addresses will have to be mapped
217240
// addresses, which means you can ONLY connect to mapped addresses

0 commit comments

Comments
 (0)