diff --git a/services/web/app/src/infrastructure/Server.js b/services/web/app/src/infrastructure/Server.js index 5768113ed4..c28d26a684 100644 --- a/services/web/app/src/infrastructure/Server.js +++ b/services/web/app/src/infrastructure/Server.js @@ -303,7 +303,15 @@ if (Settings.csp && Settings.csp.enabled) { } logger.debug('creating HTTP server'.yellow) -const server = require('http').createServer(app) +const server = require('http').createServer( + process.env.NODE_ENV === 'test' + ? { + // Workaround broken detection of idle connections in CI. + connectionsCheckingInterval: 30 * 60 * 1000, + } + : {}, + app +) // provide settings for separate web and api processes if (Settings.enabledServices.includes('api')) { diff --git a/services/web/test/acceptance/src/LinkedFilesTests.js b/services/web/test/acceptance/src/LinkedFilesTests.js index 155bfab0fb..62a4255315 100644 --- a/services/web/test/acceptance/src/LinkedFilesTests.js +++ b/services/web/test/acceptance/src/LinkedFilesTests.js @@ -9,6 +9,7 @@ const express = require('express') const { plainTextResponse, } = require('../../../app/src/infrastructure/Response') +const http = require('http') const LinkedUrlProxy = express() LinkedUrlProxy.get('/', (req, res, next) => { if (req.query.url === 'http://example.com/foo') { @@ -29,7 +30,15 @@ describe('LinkedFiles', function () { let server before(function (done) { - server = LinkedUrlProxy.listen(6543, done) + server = http + .createServer( + { + // Workaround broken detection of idle connections in CI. + connectionsCheckingInterval: 30 * 60 * 1000, + }, + LinkedUrlProxy + ) + .listen(6543, done) }) after(function (done) { server.close(done) diff --git a/services/web/test/acceptance/src/mocks/AbstractMockApi.js b/services/web/test/acceptance/src/mocks/AbstractMockApi.js index 780a49bb5f..b77d69857f 100644 --- a/services/web/test/acceptance/src/mocks/AbstractMockApi.js +++ b/services/web/test/acceptance/src/mocks/AbstractMockApi.js @@ -1,6 +1,7 @@ const OError = require('@overleaf/o-error') const express = require('express') const bodyParser = require('body-parser') +const http = require('http') /** * Abstract class for running a mock API via Express. Handles setting up of @@ -139,7 +140,14 @@ class AbstractMockApi { // eslint-disable-next-line no-console console.log('Starting mock on port', this.constructor.name, this.port) } - this.server = this.app + this.server = http + .createServer( + { + // Workaround broken detection of idle connections in CI. + connectionsCheckingInterval: 30 * 60 * 1000, + }, + this.app + ) .listen(this.port, err => { if (err) { return reject(err)