diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-11 17:23:24 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 8d2be0ed7bb87283a1ec98609df6b82d83db706a (patch) | |
tree | 31a36b252df32be83ceb77658a53b57f9d15e8ac /shared/extra-utils/server/servers.ts | |
parent | dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 (diff) | |
download | PeerTube-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.ts | 14 |
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 @@ | |||
3 | import { ChildProcess, exec, fork } from 'child_process' | 3 | import { ChildProcess, exec, fork } from 'child_process' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { root, wait } from '../miscs/miscs' | 5 | import { root, wait } from '../miscs/miscs' |
6 | import { copy, readdir, readFile, remove } from 'fs-extra' | 6 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' |
7 | import { existsSync } from 'fs' | 7 | import { existsSync } from 'fs' |
8 | import { expect } from 'chai' | 8 | import { expect } from 'chai' |
9 | import { VideoChannel } from '../../models/videos' | 9 | import { 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 | ||
244 | async function checkTmpIsEmpty (server: ServerInfo) { | 244 | function checkTmpIsEmpty (server: ServerInfo) { |
245 | return checkDirectoryIsEmpty(server, 'tmp') | 245 | return checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css' ]) |
246 | } | 246 | } |
247 | 247 | ||
248 | async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) { | 248 | async 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 | ||
260 | function killallServers (servers: ServerInfo[]) { | 262 | function killallServers (servers: ServerInfo[]) { |