diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-10 16:38:12 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-14 09:11:27 +0100 |
commit | 34caef7fc0710623c6894549423813d53f65b303 (patch) | |
tree | cadfce6e39ea0712ed556e8dc7ba3c64ea36e158 | |
parent | 12554857b410506b9e748bb0deac09d3e7393963 (diff) | |
download | PeerTube-34caef7fc0710623c6894549423813d53f65b303.tar.gz PeerTube-34caef7fc0710623c6894549423813d53f65b303.tar.zst PeerTube-34caef7fc0710623c6894549423813d53f65b303.zip |
Add joblog at the end of ci
-rw-r--r-- | .github/workflows/test.yml | 3 | ||||
-rwxr-xr-x | scripts/ci.sh | 8 | ||||
-rw-r--r-- | server/controllers/api/search.ts | 8 | ||||
-rw-r--r-- | server/tests/api/live/live.ts | 2 | ||||
-rw-r--r-- | server/tests/api/notifications/moderation-notifications.ts | 4 | ||||
-rw-r--r-- | server/tests/api/search/search-index.ts | 6 | ||||
-rw-r--r-- | shared/core-utils/miscs/miscs.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/search/videos.ts | 4 |
8 files changed, 20 insertions, 16 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76fe5d6e3..f942dfa2b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -97,7 +97,8 @@ jobs: | |||
97 | 97 | ||
98 | - name: Display errors | 98 | - name: Display errors |
99 | run: | | 99 | run: | |
100 | NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log | 100 | (test -f dist/scripts/parse-log.js && NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log) || \ |
101 | echo "parse-log.js script does not exist, skipping." | ||
101 | 102 | ||
102 | - name: Upload logs | 103 | - name: Upload logs |
103 | uses: actions/upload-artifact@v2 | 104 | uses: actions/upload-artifact@v2 |
diff --git a/scripts/ci.sh b/scripts/ci.sh index 84254cbc0..dd4c28356 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh | |||
@@ -27,16 +27,16 @@ runTest () { | |||
27 | 27 | ||
28 | joblog="$jobname-ci.log" | 28 | joblog="$jobname-ci.log" |
29 | 29 | ||
30 | parallel -t -j $jobs --retries $retries --joblog "$joblog" \ | 30 | parallel -j $jobs \ |
31 | npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \ | 31 | "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail {}" \ |
32 | ::: $files | 32 | ::: $files |
33 | 33 | ||
34 | cat "$joblog" | 34 | cat "$joblog" | uniq -c |
35 | rm "$joblog" | 35 | rm "$joblog" |
36 | } | 36 | } |
37 | 37 | ||
38 | findTestFiles () { | 38 | findTestFiles () { |
39 | find $1 -type f -name "*.ts" | grep -v index.ts | xargs echo | 39 | find $1 -type f -name "*.ts" | grep -v "/index.ts" | xargs echo |
40 | } | 40 | } |
41 | 41 | ||
42 | if [ "$1" = "misc" ]; then | 42 | if [ "$1" = "misc" ]; then |
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 353fd171b..7e1b7b230 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts | |||
@@ -85,8 +85,6 @@ function searchVideoChannels (req: express.Request, res: express.Response) { | |||
85 | } | 85 | } |
86 | 86 | ||
87 | async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: express.Response) { | 87 | async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: express.Response) { |
88 | logger.debug('Doing channels search on search index.') | ||
89 | |||
90 | const result = await buildMutedForSearchIndex(res) | 88 | const result = await buildMutedForSearchIndex(res) |
91 | 89 | ||
92 | const body = Object.assign(query, result) | 90 | const body = Object.assign(query, result) |
@@ -94,6 +92,8 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e | |||
94 | const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/video-channels' | 92 | const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/video-channels' |
95 | 93 | ||
96 | try { | 94 | try { |
95 | logger.debug('Doing video channels search index request on %s.', url, { body }) | ||
96 | |||
97 | const searchIndexResult = await doRequest<ResultList<VideoChannel>>({ uri: url, body, json: true }) | 97 | const searchIndexResult = await doRequest<ResultList<VideoChannel>>({ uri: url, body, json: true }) |
98 | 98 | ||
99 | return res.json(searchIndexResult.body) | 99 | return res.json(searchIndexResult.body) |
@@ -166,8 +166,6 @@ function searchVideos (req: express.Request, res: express.Response) { | |||
166 | } | 166 | } |
167 | 167 | ||
168 | async function searchVideosIndex (query: VideosSearchQuery, res: express.Response) { | 168 | async function searchVideosIndex (query: VideosSearchQuery, res: express.Response) { |
169 | logger.debug('Doing videos search on search index.') | ||
170 | |||
171 | const result = await buildMutedForSearchIndex(res) | 169 | const result = await buildMutedForSearchIndex(res) |
172 | 170 | ||
173 | const body: VideosSearchQuery = Object.assign(query, result) | 171 | const body: VideosSearchQuery = Object.assign(query, result) |
@@ -186,6 +184,8 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons | |||
186 | const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/videos' | 184 | const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/videos' |
187 | 185 | ||
188 | try { | 186 | try { |
187 | logger.debug('Doing videos search index request on %s.', url, { body }) | ||
188 | |||
189 | const searchIndexResult = await doRequest<ResultList<Video>>({ uri: url, body, json: true }) | 189 | const searchIndexResult = await doRequest<ResultList<Video>>({ uri: url, body, json: true }) |
190 | 190 | ||
191 | return res.json(searchIndexResult.body) | 191 | return res.json(searchIndexResult.body) |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 6a1f6e759..918792081 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -413,6 +413,8 @@ describe('Test live', function () { | |||
413 | await testVideoResolutions(liveVideoId, resolutions) | 413 | await testVideoResolutions(liveVideoId, resolutions) |
414 | 414 | ||
415 | await stopFfmpeg(command) | 415 | await stopFfmpeg(command) |
416 | await waitUntilLiveEnded(servers[0].url, servers[0].accessToken, liveVideoId) | ||
417 | |||
416 | await waitJobs(servers) | 418 | await waitJobs(servers) |
417 | 419 | ||
418 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) | 420 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) |
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index e7aa5d987..24c91a365 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts | |||
@@ -502,7 +502,7 @@ describe('Test moderation notifications', function () { | |||
502 | }) | 502 | }) |
503 | 503 | ||
504 | it('Should send notification to moderators on new video with auto-blacklist', async function () { | 504 | it('Should send notification to moderators on new video with auto-blacklist', async function () { |
505 | this.timeout(20000) | 505 | this.timeout(40000) |
506 | 506 | ||
507 | videoName = 'video with auto-blacklist ' + uuidv4() | 507 | videoName = 'video with auto-blacklist ' + uuidv4() |
508 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName }) | 508 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName }) |
@@ -525,7 +525,7 @@ describe('Test moderation notifications', function () { | |||
525 | }) | 525 | }) |
526 | 526 | ||
527 | it('Should send video published and unblacklist after video unblacklisted', async function () { | 527 | it('Should send video published and unblacklist after video unblacklisted', async function () { |
528 | this.timeout(20000) | 528 | this.timeout(40000) |
529 | 529 | ||
530 | await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoUUID) | 530 | await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoUUID) |
531 | 531 | ||
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index 40065d162..849a8a893 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts | |||
@@ -105,7 +105,7 @@ describe('Test videos search', function () { | |||
105 | describe('Videos search', async function () { | 105 | describe('Videos search', async function () { |
106 | 106 | ||
107 | it('Should make a simple search and not have results', async function () { | 107 | it('Should make a simple search and not have results', async function () { |
108 | const res = await searchVideo(server.url, 'a'.repeat(500)) | 108 | const res = await searchVideo(server.url, 'djidane'.repeat(50)) |
109 | 109 | ||
110 | expect(res.body.total).to.equal(0) | 110 | expect(res.body.total).to.equal(0) |
111 | expect(res.body.data).to.have.lengthOf(0) | 111 | expect(res.body.data).to.have.lengthOf(0) |
@@ -216,7 +216,7 @@ describe('Test videos search', function () { | |||
216 | { | 216 | { |
217 | await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) | 217 | await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) |
218 | 218 | ||
219 | const res = await searchVideo(server.url, 'NSFW search index') | 219 | const res = await searchVideo(server.url, 'NSFW search index', '-match') |
220 | const video = res.body.data[0] as Video | 220 | const video = res.body.data[0] as Video |
221 | 221 | ||
222 | expect(res.body.data).to.have.length.greaterThan(0) | 222 | expect(res.body.data).to.have.length.greaterThan(0) |
@@ -228,7 +228,7 @@ describe('Test videos search', function () { | |||
228 | { | 228 | { |
229 | await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) | 229 | await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) |
230 | 230 | ||
231 | const res = await searchVideo(server.url, 'NSFW search index') | 231 | const res = await searchVideo(server.url, 'NSFW search index', '-match') |
232 | 232 | ||
233 | try { | 233 | try { |
234 | expect(res.body.data).to.have.lengthOf(0) | 234 | expect(res.body.data).to.have.lengthOf(0) |
diff --git a/shared/core-utils/miscs/miscs.ts b/shared/core-utils/miscs/miscs.ts index 1eee22d82..71703faac 100644 --- a/shared/core-utils/miscs/miscs.ts +++ b/shared/core-utils/miscs/miscs.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | // high excluded | ||
1 | function randomInt (low: number, high: number) { | 2 | function randomInt (low: number, high: number) { |
2 | return Math.floor(Math.random() * (high - low) + low) | 3 | return Math.floor(Math.random() * (high - low) + low) |
3 | } | 4 | } |
diff --git a/shared/extra-utils/search/videos.ts b/shared/extra-utils/search/videos.ts index ac65357e3..db6edbd58 100644 --- a/shared/extra-utils/search/videos.ts +++ b/shared/extra-utils/search/videos.ts | |||
@@ -5,10 +5,10 @@ import { VideosSearchQuery } from '../../models/search' | |||
5 | import { immutableAssign } from '../miscs/miscs' | 5 | import { immutableAssign } from '../miscs/miscs' |
6 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
7 | 7 | ||
8 | function searchVideo (url: string, search: string) { | 8 | function searchVideo (url: string, search: string, sort = '-publishedAt') { |
9 | const path = '/api/v1/search/videos' | 9 | const path = '/api/v1/search/videos' |
10 | 10 | ||
11 | const query = { sort: '-publishedAt', search: search } | 11 | const query = { sort, search: search } |
12 | const req = request(url) | 12 | const req = request(url) |
13 | .get(path) | 13 | .get(path) |
14 | .query(query) | 14 | .query(query) |