})
after(async function () {
- mockObjectStorage.terminate()
+ await mockObjectStorage.terminate()
await cleanupTests(servers)
})
playlistBucket: 'mybucket',
webtorrentBucket: 'mybucket',
- playlistPrefix: 'streaming-playlists_',
- webtorrentPrefix: 'webtorrent_',
+ playlistPrefix: 'streaming-playlists/',
+ webtorrentPrefix: 'webtorrent/',
useMockBaseUrl: true
})
})
after(async function () {
- proxy.terminate()
+ await proxy.terminate()
await cleanupTests(servers)
})
import { pipeline } from 'stream'
import { randomInt } from '@shared/core-utils'
import { ObjectStorageCommand } from '../server'
+import { terminateServer } from './utils'
export class MockObjectStorage {
private server: Server
}
terminate () {
- if (this.server) this.server.close()
+ return terminateServer(this.server)
}
}
import express, { Request, Response } from 'express'
import { Server } from 'http'
import { randomInt } from '@shared/core-utils'
+import { terminateServer } from './utils'
type BlocklistResponse = {
data: {
}
terminate () {
- if (this.server) this.server.close()
+ return terminateServer(this.server)
}
}
import { createServer, Server } from 'http'
import proxy from 'proxy'
import { randomInt } from '@shared/core-utils'
+import { terminateServer } from './utils'
class MockProxy {
private server: Server
}
terminate () {
- if (this.server) this.server.close()
+ return terminateServer(this.server)
}
}
--- /dev/null
+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
+}