fixed #23 stopRetrying issue. Also added test stopRetrying-unix-socket
This commit is contained in:
parent
111cb81dde
commit
788c47c528
4 changed files with 83 additions and 1 deletions
|
@ -13,6 +13,8 @@ function init(config,log){
|
|||
}
|
||||
new pubsub(client);
|
||||
|
||||
console.log(this)
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
|
|
32
testHarness/tests/stopRetrieing-unix-socket-test/client.js
Normal file
32
testHarness/tests/stopRetrieing-unix-socket-test/client.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
var ipc = require('../../../node-ipc'),
|
||||
server=__dirname.split('/'),
|
||||
server=server[server.length-1]
|
||||
|
||||
ipc.config.id = server+'-client';
|
||||
ipc.config.stopRetrying=true;
|
||||
|
||||
//Wait to connect to ensure test server is started
|
||||
setTimeout(
|
||||
function(){
|
||||
ipc.connectTo(
|
||||
server,
|
||||
function(){
|
||||
ipc.of[server].on(
|
||||
'connect',
|
||||
function(){
|
||||
ipc.disconnect(server);
|
||||
|
||||
//wait long enough that the test will fail if disconnect does not happen
|
||||
setTimeout(
|
||||
function(){
|
||||
process.exit(0);
|
||||
},
|
||||
2000
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
400
|
||||
);
|
48
testHarness/tests/stopRetrieing-unix-socket-test/server.js
Normal file
48
testHarness/tests/stopRetrieing-unix-socket-test/server.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
var ipc = require('../../../node-ipc'),
|
||||
expectedClient=ipc.config.id+'-client';
|
||||
|
||||
ipc.config.id = __dirname.split('/');
|
||||
ipc.config.id = ipc.config.id[ipc.config.id.length-1]
|
||||
ipc.config.maxRetries=1;
|
||||
|
||||
ipc.connectTo(
|
||||
'testHarness',
|
||||
function(){
|
||||
ipc.of.testHarness.on(
|
||||
'connect',
|
||||
function(){
|
||||
ipc.of.testHarness.emit(
|
||||
'start.test',
|
||||
{
|
||||
id : ipc.config.id,
|
||||
duration: 1800
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
ipc.serve(
|
||||
function(){
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
ipc.server.on(
|
||||
'socket.disconnected',
|
||||
function(socket,id){
|
||||
ipc.of.testHarness.emit(
|
||||
'pass',
|
||||
'stopRetrying-unix-server'
|
||||
);
|
||||
|
||||
ipc.of.testHarness.emit(
|
||||
'end.test'
|
||||
);
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
)
|
||||
|
||||
ipc.server.start();
|
|
@ -79,6 +79,6 @@ ipc.server.on(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen['app.message']='This event type listens for message strings as value of data key.';
|
||||
ipc.server.define.listen['test-test']='Registers and tests ipc communication.';
|
||||
|
||||
ipc.server.start();
|
Loading…
Reference in a new issue