diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-12 11:56:02 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-12 11:56:02 +0200 |
commit | f981dae8617271a2dc713bb683951730b306e0c5 (patch) | |
tree | ecee631766bc1b98c20a7836479fed40850c5a56 /server/tests | |
parent | 075f16caac5236cb04c98ae7b3a989766d764bb3 (diff) | |
download | PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.tar.gz PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.tar.zst PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.zip |
Add previews cache system between pods
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/fixtures/video_short1-preview.webm.jpg | bin | 0 -> 31725 bytes | |||
-rw-r--r-- | server/tests/api/multiple-pods.js | 19 | ||||
-rw-r--r-- | server/tests/utils/videos.js | 4 |
3 files changed, 20 insertions, 3 deletions
diff --git a/server/tests/api/fixtures/video_short1-preview.webm.jpg b/server/tests/api/fixtures/video_short1-preview.webm.jpg new file mode 100644 index 000000000..69c100c4e --- /dev/null +++ b/server/tests/api/fixtures/video_short1-preview.webm.jpg | |||
Binary files differ | |||
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index 1bc6157e8..7753e6f2d 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js | |||
@@ -747,7 +747,7 @@ describe('Test multiple pods', function () { | |||
747 | expect(videos[0].name).not.to.equal(toRemove[1].name) | 747 | expect(videos[0].name).not.to.equal(toRemove[1].name) |
748 | expect(videos[1].name).not.to.equal(toRemove[1].name) | 748 | expect(videos[1].name).not.to.equal(toRemove[1].name) |
749 | 749 | ||
750 | videoUUID = videos[0].uuid | 750 | videoUUID = videos.find(video => video.name === 'my super name for pod 1').uuid |
751 | 751 | ||
752 | callback() | 752 | callback() |
753 | }) | 753 | }) |
@@ -781,6 +781,23 @@ describe('Test multiple pods', function () { | |||
781 | }) | 781 | }) |
782 | }, done) | 782 | }, done) |
783 | }) | 783 | }) |
784 | |||
785 | it('Should get the preview from each pod', function (done) { | ||
786 | each(servers, function (server, callback) { | ||
787 | videosUtils.getVideo(server.url, videoUUID, function (err, res) { | ||
788 | if (err) throw err | ||
789 | |||
790 | const video = res.body | ||
791 | |||
792 | videosUtils.testVideoImage(server.url, 'video_short1-preview.webm', video.previewPath, function (err, test) { | ||
793 | if (err) throw err | ||
794 | expect(test).to.equal(true) | ||
795 | |||
796 | callback() | ||
797 | }) | ||
798 | }) | ||
799 | }, done) | ||
800 | }) | ||
784 | }) | 801 | }) |
785 | 802 | ||
786 | after(function (done) { | 803 | after(function (done) { |
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js index 6e7aabc5d..cb3be6897 100644 --- a/server/tests/utils/videos.js +++ b/server/tests/utils/videos.js | |||
@@ -195,7 +195,7 @@ function searchVideoWithSort (url, search, sort, end) { | |||
195 | .end(end) | 195 | .end(end) |
196 | } | 196 | } |
197 | 197 | ||
198 | function testVideoImage (url, videoName, imagePath, callback) { | 198 | function testVideoImage (url, imageName, imagePath, callback) { |
199 | // Don't test images if the node env is not set | 199 | // Don't test images if the node env is not set |
200 | // Because we need a special ffmpeg version for this test | 200 | // Because we need a special ffmpeg version for this test |
201 | if (process.env.NODE_TEST_IMAGE) { | 201 | if (process.env.NODE_TEST_IMAGE) { |
@@ -205,7 +205,7 @@ function testVideoImage (url, videoName, imagePath, callback) { | |||
205 | .end(function (err, res) { | 205 | .end(function (err, res) { |
206 | if (err) return callback(err) | 206 | if (err) return callback(err) |
207 | 207 | ||
208 | fs.readFile(pathUtils.join(__dirname, '..', 'api', 'fixtures', videoName + '.jpg'), function (err, data) { | 208 | fs.readFile(pathUtils.join(__dirname, '..', 'api', 'fixtures', imageName + '.jpg'), function (err, data) { |
209 | if (err) return callback(err) | 209 | if (err) return callback(err) |
210 | 210 | ||
211 | callback(null, data.equals(res.body)) | 211 | callback(null, data.equals(res.body)) |