in dev-utils/test-servers.js [85:120]
function startTestServers(path = join(__dirname, '../'), port = 8000) {
const app = express()
const staticPath = path
app.get('/healthcheck', function (req, res) {
res.send('OK')
})
app.get('/run_integration_test', async function (req, res) {
const echo = req.query.echo
try {
const result = await runIntegrationTest(
`http://localhost:${port}/test/e2e/general-usecase/`
)
if (echo) {
return res.send(echo)
}
res.send(result)
} catch (err) {
/**
* This implies a failure in running the Integration test and we
* return 500 instead of success status code 200
*/
res.status(500).send(err.message)
}
})
app.use(express.static(staticPath), serveIndex(staticPath, { icons: false }))
const staticServer = app.listen(port)
console.log('[Static Server] - serving on: ', staticPath, port)
const backendAgentServer = startBackendAgentServer()
const apmServerProxy = startApmServerProxy()
return [staticServer, backendAgentServer, apmServerProxy]
}