mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Use ephemeral port number for MQTT broker
This commit is contained in:
parent
7640bc029c
commit
ccc98370eb
@ -29,14 +29,13 @@ var httpNodeRoot = "/api";
|
|||||||
var mqttServer;
|
var mqttServer;
|
||||||
var mosca = require('mosca');
|
var mosca = require('mosca');
|
||||||
var moscaSettings = {
|
var moscaSettings = {
|
||||||
port: 1883,
|
port: parseInt(Math.random() * 16383 + 49152),
|
||||||
persistence: {
|
persistence: {
|
||||||
// Needs for retaining messages.
|
// Needs for retaining messages.
|
||||||
factory: mosca.persistence.Memory
|
factory: mosca.persistence.Memory
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// https://cookbook.nodered.org/
|
// https://cookbook.nodered.org/
|
||||||
describe('cookbook', function () {
|
describe('cookbook', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
@ -46,8 +45,12 @@ describe('cookbook', function() {
|
|||||||
before(function () {
|
before(function () {
|
||||||
browser.call(function () {
|
browser.call(function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
mqttServer = new mosca.Server(moscaSettings, function() {
|
mqttServer = new mosca.Server(moscaSettings, function (err) {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -71,7 +74,7 @@ describe('cookbook', function() {
|
|||||||
|
|
||||||
mqttOutNode.edit();
|
mqttOutNode.edit();
|
||||||
mqttConfig.edit();
|
mqttConfig.edit();
|
||||||
mqttConfig.setServer("localhost");
|
mqttConfig.setServer("localhost", moscaSettings.port);
|
||||||
mqttConfig.clickOk();
|
mqttConfig.clickOk();
|
||||||
mqttOutNode.clickOk();
|
mqttOutNode.clickOk();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user