3 const request = require('supertest')
11 // ---------------------- Export functions --------------------
13 function getFriendsList (url, end) {
14 const path = '/api/v1/pods/'
18 .set('Accept', 'application/json')
20 .expect('Content-Type', /json/)
24 function makeFriends (url, accessToken, expectedStatus, end) {
30 // Which pod makes friends with which pod
31 const friendsMatrix = {
32 'http://localhost:9001': [
35 'http://localhost:9002': [
38 'http://localhost:9003': [
41 'http://localhost:9004': [
44 'http://localhost:9005': [
48 'http://localhost:9006': [
54 const path = '/api/v1/pods/makefriends'
56 // The first pod make friend with the third
59 .set('Accept', 'application/json')
60 .set('Authorization', 'Bearer ' + accessToken)
61 .send({ 'hosts': friendsMatrix[url] })
62 .expect(expectedStatus)
63 .end(function (err, res) {
66 // Wait for the request between pods
71 function quitFriends (url, accessToken, expectedStatus, end) {
77 const path = '/api/v1/pods/quitfriends'
79 // The first pod make friend with the third
82 .set('Accept', 'application/json')
83 .set('Authorization', 'Bearer ' + accessToken)
84 .expect(expectedStatus)
85 .end(function (err, res) {
88 // Wait for the request between pods
93 // ---------------------------------------------------------------------------
95 module.exports = podsUtils