diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-03 09:06:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-03 09:06:51 +0200 |
commit | 63da15eb18065ef6c419f073c95fec6ef5541652 (patch) | |
tree | a95855514d4d7ed8dd1bba0934d8640902ff330e /server/tests | |
parent | 38c5c166f4204292d58f61658a063408a9e7b78c (diff) | |
download | PeerTube-63da15eb18065ef6c419f073c95fec6ef5541652.tar.gz PeerTube-63da15eb18065ef6c419f073c95fec6ef5541652.tar.zst PeerTube-63da15eb18065ef6c419f073c95fec6ef5541652.zip |
Use random port for mock servers in tests
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/external-plugins/auto-block-videos.ts | 5 | ||||
-rw-r--r-- | server/tests/external-plugins/auto-mute.ts | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts index 1b91d141e..18ea17d78 100644 --- a/server/tests/external-plugins/auto-block-videos.ts +++ b/server/tests/external-plugins/auto-block-videos.ts | |||
@@ -40,6 +40,7 @@ describe('Official plugin auto-block videos', function () { | |||
40 | let blocklistServer: MockBlocklist | 40 | let blocklistServer: MockBlocklist |
41 | let server1Videos: Video[] = [] | 41 | let server1Videos: Video[] = [] |
42 | let server2Videos: Video[] = [] | 42 | let server2Videos: Video[] = [] |
43 | let port: number | ||
43 | 44 | ||
44 | before(async function () { | 45 | before(async function () { |
45 | this.timeout(60000) | 46 | this.timeout(60000) |
@@ -56,7 +57,7 @@ describe('Official plugin auto-block videos', function () { | |||
56 | } | 57 | } |
57 | 58 | ||
58 | blocklistServer = new MockBlocklist() | 59 | blocklistServer = new MockBlocklist() |
59 | await blocklistServer.initialize() | 60 | port = await blocklistServer.initialize() |
60 | 61 | ||
61 | await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' }) | 62 | await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' }) |
62 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video server 2' }) | 63 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video server 2' }) |
@@ -82,7 +83,7 @@ describe('Official plugin auto-block videos', function () { | |||
82 | accessToken: servers[0].accessToken, | 83 | accessToken: servers[0].accessToken, |
83 | npmName: 'peertube-plugin-auto-block-videos', | 84 | npmName: 'peertube-plugin-auto-block-videos', |
84 | settings: { | 85 | settings: { |
85 | 'blocklist-urls': 'http://localhost:42100/blocklist', | 86 | 'blocklist-urls': `http://localhost:${port}/blocklist`, |
86 | 'check-seconds-interval': 1 | 87 | 'check-seconds-interval': 1 |
87 | } | 88 | } |
88 | }) | 89 | }) |
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts index 687f56e98..09355d932 100644 --- a/server/tests/external-plugins/auto-mute.ts +++ b/server/tests/external-plugins/auto-mute.ts | |||
@@ -31,6 +31,7 @@ describe('Official plugin auto-mute', function () { | |||
31 | const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' | 31 | const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' |
32 | let servers: ServerInfo[] | 32 | let servers: ServerInfo[] |
33 | let blocklistServer: MockBlocklist | 33 | let blocklistServer: MockBlocklist |
34 | let port: number | ||
34 | 35 | ||
35 | before(async function () { | 36 | before(async function () { |
36 | this.timeout(30000) | 37 | this.timeout(30000) |
@@ -47,7 +48,7 @@ describe('Official plugin auto-mute', function () { | |||
47 | } | 48 | } |
48 | 49 | ||
49 | blocklistServer = new MockBlocklist() | 50 | blocklistServer = new MockBlocklist() |
50 | await blocklistServer.initialize() | 51 | port = await blocklistServer.initialize() |
51 | 52 | ||
52 | await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' }) | 53 | await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' }) |
53 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video server 2' }) | 54 | await uploadVideoAndGetId({ server: servers[1], videoName: 'video server 2' }) |
@@ -61,7 +62,7 @@ describe('Official plugin auto-mute', function () { | |||
61 | accessToken: servers[0].accessToken, | 62 | accessToken: servers[0].accessToken, |
62 | npmName: 'peertube-plugin-auto-mute', | 63 | npmName: 'peertube-plugin-auto-mute', |
63 | settings: { | 64 | settings: { |
64 | 'blocklist-urls': 'http://localhost:42100/blocklist', | 65 | 'blocklist-urls': `http://localhost:${port}/blocklist`, |
65 | 'check-seconds-interval': 1 | 66 | 'check-seconds-interval': 1 |
66 | } | 67 | } |
67 | }) | 68 | }) |