- 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
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
}
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)
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)
}
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)
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)
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)
})
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 })
})
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)
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)
{
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)
{
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)
+// high excluded
function randomInt (low: number, high: number) {
return Math.floor(Math.random() * (high - low) + low)
}
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)