]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/test-live.ts
Use postgres 10 for tests
[github/Chocobozzz/PeerTube.git] / server / tools / test-live.ts
index 7004e98e88f6602d20607e390009a0c8c667c2b0..27f2a4a92a204fbc9ce7b9041e51f1be105f7d36 100644 (file)
@@ -1,10 +1,10 @@
 import { program } from 'commander'
 import { LiveVideoCreate, VideoPrivacy } from '@shared/models'
 import {
-  flushAndRunServer,
+  createSingleServer,
   killallServers,
   sendRTMPStream,
-  ServerInfo,
+  PeerTubeServer,
   setAccessTokensToServers,
   setDefaultVideoChannel
 } from '../../shared/extra-utils'
@@ -36,7 +36,7 @@ async function run () {
 
   console.log('Starting server.')
 
-  const server = await flushAndRunServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] })
+  const server = await createSingleServer(1, {}, { hideLogs: false, nodeArgs: [ '--inspect' ] })
 
   const cleanup = async () => {
     console.log('Killing server')
@@ -54,19 +54,19 @@ async function run () {
   const attributes: LiveVideoCreate = {
     name: 'live',
     saveReplay: true,
-    channelId: server.videoChannel.id,
+    channelId: server.store.channel.id,
     privacy: VideoPrivacy.PUBLIC
   }
 
   console.log('Creating live.')
 
-  const { uuid: liveVideoUUID } = await server.liveCommand.create({ fields: attributes })
+  const { uuid: liveVideoUUID } = await server.live.create({ fields: attributes })
 
-  const live = await server.liveCommand.get({ videoId: liveVideoUUID })
+  const live = await server.live.get({ videoId: liveVideoUUID })
 
   console.log('Sending RTMP stream.')
 
-  const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey)
+  const ffmpegCommand = sendRTMPStream({ rtmpBaseUrl: live.rtmpUrl, streamKey: live.streamKey })
 
   ffmpegCommand.on('error', err => {
     console.error(err)
@@ -81,8 +81,8 @@ async function run () {
 
 // ----------------------------------------------------------------------------
 
-async function buildConfig (server: ServerInfo, commandType: CommandType) {
-  await server.configCommand.updateCustomSubConfig({
+async function buildConfig (server: PeerTubeServer, commandType: CommandType) {
+  await server.config.updateCustomSubConfig({
     newConfig: {
       instance: {
         customizations: {