]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add joblog at the end of ci
authorChocobozzz <me@florianbigard.com>
Thu, 10 Dec 2020 15:38:12 +0000 (16:38 +0100)
committerChocobozzz <chocobozzz@cpy.re>
Mon, 14 Dec 2020 08:11:27 +0000 (09:11 +0100)
.github/workflows/test.yml
scripts/ci.sh
server/controllers/api/search.ts
server/tests/api/live/live.ts
server/tests/api/notifications/moderation-notifications.ts
server/tests/api/search/search-index.ts
shared/core-utils/miscs/miscs.ts
shared/extra-utils/search/videos.ts

index 76fe5d6e39640a1163fd84a15755b694c901501a..f942dfa2b45f0406af5388063af6a8dc8a91238f 100644 (file)
@@ -97,7 +97,8 @@ jobs:
 
       - name: Display errors
         run: |
-          NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log
+          (test -f dist/scripts/parse-log.js && NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log) || \
+          echo "parse-log.js script does not exist, skipping."
 
       - name: Upload logs
         uses: actions/upload-artifact@v2
index 84254cbc047b09f2a1ef5dbc352d8cf7f9e09b8d..dd4c283565662a3d8d43a587fcea21bbb3344c4c 100755 (executable)
@@ -27,16 +27,16 @@ runTest () {
 
     joblog="$jobname-ci.log"
 
-    parallel -t -j $jobs --retries $retries --joblog "$joblog" \
-        npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail \
+    parallel -j $jobs  \
+        "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ts-node/register --require tsconfig-paths/register --bail {}" \
         ::: $files
 
-    cat "$joblog"
+    cat "$joblog" | uniq -c
     rm "$joblog"
 }
 
 findTestFiles () {
-    find $1 -type f -name "*.ts" | grep -v index.ts | xargs echo
+    find $1 -type f -name "*.ts" | grep -v "/index.ts" | xargs echo
 }
 
 if [ "$1" = "misc" ]; then
index 353fd171b33826fe777d0fb7686fcbbba2deac6e..7e1b7b230b9ec9381a9917e967de982350a53301 100644 (file)
@@ -85,8 +85,6 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
 }
 
 async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: express.Response) {
-  logger.debug('Doing channels search on search index.')
-
   const result = await buildMutedForSearchIndex(res)
 
   const body = Object.assign(query, result)
@@ -94,6 +92,8 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e
   const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/video-channels'
 
   try {
+    logger.debug('Doing video channels search index request on %s.', url, { body })
+
     const searchIndexResult = await doRequest<ResultList<VideoChannel>>({ uri: url, body, json: true })
 
     return res.json(searchIndexResult.body)
@@ -166,8 +166,6 @@ function searchVideos (req: express.Request, res: express.Response) {
 }
 
 async function searchVideosIndex (query: VideosSearchQuery, res: express.Response) {
-  logger.debug('Doing videos search on search index.')
-
   const result = await buildMutedForSearchIndex(res)
 
   const body: VideosSearchQuery = Object.assign(query, result)
@@ -186,6 +184,8 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons
   const url = sanitizeUrl(CONFIG.SEARCH.SEARCH_INDEX.URL) + '/api/v1/search/videos'
 
   try {
+    logger.debug('Doing videos search index request on %s.', url, { body })
+
     const searchIndexResult = await doRequest<ResultList<Video>>({ uri: url, body, json: true })
 
     return res.json(searchIndexResult.body)
index 6a1f6e759cb8f765b1f38dbc68b3c7d742f19416..91879208178b9914d01a4bab5b4796ed29bf58e2 100644 (file)
@@ -413,6 +413,8 @@ describe('Test live', function () {
       await testVideoResolutions(liveVideoId, resolutions)
 
       await stopFfmpeg(command)
+      await waitUntilLiveEnded(servers[0].url, servers[0].accessToken, liveVideoId)
+
       await waitJobs(servers)
 
       await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
index e7aa5d987aaabcf8956a253da4a11cab6132fa4f..24c91a365eb380fbc61db8ce99125d2ecab2d519 100644 (file)
@@ -502,7 +502,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send notification to moderators on new video with auto-blacklist', async function () {
-      this.timeout(20000)
+      this.timeout(40000)
 
       videoName = 'video with auto-blacklist ' + uuidv4()
       const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName })
@@ -525,7 +525,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send video published and unblacklist after video unblacklisted', async function () {
-      this.timeout(20000)
+      this.timeout(40000)
 
       await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoUUID)
 
index 40065d162daf9342d54ec133f8c486a2bf15447f..849a8a89359c607cfb1827b49affbc68a2606e2a 100644 (file)
@@ -105,7 +105,7 @@ describe('Test videos search', function () {
   describe('Videos search', async function () {
 
     it('Should make a simple search and not have results', async function () {
-      const res = await searchVideo(server.url, 'a'.repeat(500))
+      const res = await searchVideo(server.url, 'djidane'.repeat(50))
 
       expect(res.body.total).to.equal(0)
       expect(res.body.data).to.have.lengthOf(0)
@@ -216,7 +216,7 @@ describe('Test videos search', function () {
       {
         await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } })
 
-        const res = await searchVideo(server.url, 'NSFW search index')
+        const res = await searchVideo(server.url, 'NSFW search index', '-match')
         const video = res.body.data[0] as Video
 
         expect(res.body.data).to.have.length.greaterThan(0)
@@ -228,7 +228,7 @@ describe('Test videos search', function () {
       {
         await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } })
 
-        const res = await searchVideo(server.url, 'NSFW search index')
+        const res = await searchVideo(server.url, 'NSFW search index', '-match')
 
         try {
           expect(res.body.data).to.have.lengthOf(0)
index 1eee22d82f26ba83c50196efa2464ede06146632..71703faacbd39acb32b5031b0502d5ae279c12b0 100644 (file)
@@ -1,3 +1,4 @@
+// high excluded
 function randomInt (low: number, high: number) {
   return Math.floor(Math.random() * (high - low) + low)
 }
index ac65357e31995d9da425c6d03a8be259821ff0e6..db6edbd58ad0de24c08d602f490ccb234d5ac075 100644 (file)
@@ -5,10 +5,10 @@ import { VideosSearchQuery } from '../../models/search'
 import { immutableAssign } from '../miscs/miscs'
 import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
 
-function searchVideo (url: string, search: string) {
+function searchVideo (url: string, search: string, sort = '-publishedAt') {
   const path = '/api/v1/search/videos'
 
-  const query = { sort: '-publishedAt', search: search }
+  const query = { sort, search: search }
   const req = request(url)
     .get(path)
     .query(query)