Introduce experimental telemetry

This commit is contained in:
Chocobozzz
2022-07-05 15:43:21 +02:00
parent 15b43b214e
commit 630d0a1bf5
23 changed files with 1002 additions and 90 deletions

View File

@@ -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
}

View File

@@ -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'

View 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)
}
}