diff options
author | Chocobozzz <me@florianbigard.com> | 2020-03-20 16:17:14 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-03-20 16:17:14 +0100 |
commit | cf5d7d9d942a13b0a55427367740885defc26469 (patch) | |
tree | b70fa7e56937f26e0f4bf1c109a2dd7b6751f9f2 | |
parent | 677119c91404832fb157522c23083b86601b41ab (diff) | |
download | PeerTube-cf5d7d9d942a13b0a55427367740885defc26469.tar.gz PeerTube-cf5d7d9d942a13b0a55427367740885defc26469.tar.zst PeerTube-cf5d7d9d942a13b0a55427367740885defc26469.zip |
Try to fix tracker tests issues
-rw-r--r-- | server/tests/api/server/tracker.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts index 611d5254a..5b56a83bb 100644 --- a/server/tests/api/server/tracker.ts +++ b/server/tests/api/server/tracker.ts | |||
@@ -73,6 +73,8 @@ describe('Test tracker', function () { | |||
73 | it('Should disable the tracker', function (done) { | 73 | it('Should disable the tracker', function (done) { |
74 | this.timeout(20000) | 74 | this.timeout(20000) |
75 | 75 | ||
76 | const errCb = () => done(new Error('Tracker is enabled')) | ||
77 | |||
76 | killallServers([ server ]) | 78 | killallServers([ server ]) |
77 | reRunServer(server, { tracker: { enabled: false } }) | 79 | reRunServer(server, { tracker: { enabled: false } }) |
78 | .then(() => { | 80 | .then(() => { |
@@ -83,10 +85,14 @@ describe('Test tracker', function () { | |||
83 | torrent.on('error', done) | 85 | torrent.on('error', done) |
84 | torrent.on('warning', warn => { | 86 | torrent.on('warning', warn => { |
85 | const message = typeof warn === 'string' ? warn : warn.message | 87 | const message = typeof warn === 'string' ? warn : warn.message |
86 | if (message.includes('disabled ')) return done() | 88 | if (message.includes('disabled ')) { |
89 | torrent.off('done', errCb) | ||
90 | |||
91 | return done() | ||
92 | } | ||
87 | }) | 93 | }) |
88 | 94 | ||
89 | torrent.on('done', () => done(new Error('Tracker is enabled'))) | 95 | torrent.on('done', errCb) |
90 | }) | 96 | }) |
91 | }) | 97 | }) |
92 | 98 | ||