]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/mock-servers/mock-instances-index.ts
Add support for saving video files to object storage (#4290)
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / mock-servers / mock-instances-index.ts
index 2604eda0363fe22800e8dea34a8120c4da875dd0..c9e33087de4ce693500617d5cde6604634b5a106 100644 (file)
@@ -1,10 +1,11 @@
 import * as express from 'express'
+import { randomInt } from '@shared/core-utils'
 
 export class MockInstancesIndex {
   private readonly indexInstances: { host: string, createdAt: string }[] = []
 
   initialize () {
-    return new Promise<void>(res => {
+    return new Promise<number>(res => {
       const app = express()
 
       app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => {
@@ -28,7 +29,8 @@ export class MockInstancesIndex {
         })
       })
 
-      app.listen(42101, () => res())
+      const port = 42101 + randomInt(1, 100)
+      app.listen(port, () => res(port))
     })
   }