mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Introduce experimental telemetry
This commit is contained in:
@@ -29,6 +29,12 @@ async function expectLogDoesNotContain (server: PeerTubeServer, str: string) {
|
||||
expect(content.toString()).to.not.contain(str)
|
||||
}
|
||||
|
||||
async function expectLogContain (server: PeerTubeServer, str: string) {
|
||||
const content = await server.servers.getLogContent()
|
||||
|
||||
expect(content.toString()).to.contain(str)
|
||||
}
|
||||
|
||||
async function testImage (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') {
|
||||
const res = await makeGetRequest({
|
||||
url,
|
||||
@@ -99,5 +105,6 @@ export {
|
||||
expectNotStartWith,
|
||||
checkBadStartPagination,
|
||||
checkBadCountPagination,
|
||||
checkBadSortPagination
|
||||
checkBadSortPagination,
|
||||
expectLogContain
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from './mock-429'
|
||||
export * from './mock-email'
|
||||
export * from './mock-http'
|
||||
export * from './mock-instances-index'
|
||||
export * from './mock-joinpeertube-versions'
|
||||
export * from './mock-object-storage'
|
||||
|
||||
23
server/tests/shared/mock-servers/mock-http.ts
Normal file
23
server/tests/shared/mock-servers/mock-http.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import express from 'express'
|
||||
import { Server } from 'http'
|
||||
import { getPort, randomListen, terminateServer } from './shared'
|
||||
|
||||
export class MockHTTP {
|
||||
private server: Server
|
||||
|
||||
async initialize () {
|
||||
const app = express()
|
||||
|
||||
app.get('/*', (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
return res.sendStatus(200)
|
||||
})
|
||||
|
||||
this.server = await randomListen(app)
|
||||
|
||||
return getPort(this.server)
|
||||
}
|
||||
|
||||
terminate () {
|
||||
return terminateServer(this.server)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user