Download dev/tests/web/t_flood.js from mchuca/ServerMonitor: direct link, hf CLI and curl.
- Browser
- Download file 888 Bytes
-
https://huggingface.co/mchuca/ServerMonitor/resolve/main/dev/tests/web/t_flood.js
- Command line
-
hf download hf://mchuca/ServerMonitor/dev/tests/web/t_flood.js
-
curl -L -o t_flood.js https://huggingface.co/mchuca/ServerMonitor/resolve/main/dev/tests/web/t_flood.js
888 Bytes
| // a console command with endless output must not take the monitor down. node t_flood.js <port> | |
| const { sleep, client, check, done } = require('./lib'), { req, post } = client(process.argv[2]); | |
| (async () => { | |
| const t = Date.now(); | |
| const r = await req('POST', '/api/exec', { id: 'local1', cmd: 'yes 0123456789012345678901234567890123456789' }).catch(e => ({ status: 0, text: String(e) })); | |
| check('endless output: the command is stopped and reported', r.status === 200 && r.json.code === -1 && r.json.out.length < 6e6, `status ${r.status} after ${Date.now() - t} ms, ${r.json ? r.json.out.length + ' chars, …' + JSON.stringify(r.json.out.slice(-40)) : r.text}`); | |
| await sleep(1500); | |
| const s = await req('GET', '/api/state').catch(e => ({ status: 0, text: String(e) })); | |
| check('the monitor is still running', s.status === 200, s.status || s.text); | |
| done(); | |
| })(); | |