]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/logs.ts
Support proxies for PeerTube (#4346)
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / logs.ts
index e7bef5a4ae368932b8d406fec88e26fc3e606621..bcd94dda30618e6310d31c774e372b16d51c4fd3 100644 (file)
@@ -4,11 +4,10 @@ import 'mocha'
 import * as chai from 'chai'
 import {
   cleanupTests,
-  flushAndRunServer,
+  createSingleServer,
   killallServers,
   LogsCommand,
-  reRunServer,
-  ServerInfo,
+  PeerTubeServer,
   setAccessTokensToServers,
   waitJobs
 } from '@shared/extra-utils'
@@ -16,16 +15,16 @@ import {
 const expect = chai.expect
 
 describe('Test logs', function () {
-  let server: ServerInfo
+  let server: PeerTubeServer
   let logsCommand: LogsCommand
 
   before(async function () {
     this.timeout(30000)
 
-    server = await flushAndRunServer(1)
+    server = await createSingleServer(1)
     await setAccessTokensToServers([ server ])
 
-    logsCommand = server.logsCommand
+    logsCommand = server.logs
   })
 
   describe('With the standard log file', function () {
@@ -33,12 +32,12 @@ describe('Test logs', function () {
     it('Should get logs with a start date', async function () {
       this.timeout(20000)
 
-      await server.videosCommand.upload({ attributes: { name: 'video 1' } })
+      await server.videos.upload({ attributes: { name: 'video 1' } })
       await waitJobs([ server ])
 
       const now = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 2' } })
+      await server.videos.upload({ attributes: { name: 'video 2' } })
       await waitJobs([ server ])
 
       const body = await logsCommand.getLogs({ startDate: now })
@@ -51,17 +50,17 @@ describe('Test logs', function () {
     it('Should get logs with an end date', async function () {
       this.timeout(30000)
 
-      await server.videosCommand.upload({ attributes: { name: 'video 3' } })
+      await server.videos.upload({ attributes: { name: 'video 3' } })
       await waitJobs([ server ])
 
       const now1 = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 4' } })
+      await server.videos.upload({ attributes: { name: 'video 4' } })
       await waitJobs([ server ])
 
       const now2 = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 5' } })
+      await server.videos.upload({ attributes: { name: 'video 5' } })
       await waitJobs([ server ])
 
       const body = await logsCommand.getLogs({ startDate: now1, endDate: now2 })
@@ -77,7 +76,7 @@ describe('Test logs', function () {
 
       const now = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 6' } })
+      await server.videos.upload({ attributes: { name: 'video 6' } })
       await waitJobs([ server ])
 
       {
@@ -100,7 +99,7 @@ describe('Test logs', function () {
 
       const now = new Date()
 
-      await server.serversCommand.ping()
+      await server.servers.ping()
 
       const body = await logsCommand.getLogs({ startDate: now, level: 'info' })
       const logsString = JSON.stringify(body)
@@ -113,11 +112,11 @@ describe('Test logs', function () {
 
       await killallServers([ server ])
 
-      await reRunServer(server, { log: { log_ping_requests: false } })
+      await server.run({ log: { log_ping_requests: false } })
 
       const now = new Date()
 
-      await server.serversCommand.ping()
+      await server.servers.ping()
 
       const body = await logsCommand.getLogs({ startDate: now, level: 'info' })
       const logsString = JSON.stringify(body)
@@ -130,12 +129,12 @@ describe('Test logs', function () {
     it('Should get logs with a start date', async function () {
       this.timeout(20000)
 
-      await server.videosCommand.upload({ attributes: { name: 'video 7' } })
+      await server.videos.upload({ attributes: { name: 'video 7' } })
       await waitJobs([ server ])
 
       const now = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 8' } })
+      await server.videos.upload({ attributes: { name: 'video 8' } })
       await waitJobs([ server ])
 
       const body = await logsCommand.getAuditLogs({ startDate: now })
@@ -156,17 +155,17 @@ describe('Test logs', function () {
     it('Should get logs with an end date', async function () {
       this.timeout(30000)
 
-      await server.videosCommand.upload({ attributes: { name: 'video 9' } })
+      await server.videos.upload({ attributes: { name: 'video 9' } })
       await waitJobs([ server ])
 
       const now1 = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 10' } })
+      await server.videos.upload({ attributes: { name: 'video 10' } })
       await waitJobs([ server ])
 
       const now2 = new Date()
 
-      await server.videosCommand.upload({ attributes: { name: 'video 11' } })
+      await server.videos.upload({ attributes: { name: 'video 11' } })
       await waitJobs([ server ])
 
       const body = await logsCommand.getAuditLogs({ startDate: now1, endDate: now2 })