Commit 07cb315d authored by Thomas Urban's avatar Thomas Urban
Browse files

fixing CI issue

parent 6706df85
Pipeline #2043 passed with stage
in 25 seconds
......@@ -88,6 +88,8 @@ class AbstractService extends EventEmitter {
running = true;
stopped = null;
return { address, port };
} );
}
},
......@@ -124,7 +126,7 @@ class AbstractService extends EventEmitter {
},
/**
* Exposes address of running service.
* Exposes address running service is listening on.
*
* @name AbstractService#address
* @property {string}
......@@ -134,6 +136,26 @@ class AbstractService extends EventEmitter {
get: () => address,
},
/**
* Exposes address available for accessing the running service.
*
* @name AbstractService#remoteAddress
* @property {string}
* @readonly
*/
remoteAddress: {
get() {
switch ( address ) {
case "::" :
case "0.0.0.0" :
return "127.0.0.1";
default :
return address;
}
},
},
/**
* Exposes TCP/UDP port of running service.
*
......
......@@ -101,7 +101,6 @@ class HttpService extends AbstractService {
server.once( "listening", () => {
const info = server.address();
console.log( "event", info );
resolve( {
address: info.address,
port: info.port,
......@@ -139,7 +138,7 @@ class HttpService extends AbstractService {
query( method, path, headers = {}, body = null ) {
return new Promise( ( resolve, reject ) => {
const request = Http.request( {
host: this.address,
host: this.remoteAddress,
port: this.port,
method,
path,
......@@ -172,7 +171,7 @@ class HttpService extends AbstractService {
/** @inheritDoc */
get url() {
return `http://${this.address}:${this.port}`;
return `http://${this.remoteAddress}:${this.port}`;
}
}
......
......@@ -105,13 +105,17 @@ EOM
` );
describe( "Mock-up service for HTTP", () => {
before( () => Mock.start().then( info => { console.log( "started", info ); return info; } ) );
before( () => Mock.start() );
after( () => Mock.stop() );
it( "is exposing its address", () => {
it( "is exposing address it is listening on", () => {
Mock.address.should.be.String();
} );
it( "is exposing its address for use from a client's point of view", () => {
Mock.remoteAddress.should.be.String();
} );
it( "is exposing its port", () => {
Mock.port.should.be.Number().which.is.greaterThan( 0 ).and.lessThan( 65536 );
} );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment