Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: skip MQTT broker test on macOS #1181

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { expect, should } from "chai";
import MqttBrokerServer from "../src/mqtt-broker-server";
import MqttClientFactory from "../src/mqtt-client-factory";
import MqttsClientFactory from "../src/mqtts-client-factory";
import { platform } from "os";

const info = createInfoLogger("binding-mqtt", "mqtt-client-subscribe-test.integration");

Expand All @@ -30,7 +31,7 @@ should();

describe("MQTT client implementation", () => {
let servient: Servient;
let brokerServer: MqttBrokerServer;
let brokerServer: MqttBrokerServer | undefined;

const brokerAddress = "localhost";
const brokerPort = 1889;
Expand All @@ -42,18 +43,24 @@ describe("MQTT client implementation", () => {

afterEach(async () => {
await servient.shutdown();
await brokerServer.stop();
await brokerServer?.stop();
});

it("should expose via broker", (done: Mocha.Done) => {
it("should expose via broker", function (done: Mocha.Done) {
// Skip this test on macOS until the underlying issue is fixed,
// see https://github.com/eclipse-thingweb/node-wot/issues/1159
if (platform() === "darwin") {
this.skip();
}

brokerServer = new MqttBrokerServer({ uri: brokerUri, selfHost: true });
servient.addServer(brokerServer);

servient.addClientFactory(new MqttClientFactory());

servient.start().then((WoT) => {
expect(brokerServer.getPort()).to.equal(brokerPort);
expect(brokerServer.getAddress()).to.equal(brokerAddress);
expect(brokerServer?.getPort()).to.equal(brokerPort);
expect(brokerServer?.getAddress()).to.equal(brokerAddress);

const eventNumber = Math.floor(Math.random() * 1000000);
const eventName: string = "event" + eventNumber;
Expand Down Expand Up @@ -102,7 +109,13 @@ describe("MQTT client implementation", () => {
});
}).timeout(20000);

it("should expose via broker using mqtts", (done: Mocha.Done) => {
it("should expose via broker using mqtts", function (done: Mocha.Done) {
// Skip this test on macOS until the underlying issue is fixed,
// see https://github.com/eclipse-thingweb/node-wot/issues/1159
if (platform() === "darwin") {
this.skip();
}

brokerServer = new MqttBrokerServer({
uri: brokerUri,
selfHost: true,
Expand All @@ -114,8 +127,8 @@ describe("MQTT client implementation", () => {
servient.addClientFactory(new MqttsClientFactory({ rejectUnauthorized: false }));

servient.start().then((WoT) => {
expect(brokerServer.getPort()).to.equal(brokerPort);
expect(brokerServer.getAddress()).to.equal(brokerAddress);
expect(brokerServer?.getPort()).to.equal(brokerPort);
expect(brokerServer?.getAddress()).to.equal(brokerAddress);

const eventNumber = Math.floor(Math.random() * 1000000);
const eventName: string = "event" + eventNumber;
Expand Down
Loading