ActivityPub-federated video streaming platform using P2P directly in your web browser
Wait mock server termination
Chocobozzz70430c2796b6
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.tsindex 6c9c224eb3..6e63921816 100644--- a/server/tests/api/object-storage/videos.ts+++ b/server/tests/api/object-storage/videos.ts@@ -243,7 +243,7 @@ function runTestSuite (options: {})after(async function () {- mockObjectStorage.terminate()+ await mockObjectStorage.terminate()await cleanupTests(servers)})@@ -380,8 +380,8 @@ describe('Object storage for videos', function () {playlistBucket: 'mybucket',webtorrentBucket: 'mybucket',- playlistPrefix: 'streaming-playlists_',- webtorrentPrefix: 'webtorrent_',+ playlistPrefix: 'streaming-playlists/',+ webtorrentPrefix: 'webtorrent/',useMockBaseUrl: true})diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.tsindex d5042ef27b..72bd49078d 100644--- a/server/tests/api/server/proxy.ts+++ b/server/tests/api/server/proxy.ts@@ -65,7 +65,7 @@ describe('Test proxy', function () {})after(async function () {- proxy.terminate()+ await proxy.terminate()await cleanupTests(servers)})diff --git a/shared/extra-utils/mock-servers/mock-object-storage.ts b/shared/extra-utils/mock-servers/mock-object-storage.tsindex f1c5a61238..b6071b2f29 100644--- a/shared/extra-utils/mock-servers/mock-object-storage.ts+++ b/shared/extra-utils/mock-servers/mock-object-storage.ts@@ -4,6 +4,7 @@ import { Server } from 'http'import { pipeline } from 'stream'import { randomInt } from '@shared/core-utils'import { ObjectStorageCommand } from '../server'+import { terminateServer } from './utils'export class MockObjectStorage {private server: Server@@ -37,6 +38,6 @@ export class MockObjectStorage {}terminate () {- if (this.server) this.server.close()+ return terminateServer(this.server)}}diff --git a/shared/extra-utils/mock-servers/mock-plugin-blocklist.ts b/shared/extra-utils/mock-servers/mock-plugin-blocklist.tsindex 6f66bf4f0e..6a71532b58 100644--- a/shared/extra-utils/mock-servers/mock-plugin-blocklist.ts+++ b/shared/extra-utils/mock-servers/mock-plugin-blocklist.ts@@ -1,6 +1,7 @@import express, { Request, Response } from 'express'import { Server } from 'http'import { randomInt } from '@shared/core-utils'+import { terminateServer } from './utils'type BlocklistResponse = {data: {@@ -32,6 +33,6 @@ export class MockBlocklist {}terminate () {- if (this.server) this.server.close()+ return terminateServer(this.server)}}diff --git a/shared/extra-utils/mock-servers/mock-proxy.ts b/shared/extra-utils/mock-servers/mock-proxy.tsindex eb5f177c71..f955d3f9ef 100644--- a/shared/extra-utils/mock-servers/mock-proxy.ts+++ b/shared/extra-utils/mock-servers/mock-proxy.ts@@ -2,6 +2,7 @@import { createServer, Server } from 'http'import proxy from 'proxy'import { randomInt } from '@shared/core-utils'+import { terminateServer } from './utils'class MockProxy {private server: Server@@ -16,7 +17,7 @@ class MockProxy {}terminate () {- if (this.server) this.server.close()+ return terminateServer(this.server)}}diff --git a/shared/extra-utils/mock-servers/utils.ts b/shared/extra-utils/mock-servers/utils.tsnew file mode 100644index 0000000000..64d94c8688--- /dev/null+++ b/shared/extra-utils/mock-servers/utils.ts@@ -0,0 +1,17 @@+import { Server } from 'http'++function terminateServer (server: Server) {+ if (!server) return Promise.resolve()++ return new Promise<void>((res, rej) => {+ server.close(err => {+ if (err) return rej(err)++ return res()+ })+ })+}++export {+ terminateServer+}