diff options
-rwxr-xr-x | scripts/ci.sh | 12 | ||||
-rwxr-xr-x | scripts/reset-password.ts | 2 | ||||
-rw-r--r-- | server/tests/client.ts | 6 | ||||
-rw-r--r-- | server/tests/misc-endpoints.ts | 14 | ||||
-rw-r--r-- | shared/extra-utils/cli/cli.ts | 2 |
5 files changed, 19 insertions, 17 deletions
diff --git a/scripts/ci.sh b/scripts/ci.sh index 448c1c91f..bf34cd337 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh | |||
@@ -20,7 +20,7 @@ runTest () { | |||
20 | 20 | ||
21 | echo $files | 21 | echo $files |
22 | 22 | ||
23 | MOCHA_PARALLEL=true parallel -t -j $jobs --retries $retries \ | 23 | parallel -t -j $jobs --retries $retries \ |
24 | npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ | 24 | npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ |
25 | ::: $files | 25 | ::: $files |
26 | } | 26 | } |
@@ -35,9 +35,9 @@ if [ "$1" = "misc" ]; then | |||
35 | feedsFiles=$(findTestFiles server/tests/feeds) | 35 | feedsFiles=$(findTestFiles server/tests/feeds) |
36 | helperFiles=$(findTestFiles server/tests/helpers) | 36 | helperFiles=$(findTestFiles server/tests/helpers) |
37 | pluginsFiles=$(findTestFiles server/tests/plugins) | 37 | pluginsFiles=$(findTestFiles server/tests/plugins) |
38 | miscFiles=server/tests/client.ts server/tests/misc-endpoints.ts | 38 | miscFiles="server/tests/client.ts server/tests/misc-endpoints.ts" |
39 | 39 | ||
40 | TS_NODE_FILES=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles | 40 | TS_NODE_FILES=true MOCHA_PARALLEL=true runTest 2 $feedsFiles $helperFiles $pluginsFiles $miscFiles |
41 | elif [ "$1" = "cli" ]; then | 41 | elif [ "$1" = "cli" ]; then |
42 | npm run build:server | 42 | npm run build:server |
43 | npm run setup:cli | 43 | npm run setup:cli |
@@ -52,14 +52,14 @@ elif [ "$1" = "api-1" ]; then | |||
52 | notificationsFiles=$(findTestFiles server/tests/api/notifications) | 52 | notificationsFiles=$(findTestFiles server/tests/api/notifications) |
53 | searchFiles=$(findTestFiles server/tests/api/search) | 53 | searchFiles=$(findTestFiles server/tests/api/search) |
54 | 54 | ||
55 | runTest 2 $notificationsFiles $searchFiles $checkParamFiles | 55 | MOCHA_PARALLEL=true runTest 2 $notificationsFiles $searchFiles $checkParamFiles |
56 | elif [ "$1" = "api-2" ]; then | 56 | elif [ "$1" = "api-2" ]; then |
57 | npm run build:server | 57 | npm run build:server |
58 | 58 | ||
59 | serverFiles=$(findTestFiles server/tests/api/server) | 59 | serverFiles=$(findTestFiles server/tests/api/server) |
60 | usersFiles=$(findTestFiles server/tests/api/users) | 60 | usersFiles=$(findTestFiles server/tests/api/users) |
61 | 61 | ||
62 | runTest 2 $serverFiles $usersFiles | 62 | MOCHA_PARALLEL=true runTest 2 $serverFiles $usersFiles |
63 | elif [ "$1" = "api-3" ]; then | 63 | elif [ "$1" = "api-3" ]; then |
64 | npm run build:server | 64 | npm run build:server |
65 | 65 | ||
@@ -73,7 +73,7 @@ elif [ "$1" = "api-4" ]; then | |||
73 | redundancyFiles=$(findTestFiles server/tests/api/redundancy) | 73 | redundancyFiles=$(findTestFiles server/tests/api/redundancy) |
74 | activitypubFiles=$(findTestFiles server/tests/api/activitypub) | 74 | activitypubFiles=$(findTestFiles server/tests/api/activitypub) |
75 | 75 | ||
76 | TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles | 76 | MOCHA_PARALLEL=true TS_NODE_FILES=true runTest 2 $activitypubFiles $redundancyFiles $activitypubFiles |
77 | elif [ "$1" = "external-plugins" ]; then | 77 | elif [ "$1" = "external-plugins" ]; then |
78 | npm run build:server | 78 | npm run build:server |
79 | 79 | ||
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index bf6535cea..6372095d6 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts | |||
@@ -21,7 +21,7 @@ initDatabaseModels(true) | |||
21 | }) | 21 | }) |
22 | .then(user => { | 22 | .then(user => { |
23 | if (!user) { | 23 | if (!user) { |
24 | console.error('User unknown.') | 24 | console.error('Unknown user.') |
25 | process.exit(-1) | 25 | process.exit(-1) |
26 | } | 26 | } |
27 | 27 | ||
diff --git a/server/tests/client.ts b/server/tests/client.ts index 648d46414..2d8468c06 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -163,8 +163,10 @@ describe('Test a client controllers', function () { | |||
163 | .set('Accept', 'text/html') | 163 | .set('Accept', 'text/html') |
164 | .expect(200) | 164 | .expect(200) |
165 | 165 | ||
166 | const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:9001/services/oembed?' + | 166 | const port = server.port |
167 | `url=http%3A%2F%2Flocalhost%3A9001%2Fvideos%2Fwatch%2F${server.video.uuid}" ` + | 167 | |
168 | const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' + | ||
169 | `url=http%3A%2F%2Flocalhost%3A${port}%2Fvideos%2Fwatch%2F${server.video.uuid}" ` + | ||
168 | `title="${server.video.name}" />` | 170 | `title="${server.video.name}" />` |
169 | 171 | ||
170 | expect(res.text).to.contain(expectedLink) | 172 | expect(res.text).to.contain(expectedLink) |
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 32b035c9e..3d0224323 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts | |||
@@ -122,7 +122,7 @@ describe('Test misc endpoints', function () { | |||
122 | }) | 122 | }) |
123 | 123 | ||
124 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 124 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
125 | expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>') | 125 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>') |
126 | }) | 126 | }) |
127 | 127 | ||
128 | it('Should get the empty cached sitemap', async function () { | 128 | it('Should get the empty cached sitemap', async function () { |
@@ -133,7 +133,7 @@ describe('Test misc endpoints', function () { | |||
133 | }) | 133 | }) |
134 | 134 | ||
135 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 135 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
136 | expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>') | 136 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>') |
137 | }) | 137 | }) |
138 | 138 | ||
139 | it('Should add videos, channel and accounts and get sitemap', async function () { | 139 | it('Should add videos, channel and accounts and get sitemap', async function () { |
@@ -156,17 +156,17 @@ describe('Test misc endpoints', function () { | |||
156 | }) | 156 | }) |
157 | 157 | ||
158 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 158 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
159 | expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>') | 159 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>') |
160 | 160 | ||
161 | expect(res.text).to.contain('<video:title>video 1</video:title>') | 161 | expect(res.text).to.contain('<video:title>video 1</video:title>') |
162 | expect(res.text).to.contain('<video:title>video 2</video:title>') | 162 | expect(res.text).to.contain('<video:title>video 2</video:title>') |
163 | expect(res.text).to.not.contain('<video:title>video 3</video:title>') | 163 | expect(res.text).to.not.contain('<video:title>video 3</video:title>') |
164 | 164 | ||
165 | expect(res.text).to.contain('<url><loc>http://localhost:9001/video-channels/channel1</loc></url>') | 165 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel1</loc></url>') |
166 | expect(res.text).to.contain('<url><loc>http://localhost:9001/video-channels/channel2</loc></url>') | 166 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel2</loc></url>') |
167 | 167 | ||
168 | expect(res.text).to.contain('<url><loc>http://localhost:9001/accounts/user1</loc></url>') | 168 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user1</loc></url>') |
169 | expect(res.text).to.contain('<url><loc>http://localhost:9001/accounts/user2</loc></url>') | 169 | expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user2</loc></url>') |
170 | }) | 170 | }) |
171 | }) | 171 | }) |
172 | 172 | ||
diff --git a/shared/extra-utils/cli/cli.ts b/shared/extra-utils/cli/cli.ts index 54d05e9c6..c62e170bb 100644 --- a/shared/extra-utils/cli/cli.ts +++ b/shared/extra-utils/cli/cli.ts | |||
@@ -3,7 +3,7 @@ import { exec } from 'child_process' | |||
3 | import { ServerInfo } from '../server/servers' | 3 | import { ServerInfo } from '../server/servers' |
4 | 4 | ||
5 | function getEnvCli (server?: ServerInfo) { | 5 | function getEnvCli (server?: ServerInfo) { |
6 | return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}` | 6 | return `NODE_ENV=test NODE_APP_INSTANCE=${server.internalServerNumber}` |
7 | } | 7 | } |
8 | 8 | ||
9 | async function execCLI (command: string) { | 9 | async function execCLI (command: string) { |