26 lines
1.2 KiB
JavaScript
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');
|
|
});
|