aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server/servers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-11 17:23:24 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit8d2be0ed7bb87283a1ec98609df6b82d83db706a (patch)
tree31a36b252df32be83ceb77658a53b57f9d15e8ac /shared/extra-utils/server/servers.ts
parentdba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 (diff)
downloadPeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.tar.gz
PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.tar.zst
PeerTube-8d2be0ed7bb87283a1ec98609df6b82d83db706a.zip
WIP plugins: move plugin CLI in peertube script
Install/uninstall/list plugins remotely
Diffstat (limited to 'shared/extra-utils/server/servers.ts')
-rw-r--r--shared/extra-utils/server/servers.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 4c7d6862a..9167ebe5b 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -3,7 +3,7 @@
3import { ChildProcess, exec, fork } from 'child_process' 3import { ChildProcess, exec, fork } from 'child_process'
4import { join } from 'path' 4import { join } from 'path'
5import { root, wait } from '../miscs/miscs' 5import { root, wait } from '../miscs/miscs'
6import { copy, readdir, readFile, remove } from 'fs-extra' 6import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
7import { existsSync } from 'fs' 7import { existsSync } from 'fs'
8import { expect } from 'chai' 8import { expect } from 'chai'
9import { VideoChannel } from '../../models/videos' 9import { VideoChannel } from '../../models/videos'
@@ -241,20 +241,22 @@ async function reRunServer (server: ServerInfo, configOverride?: any) {
241 return server 241 return server
242} 242}
243 243
244async function checkTmpIsEmpty (server: ServerInfo) { 244function checkTmpIsEmpty (server: ServerInfo) {
245 return checkDirectoryIsEmpty(server, 'tmp') 245 return checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css' ])
246} 246}
247 247
248async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) { 248async function checkDirectoryIsEmpty (server: ServerInfo, directory: string, exceptions: string[] = []) {
249 const testDirectory = 'test' + server.internalServerNumber 249 const testDirectory = 'test' + server.internalServerNumber
250 250
251 const directoryPath = join(root(), testDirectory, directory) 251 const directoryPath = join(root(), testDirectory, directory)
252 252
253 const directoryExists = existsSync(directoryPath) 253 const directoryExists = await pathExists(directoryPath)
254 expect(directoryExists).to.be.true 254 expect(directoryExists).to.be.true
255 255
256 const files = await readdir(directoryPath) 256 const files = await readdir(directoryPath)
257 expect(files).to.have.lengthOf(0) 257 const filtered = files.filter(f => exceptions.includes(f) === false)
258
259 expect(filtered).to.have.lengthOf(0)
258} 260}
259 261
260function killallServers (servers: ServerInfo[]) { 262function killallServers (servers: ServerInfo[]) {