aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/mock-servers/mock-instances-index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/mock-servers/mock-instances-index.ts')
-rw-r--r--shared/extra-utils/mock-servers/mock-instances-index.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/shared/extra-utils/mock-servers/mock-instances-index.ts b/shared/extra-utils/mock-servers/mock-instances-index.ts
index 2604eda03..c9e33087d 100644
--- a/shared/extra-utils/mock-servers/mock-instances-index.ts
+++ b/shared/extra-utils/mock-servers/mock-instances-index.ts
@@ -1,10 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2import { randomInt } from '@shared/core-utils'
2 3
3export class MockInstancesIndex { 4export class MockInstancesIndex {
4 private readonly indexInstances: { host: string, createdAt: string }[] = [] 5 private readonly indexInstances: { host: string, createdAt: string }[] = []
5 6
6 initialize () { 7 initialize () {
7 return new Promise<void>(res => { 8 return new Promise<number>(res => {
8 const app = express() 9 const app = express()
9 10
10 app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => { 11 app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => {
@@ -28,7 +29,8 @@ export class MockInstancesIndex {
28 }) 29 })
29 }) 30 })
30 31
31 app.listen(42101, () => res()) 32 const port = 42101 + randomInt(1, 100)
33 app.listen(port, () => res(port))
32 }) 34 })
33 } 35 }
34 36