Messer-Server für die Seitenwahl: 5v5/2v2, im Admin startbar, setzen sich nach der Runde selbst zurück

This commit is contained in:
mregosar committed 2026-10-29 20:33:15 +01:00
1 parent 0bfac952b6
commit c6c39b914f
15 files changed
+717 -14

No files matched your search

+29
View File
@@ -545,3 +545,32 @@ test('Archiv: nur abgeschlossene Matches, eigene Liste, automatisch nach Frist',
await close();
}
});
test('Messer-Server: nur Admin startet, Startseite sieht laufende, Ports zählen bei der Vergabe mit', async () => {
const { app, call, close } = await setup({ adminPassword: 'admin-geheim' });
try {
assert.equal((await call('POST', '/admin/knife', { body: {} })).status, 401);
const token = (await call('POST', '/admin/login', { body: { password: 'admin-geheim' } })).body.token;
const info = (await call('GET', '/admin/knife', { token })).body;
assert.deepEqual(info.modes.map((m) => m.id).sort(), ['competitive', 'wingman']);
const created = await call('POST', '/admin/knife', { token, body: { mode: 'competitive', map: 'de_inferno' } });
assert.equal(created.status, 200, JSON.stringify(created.body));
// Noch nicht bereit: Startseite zeigt ihn nicht
assert.equal((await call('GET', '/knife-servers')).body.servers.length, 0);
await app.knife.poll();
await waitFor(() => app.knife.row(created.body.id).status === 'running', { label: 'Messer-Server bereit' });
const pub = (await call('GET', '/knife-servers')).body.servers;
assert.equal(pub.length, 1);
assert.equal(pub[0].map, 'de_inferno');
assert.ok(!JSON.stringify(pub).includes(app.knife.row(created.body.id).rcon_password));
// Ports des Messer-Servers sind für Matches belegt
const row = app.knife.row(created.body.id);
assert.ok(app.manager.usedPortsOn(row.host).has(row.port));
assert.equal((await call('DELETE', `/admin/knife/${created.body.id}`, { token })).status, 200);
assert.equal(app.knife.list().length, 0);
} finally {
await close();
}
});