Initial commit — SvelteKit fleet manager for T5 Plutonium servers
Ports push_scripts.sh (1497 lines of bash) to a SvelteKit + SQLite web app that manages a fleet of T5 Plutonium servers running on Komodo. Same push and beta workflow as the shell script, with a live SSE pipeline view, a !rt-token-gated auth modal that hard-pauses deployments on stale tokens, per-file audit diffs, and a Komodo-container deployment target. - Push/beta engines port the exact filter, held-by-beta, conflict, and stale-backup rules from the shell script - SQLite (better-sqlite3) replaces script_metadata.json; a one-shot importer moves legacy state over on first boot - 16 vitest tests cover push add/update/skip, beta open→rollback, open→promote, conflict guards, sweep frozen/manual branches, and IW4M login/status parsing - docker/ + komodo/stack.toml deploy as a managed container on the same host as the game servers, /root/zombies bind-mounted at the same path the shell script used
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { newFixture, type Fixture } from '../helpers/fixture.js';
|
||||
|
||||
let fixture: Fixture;
|
||||
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
fixture = await newFixture(
|
||||
{
|
||||
'hud.gsc': 'v1',
|
||||
'zom.gsc': 'v1',
|
||||
'perks/perk1.gsc': 'p1'
|
||||
},
|
||||
['t5_kino_1', 't5_ascension_1']
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await fixture.cleanup();
|
||||
});
|
||||
|
||||
describe('doPush', () => {
|
||||
it('adds every source file on a fresh server', async () => {
|
||||
const { doPush } = await import('../../src/lib/server/fleet/push.js');
|
||||
const { seedServerRegistry } = await import('../../src/lib/server/fleet/servers.js');
|
||||
await seedServerRegistry();
|
||||
|
||||
const res = await doPush({ patterns: ['*'], dryRun: false, create: false });
|
||||
expect(res.totalChangedServers).toBe(2);
|
||||
expect(res.totalFiles).toBe(3 * 2);
|
||||
expect(res.deploymentId).toBeTruthy();
|
||||
|
||||
const written = await readFile(join(fixture.t5, 't5_kino_1', 'runtime/plutonium/storage/t5/raw/scripts/sp/hud.gsc'), 'utf8');
|
||||
expect(written).toBe('v1');
|
||||
});
|
||||
|
||||
it('dry-run makes no changes and creates no deployment row', async () => {
|
||||
const { doPush } = await import('../../src/lib/server/fleet/push.js');
|
||||
const { seedServerRegistry } = await import('../../src/lib/server/fleet/servers.js');
|
||||
await seedServerRegistry();
|
||||
|
||||
const res = await doPush({ patterns: ['*'], dryRun: true, create: false });
|
||||
expect(res.deploymentId).toBeNull();
|
||||
expect(res.totalChangedServers).toBe(2);
|
||||
|
||||
// no file created
|
||||
await expect(readFile(join(fixture.t5, 't5_kino_1', 'runtime/plutonium/storage/t5/raw/scripts/sp/hud.gsc'))).rejects.toThrow();
|
||||
});
|
||||
|
||||
it('skips servers that are already up to date', async () => {
|
||||
const { doPush } = await import('../../src/lib/server/fleet/push.js');
|
||||
const { seedServerRegistry } = await import('../../src/lib/server/fleet/servers.js');
|
||||
await seedServerRegistry();
|
||||
await doPush({ patterns: ['*'], dryRun: false });
|
||||
|
||||
// second run: everything matches → no deployment
|
||||
const res = await doPush({ patterns: ['*'], dryRun: false });
|
||||
expect(res.deploymentId).toBeNull();
|
||||
expect(res.totalChangedServers).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user