Files
memind/release-goosed-remount-guard.test.mjs
T
john 59cfbcde6c
Memind CI / Test, build, and release guards (pull_request) Successful in 2m50s
fix: remount goosed after portal runtime swap
2026-07-17 11:51:43 +08:00

26 lines
1.2 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
const releaseScript = fs.readFileSync(
new URL('./scripts/release-portal-runtime-prod.sh', import.meta.url),
'utf8',
);
test('103 release remounts goosed after swapping the live directory', () => {
assert.match(releaseScript, /remount_goosed_after_live_swap\(\)/);
assert.match(releaseScript, /docker-compose\.prod\.yml/);
assert.match(releaseScript, /up -d --force-recreate/);
assert.match(releaseScript, /MindSpace\/\.goosed-remount-/);
assert.match(releaseScript, /containers\[@\].*!= 9/);
assert.match(releaseScript, /seq 18006 18014/);
assert.match(releaseScript, /\/opt\/portal\/mindspace-sandbox-mcp\.mjs/);
const swapIndex = releaseScript.indexOf('mv "${RUNTIME_DIR}" "${APP_DIR}"');
const remountIndex = releaseScript.indexOf('remount_goosed_after_live_swap', swapIndex);
const portalStartIndex = releaseScript.indexOf('say "启动新的 Portal runtime"');
assert.ok(swapIndex >= 0, 'live directory swap must exist');
assert.ok(remountIndex > swapIndex, 'goosed remount must happen after the live swap');
assert.ok(portalStartIndex > remountIndex, 'Portal must start only after goosed remount succeeds');
});