diff --git a/test/parallel/test-https-server-connections-checking-leak.js b/test/parallel/test-https-server-connections-checking-leak.js new file mode 100644 index 00000000000000..423fa29e044420 --- /dev/null +++ b/test/parallel/test-https-server-connections-checking-leak.js @@ -0,0 +1,25 @@ +'use strict'; + +// Flags: --expose-gc + +// Check that creating a server without listening is not leaking resources. + +const common = require('../common'); + +if (!common.hasCrypto) { + common.skip('missing crypto'); +} + +const onGC = require('../common/ongc'); +const Countdown = require('../common/countdown'); + +const https = require('https'); +const max = 100; +const countdown = new Countdown(max, () => {}); + +for (let i = 0; i <= max; i++) { + const server = https.createServer((req, res) => {}); + onGC(server, { ongc: countdown.dec.bind(countdown) }); +} + +global.gc();