]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/shared/live.ts
Add runner server tests
[github/Chocobozzz/PeerTube.git] / server / tests / shared / live.ts
index ff0b2f226f434d66c9ff6f9414dc581aeed50850..31f92ef19a568b5c5396d58d31eba97784b9924a 100644 (file)
@@ -6,6 +6,7 @@ import { join } from 'path'
 import { sha1 } from '@shared/extra-utils'
 import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
 import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
+import { SQLCommand } from './sql-command'
 import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
 
 async function checkLiveCleanup (options: {
@@ -36,8 +37,10 @@ async function checkLiveCleanup (options: {
 
 // ---------------------------------------------------------------------------
 
-async function testVideoResolutions (options: {
+async function testLiveVideoResolutions (options: {
+  sqlCommand: SQLCommand
   originServer: PeerTubeServer
+
   servers: PeerTubeServer[]
   liveVideoId: string
   resolutions: number[]
@@ -48,6 +51,7 @@ async function testVideoResolutions (options: {
 }) {
   const {
     originServer,
+    sqlCommand,
     servers,
     liveVideoId,
     resolutions,
@@ -116,7 +120,7 @@ async function testVideoResolutions (options: {
 
       if (originServer.internalServerNumber === server.internalServerNumber) {
         const infohash = sha1(`${2 + hlsPlaylist.playlistUrl}+V${i}`)
-        const dbInfohashes = await originServer.sql.getPlaylistInfohash(hlsPlaylist.id)
+        const dbInfohashes = await sqlCommand.getPlaylistInfohash(hlsPlaylist.id)
 
         expect(dbInfohashes).to.include(infohash)
       }
@@ -128,7 +132,7 @@ async function testVideoResolutions (options: {
 
 export {
   checkLiveCleanup,
-  testVideoResolutions
+  testLiveVideoResolutions
 }
 
 // ---------------------------------------------------------------------------