From 329619b3453479f76c049816b7403b86e9d45cb5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 5 Jul 2021 16:37:50 +0200 Subject: Introduce CLI command --- server/tests/cli/plugins.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 7f19f14b7..efdc20748 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -1,12 +1,11 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { expect } from 'chai' import { cleanupTests, - execCLI, flushAndRunServer, getConfig, - getEnvCli, getPluginTestPath, killallServers, reRunServer, @@ -14,7 +13,6 @@ import { setAccessTokensToServers } from '../../../shared/extra-utils' import { ServerConfig } from '../../../shared/models/server' -import { expect } from 'chai' describe('Test plugin scripts', function () { let server: ServerInfo @@ -31,15 +29,13 @@ describe('Test plugin scripts', function () { const packagePath = getPluginTestPath() - const env = getEnvCli(server) - await execCLI(`${env} npm run plugin:install -- --plugin-path ${packagePath}`) + await server.cliCommand.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) }) it('Should install a theme from stateless CLI', async function () { this.timeout(60000) - const env = getEnvCli(server) - await execCLI(`${env} npm run plugin:install -- --npm-name peertube-theme-background-red`) + await server.cliCommand.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`) }) it('Should have the theme and the plugin registered when we restart peertube', async function () { @@ -63,8 +59,7 @@ describe('Test plugin scripts', function () { it('Should uninstall a plugin from stateless CLI', async function () { this.timeout(60000) - const env = getEnvCli(server) - await execCLI(`${env} npm run plugin:uninstall -- --npm-name peertube-plugin-test`) + await server.cliCommand.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`) }) it('Should have removed the plugin on another peertube restart', async function () { -- cgit v1.2.3 From ae2abfd3aed3e75d39a316b49b914d187faa7475 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Jul 2021 10:33:49 +0200 Subject: Introduce plugins command --- server/tests/cli/plugins.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index efdc20748..7b8746a5d 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -6,8 +6,8 @@ import { cleanupTests, flushAndRunServer, getConfig, - getPluginTestPath, killallServers, + PluginsCommand, reRunServer, ServerInfo, setAccessTokensToServers @@ -27,7 +27,7 @@ describe('Test plugin scripts', function () { it('Should install a plugin from stateless CLI', async function () { this.timeout(60000) - const packagePath = getPluginTestPath() + const packagePath = PluginsCommand.getPluginTestPath() await server.cliCommand.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) }) -- cgit v1.2.3 From 65e6e2602c0d5521f3a6740f7469bb92830ecb53 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Jul 2021 11:51:09 +0200 Subject: Introduce config command --- server/tests/cli/plugins.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 7b8746a5d..e5efae36b 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -5,14 +5,12 @@ import { expect } from 'chai' import { cleanupTests, flushAndRunServer, - getConfig, killallServers, PluginsCommand, reRunServer, ServerInfo, setAccessTokensToServers } from '../../../shared/extra-utils' -import { ServerConfig } from '../../../shared/models/server' describe('Test plugin scripts', function () { let server: ServerInfo @@ -44,8 +42,7 @@ describe('Test plugin scripts', function () { killallServers([ server ]) await reRunServer(server) - const res = await getConfig(server.url) - const config: ServerConfig = res.body + const config = await server.configCommand.getConfig() const plugin = config.plugin.registered .find(p => p.name === 'test') @@ -68,8 +65,7 @@ describe('Test plugin scripts', function () { killallServers([ server ]) await reRunServer(server) - const res = await getConfig(server.url) - const config: ServerConfig = res.body + const config = await server.configCommand.getConfig() const plugin = config.plugin.registered .find(p => p.name === 'test') -- cgit v1.2.3 From 9293139fde7091e9badcafa9b570b83cea9a10ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 9 Jul 2021 15:37:43 +0200 Subject: Introduce sql command --- server/tests/cli/plugins.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index e5efae36b..5344bfc96 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -39,7 +39,7 @@ describe('Test plugin scripts', function () { it('Should have the theme and the plugin registered when we restart peertube', async function () { this.timeout(30000) - killallServers([ server ]) + await killallServers([ server ]) await reRunServer(server) const config = await server.configCommand.getConfig() @@ -62,7 +62,7 @@ describe('Test plugin scripts', function () { it('Should have removed the plugin on another peertube restart', async function () { this.timeout(30000) - killallServers([ server ]) + await killallServers([ server ]) await reRunServer(server) const config = await server.configCommand.getConfig() -- cgit v1.2.3 From 89d241a79c262b9775c233b73cff080043ebb5e6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 09:04:35 +0200 Subject: Shorter server command names --- server/tests/cli/plugins.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 5344bfc96..178a7a2d9 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -27,13 +27,13 @@ describe('Test plugin scripts', function () { const packagePath = PluginsCommand.getPluginTestPath() - await server.cliCommand.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) + await server.cli.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`) }) it('Should install a theme from stateless CLI', async function () { this.timeout(60000) - await server.cliCommand.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`) + await server.cli.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`) }) it('Should have the theme and the plugin registered when we restart peertube', async function () { @@ -42,7 +42,7 @@ describe('Test plugin scripts', function () { await killallServers([ server ]) await reRunServer(server) - const config = await server.configCommand.getConfig() + const config = await server.config.getConfig() const plugin = config.plugin.registered .find(p => p.name === 'test') @@ -56,7 +56,7 @@ describe('Test plugin scripts', function () { it('Should uninstall a plugin from stateless CLI', async function () { this.timeout(60000) - await server.cliCommand.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`) + await server.cli.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`) }) it('Should have removed the plugin on another peertube restart', async function () { @@ -65,7 +65,7 @@ describe('Test plugin scripts', function () { await killallServers([ server ]) await reRunServer(server) - const config = await server.configCommand.getConfig() + const config = await server.config.getConfig() const plugin = config.plugin.registered .find(p => p.name === 'test') -- cgit v1.2.3 From 254d3579f5338f5fd775c17d15cdfc37078bcfb4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 09:47:51 +0200 Subject: Use an object to represent a server --- server/tests/cli/plugins.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 178a7a2d9..42651d79c 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -4,21 +4,20 @@ import 'mocha' import { expect } from 'chai' import { cleanupTests, - flushAndRunServer, + createSingleServer, killallServers, PluginsCommand, - reRunServer, - ServerInfo, + PeerTubeServer, setAccessTokensToServers } from '../../../shared/extra-utils' describe('Test plugin scripts', function () { - let server: ServerInfo + let server: PeerTubeServer before(async function () { this.timeout(30000) - server = await flushAndRunServer(1) + server = await createSingleServer(1) await setAccessTokensToServers([ server ]) }) @@ -40,7 +39,7 @@ describe('Test plugin scripts', function () { this.timeout(30000) await killallServers([ server ]) - await reRunServer(server) + await server.run() const config = await server.config.getConfig() @@ -63,7 +62,7 @@ describe('Test plugin scripts', function () { this.timeout(30000) await killallServers([ server ]) - await reRunServer(server) + await server.run() const config = await server.config.getConfig() -- cgit v1.2.3 From 4c7e60bc17ee5830399bac4aa273356903421b4c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 14:27:30 +0200 Subject: Reorganize imports --- server/tests/cli/plugins.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/tests/cli/plugins.ts') diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 42651d79c..07c78cc89 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts @@ -6,8 +6,8 @@ import { cleanupTests, createSingleServer, killallServers, - PluginsCommand, PeerTubeServer, + PluginsCommand, setAccessTokensToServers } from '../../../shared/extra-utils' -- cgit v1.2.3