mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Compare commits
4 commits
610c6358a3
...
15a8abb9f7
Author | SHA1 | Date | |
---|---|---|---|
|
15a8abb9f7 | ||
|
7961ebb43b | ||
|
685043e55b | ||
|
0ba3773031 |
5 changed files with 70 additions and 6 deletions
17
package-lock.json
generated
17
package-lock.json
generated
|
@ -93,6 +93,7 @@
|
||||||
"@playwright/test": "~1.39.0",
|
"@playwright/test": "~1.39.0",
|
||||||
"@popperjs/core": "~2.10.2",
|
"@popperjs/core": "~2.10.2",
|
||||||
"@testcontainers/hivemq": "^10.13.1",
|
"@testcontainers/hivemq": "^10.13.1",
|
||||||
|
"@testcontainers/rabbitmq": "^10.13.2",
|
||||||
"@types/bootstrap": "~5.1.9",
|
"@types/bootstrap": "~5.1.9",
|
||||||
"@types/node": "^20.8.6",
|
"@types/node": "^20.8.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||||
|
@ -4172,6 +4173,15 @@
|
||||||
"testcontainers": "^10.13.1"
|
"testcontainers": "^10.13.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@testcontainers/rabbitmq": {
|
||||||
|
"version": "10.13.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@testcontainers/rabbitmq/-/rabbitmq-10.13.2.tgz",
|
||||||
|
"integrity": "sha512-npBKBnq3c6hETmxGZ/gVMke9cc1J/pcftNW9S3WidL48hxFBIPjYNM9FdTfWuoNER/8kuf4xJ8yCuJEYGH3ZAg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"testcontainers": "^10.13.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@tootallnate/once": {
|
"node_modules/@tootallnate/once": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
|
||||||
|
@ -15925,11 +15935,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/testcontainers": {
|
"node_modules/testcontainers": {
|
||||||
"version": "10.13.1",
|
"version": "10.13.2",
|
||||||
"resolved": "https://registry.npmjs.org/testcontainers/-/testcontainers-10.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/testcontainers/-/testcontainers-10.13.2.tgz",
|
||||||
"integrity": "sha512-JBbOhxmygj/ouH/47GnoVNt+c55Telh/45IjVxEbDoswsLchVmJiuKiw/eF6lE5i7LN+/99xsrSCttI3YRtirg==",
|
"integrity": "sha512-LfEll+AG/1Ks3n4+IA5lpyBHLiYh/hSfI4+ERa6urwfQscbDU+M2iW1qPQrHQi+xJXQRYy4whyK1IEHdmxWa3Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@balena/dockerignore": "^1.0.2",
|
"@balena/dockerignore": "^1.0.2",
|
||||||
"@types/dockerode": "^3.3.29",
|
"@types/dockerode": "^3.3.29",
|
||||||
|
|
|
@ -155,6 +155,7 @@
|
||||||
"@playwright/test": "~1.39.0",
|
"@playwright/test": "~1.39.0",
|
||||||
"@popperjs/core": "~2.10.2",
|
"@popperjs/core": "~2.10.2",
|
||||||
"@testcontainers/hivemq": "^10.13.1",
|
"@testcontainers/hivemq": "^10.13.1",
|
||||||
|
"@testcontainers/rabbitmq": "^10.13.2",
|
||||||
"@types/bootstrap": "~5.1.9",
|
"@types/bootstrap": "~5.1.9",
|
||||||
"@types/node": "^20.8.6",
|
"@types/node": "^20.8.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||||
|
|
|
@ -1058,6 +1058,7 @@
|
||||||
"rabbitmqNodesInvalid": "Please use a complete URL for RabbitMQ nodes.",
|
"rabbitmqNodesInvalid": "Please use a complete URL for RabbitMQ nodes.",
|
||||||
"RabbitMQ Username": "RabbitMQ Username",
|
"RabbitMQ Username": "RabbitMQ Username",
|
||||||
"RabbitMQ Password": "RabbitMQ Password",
|
"RabbitMQ Password": "RabbitMQ Password",
|
||||||
|
"RabbitMQ (using Management Plugin)": "RabbitMQ (using Management Plugin)",
|
||||||
"SendGrid API Key": "SendGrid API Key",
|
"SendGrid API Key": "SendGrid API Key",
|
||||||
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
"Separate multiple email addresses with commas": "Separate multiple email addresses with commas"
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
MQTT
|
MQTT
|
||||||
</option>
|
</option>
|
||||||
<option value="rabbitmq">
|
<option value="rabbitmq">
|
||||||
RabbitMQ (using Management Plugin)
|
{{ $t("RabbitMQ (using Management Plugin)") }}
|
||||||
</option>
|
</option>
|
||||||
<option value="kafka-producer">
|
<option value="kafka-producer">
|
||||||
Kafka Producer
|
Kafka Producer
|
||||||
|
@ -1789,7 +1789,7 @@ message HealthCheckResponse {
|
||||||
toast.error(this.$t("rabbitmqNodesRequired"));
|
toast.error(this.$t("rabbitmqNodesRequired"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.monitor.rabbitmqNodes.every(node => node.startsWith("http://" || node.startsWith("https://")))) {
|
if (!this.monitor.rabbitmqNodes.every(node => node.startsWith("http://") || node.startsWith("https://"))) {
|
||||||
toast.error(this.$t("rabbitmqNodesInvalid"));
|
toast.error(this.$t("rabbitmqNodesInvalid"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
53
test/backend-test/test-rabbitmq.js
Normal file
53
test/backend-test/test-rabbitmq.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
const { describe, test } = require("node:test");
|
||||||
|
const assert = require("node:assert");
|
||||||
|
const { RabbitMQContainer } = require("@testcontainers/rabbitmq");
|
||||||
|
const { RabbitMqMonitorType } = require("../../../server/monitor-types/rabbitmq");
|
||||||
|
const { UP, DOWN, PENDING } = require("../../../src/util");
|
||||||
|
|
||||||
|
describe("RabbitMQ Single Node", {
|
||||||
|
skip: !!process.env.CI && (process.platform !== "linux" || process.arch !== "x64"),
|
||||||
|
}, () => {
|
||||||
|
test("RabbitMQ is running", async () => {
|
||||||
|
// The default timeout of 30 seconds might not be enough for the container to start
|
||||||
|
const rabbitMQContainer = await new RabbitMQContainer().withStartupTimeout(60000).start();
|
||||||
|
const rabbitMQMonitor = new RabbitMqMonitorType();
|
||||||
|
const connectionString = `http://${rabbitMQContainer.getHost()}:${rabbitMQContainer.getMappedPort(15672)}`;
|
||||||
|
|
||||||
|
const monitor = {
|
||||||
|
rabbitmqNodes: JSON.stringify([ connectionString ]),
|
||||||
|
rabbitmqUsername: "guest",
|
||||||
|
rabbitmqPassword: "guest",
|
||||||
|
};
|
||||||
|
|
||||||
|
const heartbeat = {
|
||||||
|
msg: "",
|
||||||
|
status: PENDING,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await rabbitMQMonitor.check(monitor, heartbeat, {});
|
||||||
|
assert.strictEqual(heartbeat.status, UP);
|
||||||
|
assert.strictEqual(heartbeat.msg, "OK");
|
||||||
|
} finally {
|
||||||
|
rabbitMQContainer.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("RabbitMQ is not running", async () => {
|
||||||
|
const rabbitMQMonitor = new RabbitMqMonitorType();
|
||||||
|
const monitor = {
|
||||||
|
rabbitmqNodes: JSON.stringify([ "http://localhost:15672" ]),
|
||||||
|
rabbitmqUsername: "rabbitmqUser",
|
||||||
|
rabbitmqPassword: "rabbitmqPass",
|
||||||
|
};
|
||||||
|
|
||||||
|
const heartbeat = {
|
||||||
|
msg: "",
|
||||||
|
status: PENDING,
|
||||||
|
};
|
||||||
|
|
||||||
|
await rabbitMQMonitor.check(monitor, heartbeat, {});
|
||||||
|
assert.strictEqual(heartbeat.status, DOWN);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in a new issue