const getClientInfo = () => { return { type: "nodejs", version: MOLECULER_VERSION, langVersion: process.version }; }
describe("Test NodeCatalog localNode", () => { const metadata = { region: "eu-west" }; const broker = new ServiceBroker({ logger: false, metadata }); const catalog = new NodeCatalog(broker.registry, broker); it("should load local values", () => { const node = catalog.localNode; expect(node.id).toBe(broker.nodeID); expect(node.instanceID).toBe(broker.instanceID); expect(node.local).toBe(true); expect(node.ipList).toBeInstanceOf(Array); expect(node.hostname).toBeDefined(); expect(node.client).toEqual({ type: "nodejs", version: broker.MOLECULER_VERSION, langVersion: process.version }); expect(node.seq).toBe(1); expect(node.metadata).toBe(metadata); expect(catalog.nodes.get(broker.nodeID)).toBe(node); }); });
/** * Create local node with local information * * @returns * @memberof NodeCatalog */ createLocalNode() { const node = new Node(this.broker.nodeID); node.local = true; node.ipList = getIpList(); node.instanceID = this.broker.instanceID; node.hostname = os.hostname(); node.client = { type: "nodejs", version: this.broker.MOLECULER_VERSION, langVersion: process.version }; node.metadata = this.broker.metadata; node.seq = 1; this.add(node.id, node); this.localNode = node; return node; }
cpus: os.cpus(), network_interfaces: os.networkInterfaces(), nodejs_version: process.version, gladys_version: this.gladysVersion, latest_gladys_version: this.latestGladysVersion,
it("should return node list", () => { const localNode = broker.registry.nodes.localNode; return broker.call("$node.list").then(res => { expect(res).toEqual([{ "available": true, "client": { "langVersion": process.version, "type": "nodejs", "version": broker.MOLECULER_VERSION }, "config": {}, "cpu": null, "cpuSeq": null, "id": "node-master", "instanceID": localNode.instanceID, "ipList": localNode.ipList, "hostname": hostname(), "lastHeartbeatTime": localNode.lastHeartbeatTime, "offlineSince": null, "port": null, "seq": localNode.seq, "local": true, "metadata": { a: 5 }, "udpAddress": null }]); }); });
if (semver.gte(process.version, '13.0.0')) { expected.req.remoteAddress = originalReq.connection.remoteAddress expected.req.remotePort = originalReq.connection.remotePort
const version = process.version.split('.').map(a => parseInt(a.replace('v', ''))); let html = ''; if ((version[0] === 8 && version[1] >= 10) ||
t.ok(parseInt(nodeEnvData['max.old.space.size']) > 0, 'max.old.space.size is positive'); if (semver.gt(process.version, '12.0.0')) { t.skip(); } else if (semver.gt(process.version, '10.0.0')) { t.ok(actualHeapSizeLimit < (maxHeapGuess * 1.05), 'Values for max.old.space.size and max.semi.space.size approximately match heap.size.limit (2)'); } else if (semver.gt(process.version, '6.5.0')) {
process.on('exit', code => { if (code === 0 || expectedError) return // normal exit if (code === 130) return // intentional exit with Control-C clivas.line('\n{red:UNEXPECTED ERROR:} If this is a bug in WebTorrent, report it!') clivas.line('{green:OPEN AN ISSUE:} https://github.com/webtorrent/webtorrent-cli/issues\n') clivas.line(`DEBUG INFO: webtorrent-cli ${webTorrentCliVersion}, webtorrent ${webTorrentVersion}, node ${process.version}, ${process.platform} ${process.arch}, exit ${code}`) })
test('prefers locally installed node-gyp bin', function (t) { prebuildify({ cwd: path.join(__dirname, 'mock-gyp'), targets: [{ runtime: 'node', target: process.version }] }, function (err) { t.is(err.message, 'node-gyp exited with 123') t.end() }) })
// TODO: expose an API to extend this // there will potentially be more named exports in this file // eslint-disable-next-line import/prefer-default-export export function packageIdentifier() { return `${pkg.name.replace('/', ':')}/${pkg.version} ${os.platform()}/${os.release()} node/${process.version.replace('v', '')}`; }
function getNodeMajorVersion() { let version = system.process.version //v8.8 // Skip the "v", convert to number return parseFloat(version.substring(1, version.indexOf('.'))) }
constructor ({ apiUrl, applicationId, clientSecretKey, apiVersion, channel }) { this.basePath = apiUrl || 'https://api.voucherify.io' this.headers = { 'X-App-Id': applicationId, 'X-App-Token': clientSecretKey, 'X-Voucherify-Channel': channel || `Node.js-${process.version}-SDK-v${packageJson.version}` } if (apiVersion) { this.headers['X-Voucherify-API-Version'] = apiVersion } }
cpus: os.cpus(), network_interfaces: os.networkInterfaces(), nodejs_version: process.version, gladys_version: this.gladysVersion, latest_gladys_version: this.latestGladysVersion,