Admin: Live-Konsole der Container und Live-Log der Docker-Hosts (nur lesen, Passwörter ausgeblendet)

This commit is contained in:
mregosar committed 2026-11-01 17:16:58 +01:00
1 parent fb96fb5d08
commit ee9c488a7e
9 files changed
+328 -3

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { formatDockerEvent } from '../src/servers/dockerAdapter.js';
const ev = (o) => JSON.stringify({ time: 1793549403, ...o });
test('Docker-Ereignisse werden lesbar, App-Container markiert', () => {
const start = formatDockerEvent(ev({ Type: 'container', Action: 'start', Actor: { ID: 'abc', Attributes: { name: 'cs2mv-knife1', image: 'joedwards32/cs2:latest', 'cs2-mapveto': '1' } } }));
assert.match(start, /Container cs2mv-knife1 \[Mapveto\] gestartet \(joedwards32\/cs2:latest\)$/);
const die = formatDockerEvent(ev({ Type: 'container', Action: 'die', Actor: { ID: 'abc', Attributes: { name: 'gitea', exitCode: '137' } } }));
assert.match(die, /Container gitea beendet \(Exit-Code 137\)$/);
assert.match(formatDockerEvent(ev({ Type: 'image', Action: 'pull', Actor: { ID: 'joedwards32/cs2:latest', Attributes: { name: 'joedwards32/cs2' } } })), /Image joedwards32\/cs2 geladen/);
});
test('Healthchecks, Mounts und kaputte Zeilen fallen weg', () => {
assert.equal(formatDockerEvent(ev({ Type: 'container', Action: 'exec_start: /bin/sh -c mysql --password=geheim', Actor: { Attributes: {} } })), null);
assert.equal(formatDockerEvent(ev({ Type: 'volume', Action: 'mount', Actor: { Attributes: {} } })), null);
assert.equal(formatDockerEvent('kein json'), null);
});