aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/redundancy/redundancy.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-11 09:21:13 +0200
committerChocobozzz <me@florianbigard.com>2023-07-11 09:21:13 +0200
commit784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428 (patch)
tree29c46cfd6344065eb805680ed080cb05592ee1d4 /server/tests/api/redundancy/redundancy.ts
parentc3030e944ad03c7fd7b5d668a2d88ff03e4cdf19 (diff)
downloadPeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.tar.gz
PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.tar.zst
PeerTube-784e2ad5c34bcfef36a3f69e9e9acd7cbb3d6428.zip
Prefer web videos in favour of webtorrent
Diffstat (limited to 'server/tests/api/redundancy/redundancy.ts')
-rw-r--r--server/tests/api/redundancy/redundancy.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 5262c503f..b35059c29 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -43,7 +43,7 @@ async function checkMagnetWebseeds (file: VideoFile, baseWebseeds: string[], ser
43 } 43 }
44} 44}
45 45
46async function createServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebtorrent = true) { 46async function createServers (strategy: VideoRedundancyStrategy | null, additionalParams: any = {}, withWebVideo = true) {
47 const strategies: any[] = [] 47 const strategies: any[] = []
48 48
49 if (strategy !== null) { 49 if (strategy !== null) {
@@ -61,7 +61,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition
61 const config = { 61 const config = {
62 transcoding: { 62 transcoding: {
63 webtorrent: { 63 webtorrent: {
64 enabled: withWebtorrent 64 enabled: withWebVideo
65 }, 65 },
66 hls: { 66 hls: {
67 enabled: true 67 enabled: true
@@ -100,7 +100,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition
100} 100}
101 101
102async function ensureSameFilenames (videoUUID: string) { 102async function ensureSameFilenames (videoUUID: string) {
103 let webtorrentFilenames: string[] 103 let webVideoFilenames: string[]
104 let hlsFilenames: string[] 104 let hlsFilenames: string[]
105 105
106 for (const server of servers) { 106 for (const server of servers) {
@@ -108,17 +108,17 @@ async function ensureSameFilenames (videoUUID: string) {
108 108
109 // Ensure we use the same filenames that the origin 109 // Ensure we use the same filenames that the origin
110 110
111 const localWebtorrentFilenames = video.files.map(f => basename(f.fileUrl)).sort() 111 const localWebVideoFilenames = video.files.map(f => basename(f.fileUrl)).sort()
112 const localHLSFilenames = video.streamingPlaylists[0].files.map(f => basename(f.fileUrl)).sort() 112 const localHLSFilenames = video.streamingPlaylists[0].files.map(f => basename(f.fileUrl)).sort()
113 113
114 if (webtorrentFilenames) expect(webtorrentFilenames).to.deep.equal(localWebtorrentFilenames) 114 if (webVideoFilenames) expect(webVideoFilenames).to.deep.equal(localWebVideoFilenames)
115 else webtorrentFilenames = localWebtorrentFilenames 115 else webVideoFilenames = localWebVideoFilenames
116 116
117 if (hlsFilenames) expect(hlsFilenames).to.deep.equal(localHLSFilenames) 117 if (hlsFilenames) expect(hlsFilenames).to.deep.equal(localHLSFilenames)
118 else hlsFilenames = localHLSFilenames 118 else hlsFilenames = localHLSFilenames
119 } 119 }
120 120
121 return { webtorrentFilenames, hlsFilenames } 121 return { webVideoFilenames, hlsFilenames }
122} 122}
123 123
124async function check1WebSeed (videoUUID?: string) { 124async function check1WebSeed (videoUUID?: string) {
@@ -156,7 +156,7 @@ async function check2Webseeds (videoUUID?: string) {
156 } 156 }
157 } 157 }
158 158
159 const { webtorrentFilenames } = await ensureSameFilenames(videoUUID) 159 const { webVideoFilenames } = await ensureSameFilenames(videoUUID)
160 160
161 const directories = [ 161 const directories = [
162 servers[0].getDirectoryPath('redundancy'), 162 servers[0].getDirectoryPath('redundancy'),
@@ -168,7 +168,7 @@ async function check2Webseeds (videoUUID?: string) {
168 expect(files).to.have.length.at.least(4) 168 expect(files).to.have.length.at.least(4)
169 169
170 // Ensure we files exist on disk 170 // Ensure we files exist on disk
171 expect(files.find(f => webtorrentFilenames.includes(f))).to.exist 171 expect(files.find(f => webVideoFilenames.includes(f))).to.exist
172 } 172 }
173} 173}
174 174