mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-14 21:34:45 +00:00
Compare commits
No commits in common. "1a98012cbd8f5401f3edcfe154dd0f9c2aa0729b" and "587699d7b3a523c977a977d8cdadc737df65189d" have entirely different histories.
1a98012cbd
...
587699d7b3
2 changed files with 69 additions and 92 deletions
2
.github/workflows/auto-test.yml
vendored
2
.github/workflows/auto-test.yml
vendored
|
@ -78,7 +78,7 @@ jobs:
|
||||||
|
|
||||||
e2e-test:
|
e2e-test:
|
||||||
needs: [ ]
|
needs: [ ]
|
||||||
runs-on: ubuntu-24.04-arm
|
runs-on: ARM64
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
|
@ -1,29 +1,9 @@
|
||||||
const { describe, test } = require("node:test");
|
const test = require("node:test");
|
||||||
const assert = require("node:assert");
|
const assert = require("node:assert");
|
||||||
const { websocket } = require("../../server/monitor-types/websocket");
|
const { websocket } = require("../../server/monitor-types/websocket");
|
||||||
const { UP, DOWN, PENDING } = require("../../src/util");
|
const { UP, DOWN, PENDING } = require("../../src/util");
|
||||||
|
|
||||||
describe("Websocket Test", {
|
test("Test Websocket TLS", async () => {
|
||||||
}, () => {
|
|
||||||
test("Non Websocket Server", {}, async () => {
|
|
||||||
const websocketMonitor = new websocket();
|
|
||||||
|
|
||||||
const monitor = {
|
|
||||||
wsurl: "wss://example.org",
|
|
||||||
wsIgnoreHeaders: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
const heartbeat = {
|
|
||||||
msg: "",
|
|
||||||
status: PENDING,
|
|
||||||
};
|
|
||||||
|
|
||||||
await websocketMonitor.check(monitor, heartbeat, {});
|
|
||||||
assert.strictEqual(heartbeat.status, DOWN);
|
|
||||||
assert.strictEqual(heartbeat.msg, "Unexpected server response: 200");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Secure Websocket", async () => {
|
|
||||||
const websocketMonitor = new websocket();
|
const websocketMonitor = new websocket();
|
||||||
|
|
||||||
const monitor = {
|
const monitor = {
|
||||||
|
@ -39,11 +19,9 @@ describe("Websocket Test", {
|
||||||
await websocketMonitor.check(monitor, heartbeat, {});
|
await websocketMonitor.check(monitor, heartbeat, {});
|
||||||
assert.strictEqual(heartbeat.status, UP);
|
assert.strictEqual(heartbeat.status, UP);
|
||||||
assert.strictEqual(heartbeat.msg, "101 - OK");
|
assert.strictEqual(heartbeat.msg, "101 - OK");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Insecure Websocket", {
|
test("Test Websocket non TLS", async () => {
|
||||||
skip: !!process.env.CI,
|
|
||||||
}, async () => {
|
|
||||||
const websocketMonitor = new websocket();
|
const websocketMonitor = new websocket();
|
||||||
|
|
||||||
const monitor = {
|
const monitor = {
|
||||||
|
@ -59,9 +37,9 @@ describe("Websocket Test", {
|
||||||
await websocketMonitor.check(monitor, heartbeat, {});
|
await websocketMonitor.check(monitor, heartbeat, {});
|
||||||
assert.strictEqual(heartbeat.status, UP);
|
assert.strictEqual(heartbeat.status, UP);
|
||||||
assert.strictEqual(heartbeat.msg, "101 - OK");
|
assert.strictEqual(heartbeat.msg, "101 - OK");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test a non compliant WS server without ignore", async () => {
|
test("Test a non compliant WS server without ignore", async () => {
|
||||||
const websocketMonitor = new websocket();
|
const websocketMonitor = new websocket();
|
||||||
|
|
||||||
const monitor = {
|
const monitor = {
|
||||||
|
@ -77,9 +55,9 @@ describe("Websocket Test", {
|
||||||
await websocketMonitor.check(monitor, heartbeat, {});
|
await websocketMonitor.check(monitor, heartbeat, {});
|
||||||
assert.strictEqual(heartbeat.status, DOWN);
|
assert.strictEqual(heartbeat.status, DOWN);
|
||||||
assert.strictEqual(heartbeat.msg, "Invalid Sec-WebSocket-Accept header");
|
assert.strictEqual(heartbeat.msg, "Invalid Sec-WebSocket-Accept header");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Test a non compliant WS server with ignore", async () => {
|
test("Test a non compliant WS server with ignore", async () => {
|
||||||
const websocketMonitor = new websocket();
|
const websocketMonitor = new websocket();
|
||||||
|
|
||||||
const monitor = {
|
const monitor = {
|
||||||
|
@ -95,5 +73,4 @@ describe("Websocket Test", {
|
||||||
await websocketMonitor.check(monitor, heartbeat, {});
|
await websocketMonitor.check(monitor, heartbeat, {});
|
||||||
assert.strictEqual(heartbeat.status, UP);
|
assert.strictEqual(heartbeat.status, UP);
|
||||||
assert.strictEqual(heartbeat.msg, "101 - OK");
|
assert.strictEqual(heartbeat.msg, "101 - OK");
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue