@@ -18,6 +18,7 @@ class CustomMemoryService extends MemoryService {
1818 custom ( data , params ) { return data . name }
1919}
2020
21+ const baseListenPort = 3050
2122let startId = 6
2223const authUser = {
2324 name : 'Jane Doe' ,
@@ -142,14 +143,14 @@ describe('feathers-distributed:main', () => {
142143 // Now all services are registered setup handlers
143144 apps [ i ] . use ( express . notFound ( ) )
144145 apps [ i ] . use ( express . errorHandler ( ) )
145- servers . push ( await apps [ i ] . listen ( 3030 + i ) )
146+ servers . push ( await apps [ i ] . listen ( baseListenPort + i ) )
146147 }
147148
148149 for ( let i = 0 ; i < nbApps ; i ++ ) {
149150 appServices . push ( apps [ i ] . service ( 'users' ) )
150151 assert . exists ( appServices [ i ] )
151152
152- const url = 'http://localhost:' + ( 3030 + i )
153+ const url = 'http://localhost:' + ( baseListenPort + i )
153154 const restTransporter = restClient ( url ) . superagent ( request )
154155 const rClient = feathers ( )
155156 . configure ( restTransporter )
@@ -208,27 +209,27 @@ describe('feathers-distributed:main', () => {
208209
209210 it ( 'ensure healthcheck can been called on apps' , async ( ) => {
210211 // Service 1 & 2 should see the gateway 0
211- let url = 'http://localhost:' + ( 3030 + service1 ) + '/distribution/healthcheck/0'
212+ let url = 'http://localhost:' + ( baseListenPort + service1 ) + '/distribution/healthcheck/0'
212213 let response = await request . get ( url )
213214 expect ( response . body ) . to . deep . equal ( { users : true } )
214- url = 'http://localhost:' + ( 3030 + service2 ) + '/distribution/healthcheck/0'
215+ url = 'http://localhost:' + ( baseListenPort + service2 ) + '/distribution/healthcheck/0'
215216 response = await request . get ( url )
216217 expect ( response . body ) . to . deep . equal ( { users : true } )
217218 // Gateway should see the no-events app 3
218- url = 'http://localhost:' + ( 3030 + gateway ) + '/distribution/healthcheck/3'
219+ url = 'http://localhost:' + ( baseListenPort + gateway ) + '/distribution/healthcheck/3'
219220 response = await request . get ( url )
220221 expect ( response . body ) . to . deep . equal ( { 'no-events' : true } )
221222 // Listing all gateway services should be the same
222- url = 'http://localhost:' + ( 3030 + gateway ) + '/distribution/healthcheck/0'
223+ url = 'http://localhost:' + ( baseListenPort + gateway ) + '/distribution/healthcheck/0'
223224 response = await request . get ( url )
224225 expect ( response . body ) . to . deep . equal ( { 'no-events' : true } )
225- url = 'http://localhost:' + ( 3030 + gateway ) + '/distribution/healthcheck'
226+ url = 'http://localhost:' + ( baseListenPort + gateway ) + '/distribution/healthcheck'
226227 response = await request . get ( url )
227228 expect ( response . body ) . to . deep . equal ( { 'no-events' : true } )
228229 } )
229230
230231 it ( 'ensure middleware can been called on app' , async ( ) => {
231- const url = 'http://localhost:' + ( 3030 + gateway ) + '/middleware'
232+ const url = 'http://localhost:' + ( baseListenPort + gateway ) + '/middleware'
232233 await request . get ( url )
233234 expect ( appMiddleware ) . toHaveBeenCalled ( )
234235 } )
@@ -273,7 +274,7 @@ describe('feathers-distributed:main', () => {
273274 } , 5000 )
274275
275276 it ( 'ensure middleware can been called on local service' , async ( ) => {
276- const url = 'http://localhost:' + ( 3030 + gateway ) + '/users'
277+ const url = 'http://localhost:' + ( baseListenPort + gateway ) + '/users'
277278 await request . get ( url )
278279 expect ( serviceMiddleware ) . toHaveBeenCalled ( )
279280 } , 5000 )
@@ -543,7 +544,7 @@ describe('feathers-distributed:main', () => {
543544 .timeout(40000) */
544545
545546 it ( 'not found request should return 404 on local service' , async ( ) => {
546- const url = 'http://localhost:' + ( 3030 + gateway ) + '/xxx'
547+ const url = 'http://localhost:' + ( baseListenPort + gateway ) + '/xxx'
547548 try {
548549 await request . get ( url )
549550 } catch ( err ) {
@@ -554,7 +555,7 @@ describe('feathers-distributed:main', () => {
554555 } , 5000 )
555556
556557 it ( 'not found request should return 404 on remote service' , async ( ) => {
557- const url = 'http://localhost:' + ( 3030 + service1 ) + '/xxx'
558+ const url = 'http://localhost:' + ( baseListenPort + service1 ) + '/xxx'
558559 try {
559560 await request . get ( url )
560561 } catch ( err ) {
@@ -575,7 +576,7 @@ describe('feathers-distributed:main', () => {
575576 } , 5000 )
576577
577578 it ( 'unauthenticated request should return 401 on local service with auth' , async ( ) => {
578- const url = 'http://localhost:' + ( 3030 + gateway ) + '/users'
579+ const url = 'http://localhost:' + ( baseListenPort + gateway ) + '/users'
579580 try {
580581 await request . get ( url )
581582 } catch ( err ) {
@@ -595,7 +596,7 @@ describe('feathers-distributed:main', () => {
595596 } , 5000 )
596597
597598 it ( 'unauthenticated request should return 401 on remote service with auth' , async ( ) => {
598- const url = 'http://localhost:' + ( 3030 + service1 ) + '/users'
599+ const url = 'http://localhost:' + ( baseListenPort + service1 ) + '/users'
599600 try {
600601 await request . get ( url )
601602 } catch ( err ) {
0 commit comments