ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /usr/lib/node_modules/forever/test/worker/ |
var path = require('path'), assert = require('assert'), vows = require('vows'), nssocket = require('nssocket'), macros = require('../helpers/macros'), MonitorMock = require('../helpers/mocks/monitor').MonitorMock; var SOCKET_PATH = path.join(__dirname, '..', 'fixtures'); vows.describe('forever/worker/simple').addBatch({ 'When using forever worker': { 'and starting it and pinging it': macros.assertWorkerConnected({ monitor: new MonitorMock(), sockPath: SOCKET_PATH }, { 'and respond to pings': { topic: function (reader) { reader.send(['ping']); reader.data(['pong'], this.callback); }, 'with `pong`': function () {} }, 'and when queried for data': { topic: function (reader, _, options) { var self = this; reader.send(['data']); reader.data(['data'], function (data) { self.callback(null, { data: data, monitor: options.monitor }); }); }, 'it should respond with data': function (obj) { assert.isObject(obj.data); assert.deepEqual(obj.data, obj.monitor.data); } }, 'and when asked to kill the process': { topic: function (reader, _, options) { var self = this; options.monitor.running = true; reader.send(['stop']); reader.data(['stop', 'ok'], function () { self.callback(null, options.monitor); }); }, 'it should kill the process': function (monitor) { assert.isFalse(monitor.running); } }, 'and when quickly sending data and disconnecting': { topic: function(reader) { var self = this; // Need to connect second reader, otherwise it breaks the other // tests as the reader is shared with them. var reader2 = new nssocket.NsSocket(); reader2.connect(reader.host, function() { reader2.send(['data']); reader2.destroy(); self.callback(); }); }, 'it should not crash the worker': function(worker) { // no asserition, everything is good if the test does not cause // a worker crash. } } }) } }).export(module);