1
0
Fork 0

Don't run in parallel cli and plugin tests

This commit is contained in:
Chocobozzz 2020-07-30 15:34:00 +02:00 committed by Chocobozzz
parent f0af38e696
commit f4659d73fb
5 changed files with 19 additions and 17 deletions

View file

@ -20,7 +20,7 @@ runTest () {
echo $files
MOCHA_PARALLEL=true parallel -t -j $jobs --retries $retries \
parallel -t -j $jobs --retries $retries \
npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \
::: $files
}
@ -35,9 +35,9 @@ if [ "$1" = "misc" ]; then
feedsFiles=$(findTestFiles server/tests/feeds)
helperFiles=$(findTestFiles server/tests/helpers)
pluginsFiles=$(findTestFiles server/tests/plugins)
miscFiles=server/tests/client.ts server/tests/misc-endpoints.ts
miscFiles="server/tests/client.ts server/tests/misc-endpoints.ts"
TS_NODE_FILES=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles
TS_NODE_FILES=true MOCHA_PARALLEL=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles
elif [ "$1" = "cli" ]; then
npm run build:server
npm run setup:cli
@ -52,14 +52,14 @@ elif [ "$1" = "api-1" ]; then
notificationsFiles=$(findTestFiles server/tests/api/notifications)
searchFiles=$(findTestFiles server/tests/api/search)
runTest 2 $notificationsFiles $searchFiles $checkParamFiles
MOCHA_PARALLEL=true runTest 2 $notificationsFiles $searchFiles $checkParamFiles
elif [ "$1" = "api-2" ]; then
npm run build:server
serverFiles=$(findTestFiles server/tests/api/server)
usersFiles=$(findTestFiles server/tests/api/users)
runTest 2 $serverFiles $usersFiles
MOCHA_PARALLEL=true runTest 2 $serverFiles $usersFiles
elif [ "$1" = "api-3" ]; then
npm run build:server
@ -73,7 +73,7 @@ elif [ "$1" = "api-4" ]; then
redundancyFiles=$(findTestFiles server/tests/api/redundancy)
activitypubFiles=$(findTestFiles server/tests/api/activitypub)
TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles
MOCHA_PARALLEL=true TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles
elif [ "$1" = "external-plugins" ]; then
npm run build:server

View file

@ -21,7 +21,7 @@ initDatabaseModels(true)
})
.then(user => {
if (!user) {
console.error('User unknown.')
console.error('Unknown user.')
process.exit(-1)
}

View file

@ -163,8 +163,10 @@ describe('Test a client controllers', function () {
.set('Accept', 'text/html')
.expect(200)
const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:9001/services/oembed?' +
`url=http%3A%2F%2Flocalhost%3A9001%2Fvideos%2Fwatch%2F${server.video.uuid}" ` +
const port = server.port
const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +
`url=http%3A%2F%2Flocalhost%3A${port}%2Fvideos%2Fwatch%2F${server.video.uuid}" ` +
`title="${server.video.name}" />`
expect(res.text).to.contain(expectedLink)

View file

@ -122,7 +122,7 @@ describe('Test misc endpoints', function () {
})
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')
})
it('Should get the empty cached sitemap', async function () {
@ -133,7 +133,7 @@ describe('Test misc endpoints', function () {
})
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')
})
it('Should add videos, channel and accounts and get sitemap', async function () {
@ -156,17 +156,17 @@ describe('Test misc endpoints', function () {
})
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')
expect(res.text).to.contain('<video:title>video 1</video:title>')
expect(res.text).to.contain('<video:title>video 2</video:title>')
expect(res.text).to.not.contain('<video:title>video 3</video:title>')
expect(res.text).to.contain('<url><loc>http://localhost:9001/video-channels/channel1</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:9001/video-channels/channel2</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel1</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel2</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:9001/accounts/user1</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:9001/accounts/user2</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user1</loc></url>')
expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user2</loc></url>')
})
})

View file

@ -3,7 +3,7 @@ import { exec } from 'child_process'
import { ServerInfo } from '../server/servers'
function getEnvCli (server?: ServerInfo) {
return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}`
return `NODE_ENV=test NODE_APP_INSTANCE=${server.internalServerNumber}`
}
async function execCLI (command: string) {