From 8d2be0ed7bb87283a1ec98609df6b82d83db706a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Jul 2019 17:23:24 +0200 Subject: WIP plugins: move plugin CLI in peertube script Install/uninstall/list plugins remotely --- shared/extra-utils/server/servers.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'shared/extra-utils/server/servers.ts') 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 @@ import { ChildProcess, exec, fork } from 'child_process' import { join } from 'path' import { root, wait } from '../miscs/miscs' -import { copy, readdir, readFile, remove } from 'fs-extra' +import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' import { existsSync } from 'fs' import { expect } from 'chai' import { VideoChannel } from '../../models/videos' @@ -241,20 +241,22 @@ async function reRunServer (server: ServerInfo, configOverride?: any) { return server } -async function checkTmpIsEmpty (server: ServerInfo) { - return checkDirectoryIsEmpty(server, 'tmp') +function checkTmpIsEmpty (server: ServerInfo) { + return checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css' ]) } -async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) { +async function checkDirectoryIsEmpty (server: ServerInfo, directory: string, exceptions: string[] = []) { const testDirectory = 'test' + server.internalServerNumber const directoryPath = join(root(), testDirectory, directory) - const directoryExists = existsSync(directoryPath) + const directoryExists = await pathExists(directoryPath) expect(directoryExists).to.be.true const files = await readdir(directoryPath) - expect(files).to.have.lengthOf(0) + const filtered = files.filter(f => exceptions.includes(f) === false) + + expect(filtered).to.have.lengthOf(0) } function killallServers (servers: ServerInfo[]) { -- cgit v1.2.3