From 4efa5535ccc947597b7a8e343d6665229ab9cfce Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Nov 2022 11:11:39 +0100 Subject: Fix infinite playlist import Using an hard videos limit in config --- server/tests/api/videos/channel-import-videos.ts | 43 +++++++++++++++++++++++- server/tests/api/videos/video-channel-syncs.ts | 2 +- 2 files changed, 43 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/videos/channel-import-videos.ts b/server/tests/api/videos/channel-import-videos.ts index 7cfd02fbb..a66f88a0e 100644 --- a/server/tests/api/videos/channel-import-videos.ts +++ b/server/tests/api/videos/channel-import-videos.ts @@ -109,6 +109,45 @@ describe('Test videos import in a channel', function () { } }) + it('Should limit max amount of videos synced on full sync', async function () { + this.timeout(240_000) + + await server.kill() + await server.run({ + import: { + video_channel_synchronization: { + full_sync_videos_limit: 1 + } + } + }) + + const { id } = await server.channels.create({ attributes: { name: 'channel3' } }) + const channel3Id = id + + const { videoChannelSync } = await server.channelSyncs.create({ + attributes: { + externalChannelUrl: FIXTURE_URLS.youtubeChannel, + videoChannelId: channel3Id + } + }) + const syncId = videoChannelSync.id + + await waitJobs(server) + + await server.channels.importVideos({ + channelName: 'channel3', + externalChannelUrl: FIXTURE_URLS.youtubeChannel, + videoChannelSyncId: syncId + }) + + await waitJobs(server) + + const { total, data } = await server.videos.listByChannel({ handle: 'channel3' }) + + expect(total).to.equal(1) + expect(data).to.have.lengthOf(1) + }) + after(async function () { await server?.kill() }) @@ -116,5 +155,7 @@ describe('Test videos import in a channel', function () { } runSuite('yt-dlp') - runSuite('youtube-dl') + + // FIXME: With recent changes on youtube, youtube-dl doesn't fetch live replays which means the test suite fails + // runSuite('youtube-dl') }) diff --git a/server/tests/api/videos/video-channel-syncs.ts b/server/tests/api/videos/video-channel-syncs.ts index 865b25f04..91291524d 100644 --- a/server/tests/api/videos/video-channel-syncs.ts +++ b/server/tests/api/videos/video-channel-syncs.ts @@ -220,7 +220,7 @@ describe('Test channel synchronizations', function () { expect(total).to.equal(0) }) - // FIXME: youtube-dl doesn't work when speicifying a port after the hostname + // FIXME: youtube-dl/yt-dlp doesn't work when speicifying a port after the hostname // it('Should import a remote PeerTube channel', async function () { // this.timeout(240_000) -- cgit v1.2.3