-
-
Notifications
You must be signed in to change notification settings - Fork 565
Expand file tree
/
Copy pathtest.mjs
More file actions
39 lines (32 loc) · 811 Bytes
/
test.mjs
File metadata and controls
39 lines (32 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
async function main() {
console.log("Starting HAProxy simple smoke test...");
console.log("trying to hit backend through haproxy");
let resp = await fetch(
"https://localhost:8443",
{
headers: {
"User-Agent": "Anubis testing",
}
}
);
if (resp.status !== 200) {
throw new Error(`Expected 200, got ${resp.status}`);
}
console.log("Got 200 as expected");
console.log("trying to get stopped by anubis");
resp = await fetch(
"https://localhost:8443",
{
headers: {
"User-Agent": "Mozilla/5.0",
}
}
);
if (resp.status !== 401) {
throw new Error(`Expected 401, got ${resp.status}`);
}
console.log("Got 401 as expected");
console.log("All runtime tests passed successfully!");
}
await main();