|
|
@ -54,7 +54,7 @@ async function testMqtt(mqttSuccessMessage, mqttCheckType, receivedMessage, moni
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
describe("MqttMonitorType", {
|
|
|
|
describe("MqttMonitorType", {
|
|
|
|
concurrency: true,
|
|
|
|
concurrency: 4,
|
|
|
|
skip: !!process.env.CI && (process.platform !== "linux" || process.arch !== "x64")
|
|
|
|
skip: !!process.env.CI && (process.platform !== "linux" || process.arch !== "x64")
|
|
|
|
}, () => {
|
|
|
|
}, () => {
|
|
|
|
test("valid keywords (type=default)", async () => {
|
|
|
|
test("valid keywords (type=default)", async () => {
|
|
|
@ -63,6 +63,23 @@ describe("MqttMonitorType", {
|
|
|
|
assert.strictEqual(heartbeat.msg, "Topic: test; Message: -> KEYWORD <-");
|
|
|
|
assert.strictEqual(heartbeat.msg, "Topic: test; Message: -> KEYWORD <-");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test("valid nested topic", async () => {
|
|
|
|
|
|
|
|
const heartbeat = await testMqtt("KEYWORD", null, "-> KEYWORD <-", "a/b/c", "a/b/c");
|
|
|
|
|
|
|
|
assert.strictEqual(heartbeat.status, UP);
|
|
|
|
|
|
|
|
assert.strictEqual(heartbeat.msg, "Topic: a/b/c; Message: -> KEYWORD <-");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test("valid wildcard topic (with #)", async () => {
|
|
|
|
|
|
|
|
const heartbeat = await testMqtt("KEYWORD", null, "-> KEYWORD <-", "a/#", "a/b/c");
|
|
|
|
|
|
|
|
assert.strictEqual(heartbeat.status, UP);
|
|
|
|
|
|
|
|
assert.strictEqual(heartbeat.msg, "Topic: a/b/c; Message: -> KEYWORD <-");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test("valid wildcard topic (with +)", async () => {
|
|
|
|
|
|
|
|
const heartbeat = await testMqtt("KEYWORD", null, "-> KEYWORD <-", "a/+/c", "a/b/c");
|
|
|
|
|
|
|
|
assert.strictEqual(heartbeat.status, UP);
|
|
|
|
|
|
|
|
assert.strictEqual(heartbeat.msg, "Topic: a/b/c; Message: -> KEYWORD <-");
|
|
|
|
|
|
|
|
});
|
|
|
|
test("valid keywords (type=keyword)", async () => {
|
|
|
|
test("valid keywords (type=keyword)", async () => {
|
|
|
|
const heartbeat = await testMqtt("KEYWORD", "keyword", "-> KEYWORD <-");
|
|
|
|
const heartbeat = await testMqtt("KEYWORD", "keyword", "-> KEYWORD <-");
|
|
|
|
assert.strictEqual(heartbeat.status, UP);
|
|
|
|
assert.strictEqual(heartbeat.status, UP);
|
|
|
|