Admin: Live-Konsole der Container und Live-Log der Docker-Hosts (nur lesen, Passwörter ausgeblendet)
This commit is contained in:
1 parent
fb96fb5d08
commit
ee9c488a7e
9 files changed
+328
-3
No files matched your search
@@ -690,3 +690,26 @@ test('Chat: Match-Chat für beide Teams und Organisator, Team-Chat nur fürs eig
|
||||
await close();
|
||||
}
|
||||
});
|
||||
test('Konsole: nur für Admins, Ausgabe kommt live, unbekannte Server 404', async () => {
|
||||
const { app, call, close } = await setup({ adminPassword: 'admin-geheim' });
|
||||
try {
|
||||
const token = (await call('POST', '/admin/login', { body: { password: 'admin-geheim' } })).body.token;
|
||||
const m = (await call('POST', '/matches', { body: { teamA: 'Alpha', teamB: 'Bravo', mode: 'wingman', format: 'bo1' } })).body;
|
||||
await waitFor(() => app.service.serverRow(m.id)?.handle, { label: 'Server gestartet' });
|
||||
const base = `http://127.0.0.1:${app.server.address().port}/api/admin/logs`;
|
||||
|
||||
assert.equal((await fetch(`${base}/match/${m.id}`)).status, 401);
|
||||
assert.equal((await fetch(`${base}/match/gibtsnicht`, { headers: { authorization: `Bearer ${token}` } })).status, 404);
|
||||
assert.equal((await fetch(`${base}/sonstwas/${m.id}`, { headers: { authorization: `Bearer ${token}` } })).status, 404);
|
||||
|
||||
const ctl = new AbortController();
|
||||
const res = await fetch(`${base}/match/${m.id}`, { headers: { authorization: `Bearer ${token}` }, signal: ctl.signal });
|
||||
assert.equal(res.status, 200);
|
||||
const reader = res.body.getReader();
|
||||
const { value } = await reader.read();
|
||||
assert.match(new TextDecoder().decode(value), /Demo-Adapter/);
|
||||
ctl.abort();
|
||||
} finally {
|
||||
await close();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user