diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-12-04 16:13:32 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-12-04 16:13:32 +0100 |
commit | 0b69752270f1ceea06a29872b3db23660a55d6d3 (patch) | |
tree | 42da726633f3e48f4fe592cfd2c1ca14346a159b /test/api/friendsAdvanced.js | |
parent | af82cae07dc568e3cb10acd70113df56eb8b15a9 (diff) | |
download | PeerTube-0b69752270f1ceea06a29872b3db23660a55d6d3.tar.gz PeerTube-0b69752270f1ceea06a29872b3db23660a55d6d3.tar.zst PeerTube-0b69752270f1ceea06a29872b3db23660a55d6d3.zip |
Add a pool of requests instead of making a request at each action (add
video/remove video) for performance in big networks
Diffstat (limited to 'test/api/friendsAdvanced.js')
-rw-r--r-- | test/api/friendsAdvanced.js | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/test/api/friendsAdvanced.js b/test/api/friendsAdvanced.js index ccddac4dc..680d90aee 100644 --- a/test/api/friendsAdvanced.js +++ b/test/api/friendsAdvanced.js | |||
@@ -103,9 +103,9 @@ | |||
103 | }) | 103 | }) |
104 | 104 | ||
105 | it('Should make friends with the pods 1, 2, 3', function (done) { | 105 | it('Should make friends with the pods 1, 2, 3', function (done) { |
106 | this.timeout(100000) | 106 | this.timeout(150000) |
107 | 107 | ||
108 | // Pods 1, 2, 3 and 4 become friends | 108 | // Pods 1, 2, 3 and 4 become friends (yes this is beautiful) |
109 | makeFriend(2, function () { | 109 | makeFriend(2, function () { |
110 | makeFriend(1, function () { | 110 | makeFriend(1, function () { |
111 | makeFriend(4, function () { | 111 | makeFriend(4, function () { |
@@ -114,37 +114,45 @@ | |||
114 | 114 | ||
115 | // Expulse pod 4 from pod 1 and 2 | 115 | // Expulse pod 4 from pod 1 and 2 |
116 | uploadVideo(1, function () { | 116 | uploadVideo(1, function () { |
117 | uploadVideo(1, function () { | 117 | setTimeout(function () { |
118 | uploadVideo(2, function () { | 118 | uploadVideo(1, function () { |
119 | uploadVideo(2, function () { | 119 | setTimeout(function () { |
120 | // Rerun server 4 | 120 | uploadVideo(2, function () { |
121 | utils.runServer(4, function (app, url) { | 121 | setTimeout(function () { |
122 | apps[3] = app | 122 | uploadVideo(2, function () { |
123 | getFriendsList(4, function (err, res) { | 123 | setTimeout(function () { |
124 | if (err) throw err | 124 | // Rerun server 4 |
125 | // Pod 4 didn't know pod 1 and 2 removed it | 125 | utils.runServer(4, function (app, url) { |
126 | expect(res.body.length).to.equal(3) | 126 | apps[3] = app |
127 | 127 | getFriendsList(4, function (err, res) { | |
128 | // Pod 6 ask pod 1, 2 and 3 | 128 | if (err) throw err |
129 | makeFriend(6, function () { | 129 | // Pod 4 didn't know pod 1 and 2 removed it |
130 | getFriendsList(6, function (err, res) { | 130 | expect(res.body.length).to.equal(3) |
131 | if (err) throw err | 131 | |
132 | 132 | // Pod 6 ask pod 1, 2 and 3 | |
133 | // Pod 4 should not be our friend | 133 | makeFriend(6, function () { |
134 | var result = res.body | 134 | getFriendsList(6, function (err, res) { |
135 | expect(result.length).to.equal(3) | 135 | if (err) throw err |
136 | for (var pod of result) { | 136 | |
137 | expect(pod.url).not.equal(urls[3]) | 137 | // Pod 4 should not be our friend |
138 | } | 138 | var result = res.body |
139 | 139 | expect(result.length).to.equal(3) | |
140 | done() | 140 | for (var pod of result) { |
141 | }) | 141 | expect(pod.url).not.equal(urls[3]) |
142 | } | ||
143 | |||
144 | done() | ||
145 | }) | ||
146 | }) | ||
147 | }) | ||
148 | }) | ||
149 | }, 11000) | ||
142 | }) | 150 | }) |
143 | }) | 151 | }, 11000) |
144 | }) | 152 | }) |
145 | }) | 153 | }, 11000) |
146 | }) | 154 | }) |
147 | }) | 155 | }, 11000) |
148 | }) | 156 | }) |
149 | }) | 157 | }) |
150 | }) | 158 | }) |