diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-09 15:37:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 9293139fde7091e9badcafa9b570b83cea9a10ad (patch) | |
tree | 9728412f02af4aa59d2c016db47624251e8f6be6 /shared/extra-utils/server | |
parent | 078f17e6d90376050f43ce639e88e11869b49ee7 (diff) | |
download | PeerTube-9293139fde7091e9badcafa9b570b83cea9a10ad.tar.gz PeerTube-9293139fde7091e9badcafa9b570b83cea9a10ad.tar.zst PeerTube-9293139fde7091e9badcafa9b570b83cea9a10ad.zip |
Introduce sql command
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r-- | shared/extra-utils/server/servers.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index 41b48a8ee..bd3be8373 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -30,6 +30,7 @@ import { | |||
30 | ServicesCommand, | 30 | ServicesCommand, |
31 | StreamingPlaylistsCommand | 31 | StreamingPlaylistsCommand |
32 | } from '../videos' | 32 | } from '../videos' |
33 | import { SQLCommand } from '../miscs' | ||
33 | import { CommentsCommand } from '../videos/comments-command' | 34 | import { CommentsCommand } from '../videos/comments-command' |
34 | import { ConfigCommand } from './config-command' | 35 | import { ConfigCommand } from './config-command' |
35 | import { ContactFormCommand } from './contact-form-command' | 36 | import { ContactFormCommand } from './contact-form-command' |
@@ -123,6 +124,7 @@ interface ServerInfo { | |||
123 | streamingPlaylistsCommand?: StreamingPlaylistsCommand | 124 | streamingPlaylistsCommand?: StreamingPlaylistsCommand |
124 | channelsCommand?: ChannelsCommand | 125 | channelsCommand?: ChannelsCommand |
125 | commentsCommand?: CommentsCommand | 126 | commentsCommand?: CommentsCommand |
127 | sqlCommand?: SQLCommand | ||
126 | } | 128 | } |
127 | 129 | ||
128 | function parallelTests () { | 130 | function parallelTests () { |
@@ -367,6 +369,7 @@ function assignCommands (server: ServerInfo) { | |||
367 | server.streamingPlaylistsCommand = new StreamingPlaylistsCommand(server) | 369 | server.streamingPlaylistsCommand = new StreamingPlaylistsCommand(server) |
368 | server.channelsCommand = new ChannelsCommand(server) | 370 | server.channelsCommand = new ChannelsCommand(server) |
369 | server.commentsCommand = new CommentsCommand(server) | 371 | server.commentsCommand = new CommentsCommand(server) |
372 | server.sqlCommand = new SQLCommand(server) | ||
370 | } | 373 | } |
371 | 374 | ||
372 | async function reRunServer (server: ServerInfo, configOverride?: any) { | 375 | async function reRunServer (server: ServerInfo, configOverride?: any) { |
@@ -398,17 +401,20 @@ async function checkDirectoryIsEmpty (server: ServerInfo, directory: string, exc | |||
398 | expect(filtered).to.have.lengthOf(0) | 401 | expect(filtered).to.have.lengthOf(0) |
399 | } | 402 | } |
400 | 403 | ||
401 | function killallServers (servers: ServerInfo[]) { | 404 | async function killallServers (servers: ServerInfo[]) { |
402 | for (const server of servers) { | 405 | for (const server of servers) { |
403 | if (!server.app) continue | 406 | if (!server.app) continue |
404 | 407 | ||
408 | await server.sqlCommand.cleanup() | ||
409 | |||
405 | process.kill(-server.app.pid) | 410 | process.kill(-server.app.pid) |
411 | |||
406 | server.app = null | 412 | server.app = null |
407 | } | 413 | } |
408 | } | 414 | } |
409 | 415 | ||
410 | async function cleanupTests (servers: ServerInfo[]) { | 416 | async function cleanupTests (servers: ServerInfo[]) { |
411 | killallServers(servers) | 417 | await killallServers(servers) |
412 | 418 | ||
413 | if (isGithubCI()) { | 419 | if (isGithubCI()) { |
414 | await ensureDir('artifacts') | 420 | await ensureDir('artifacts') |