Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

test(install): align bootstrap and abort harness

Abdurrahman Fakhrul18e0a0f68947
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 82a1ceba..e8d6fe26 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -46,6 +46,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Tests**
+- `install` align bootstrap and abort harness
- `install` make abort recovery harness static
- `gateway` treat zombie children as stopped
- `gateway` isolate lifecycle fixtures
diff --git a/scripts/install-runtime-abort-recovery.test.ts b/scripts/install-runtime-abort-recovery.test.ts
index 9a008bb2..6247dfdd 100644
--- a/scripts/install-runtime-abort-recovery.test.ts
+++ b/scripts/install-runtime-abort-recovery.test.ts
@@ -1,29 +1,48 @@
import { spawnSync } from "node:child_process";
+import fs from "node:fs";
+import os from "node:os";
import path from "node:path";
-import { describe, expect, it } from "vitest";
+import { afterEach, describe, expect, it } from "vitest";
const FIXTURE = path.join(process.cwd(), "scripts/test-fixtures/install-runtime-abort-recovery.sh");
+const roots: string[] = [];
function runCleanup(mode: "pre" | "post") {
- return spawnSync("bash", [FIXTURE, mode], { encoding: "utf8" });
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "mso-install-abort-"));
+ roots.push(root);
+ const capture = path.join(root, "calls.log");
+ const fd = fs.openSync(capture, "w+");
+ try {
+ const out = spawnSync("bash", [FIXTURE, mode], {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "pipe", fd],
+ });
+ return { out, calls: fs.readFileSync(capture, "utf8") };
+ } finally {
+ fs.closeSync(fd);
+ }
}
+afterEach(() => {
+ for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true });
+});
+
describe("installer abort recovery", () => {
it("restores the known-good service and fallbacks when aborting before mutation", () => {
- const out = runCleanup("pre");
+ const { out, calls } = runCleanup("pre");
expect(out.status).toBe(0);
- expect(out.stdout).toContain("release-runtime");
- expect(out.stdout).toContain("sudo systemctl start mso.service");
- expect(out.stdout).toContain("restore-fallbacks");
- expect(out.stdout).toContain("release-update");
+ expect(calls).toContain("release-runtime");
+ expect(calls).toContain("sudo systemctl start mso.service");
+ expect(calls).toContain("restore-fallbacks");
+ expect(calls).toContain("release-update");
});
it("does not restart any runtime after installer mutation has started", () => {
- const out = runCleanup("post");
+ const { out, calls } = runCleanup("post");
expect(out.status).toBe(0);
- expect(out.stdout).toContain("release-runtime");
- expect(out.stdout).toContain("release-update");
- expect(out.stdout).not.toContain("systemctl start mso.service");
- expect(out.stdout).not.toContain("restore-fallbacks");
+ expect(calls).toContain("release-runtime");
+ expect(calls).toContain("release-update");
+ expect(calls).not.toContain("systemctl start mso.service");
+ expect(calls).not.toContain("restore-fallbacks");
});
});
diff --git a/scripts/install.sh b/scripts/install.sh
old mode 100755
new mode 100644
index 82196c78..da3f9e67
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -12,7 +12,7 @@ set -Eeuo pipefail
umask 077
CORE_URL="${MSO_INSTALL_CORE_URL:-https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install-core.sh}"
-CORE_SHA256="19f9e0ebde506c356c7b93c1b8afad5ea1d2a130719790f5b3d5a35c45fcd8ee"
+CORE_SHA256="8ad53d5d052795c79148e5b551543ef6aeededd16c08032a24fb612bbdbfa991"
CORE_EOF='# MSO_INSTALLER_CORE_EOF'
TMP_INSTALLER=''
diff --git a/scripts/test-fixtures/install-runtime-abort-recovery.sh b/scripts/test-fixtures/install-runtime-abort-recovery.sh
index c9a5f802..4d852b30 100644
--- a/scripts/test-fixtures/install-runtime-abort-recovery.sh
+++ b/scripts/test-fixtures/install-runtime-abort-recovery.sh
@@ -10,14 +10,14 @@ PORT=4005
DO_SERVICE=1
SERVICE=mso.service
die() { printf 'die:%s\n' "$*" >&2; exit 1; }
-sudo_do() { printf 'sudo %s\n' "$*"; }
+sudo_do() { printf 'sudo %s\n' "$*" >&3; }
systemd_ready() { return 0; }
# shellcheck source=scripts/lib/install-runtime-lifecycle.sh
. "$ROOT/scripts/lib/install-runtime-lifecycle.sh"
-runtime_exclusion_release() { printf 'release-runtime\n'; }
-update_gateway_restore_all() { printf 'restore-fallbacks\n'; }
-update_lock_release() { printf 'release-update\n'; }
+runtime_exclusion_release() { printf 'release-runtime\n' >&3; }
+update_gateway_restore_all() { printf 'restore-fallbacks\n' >&3; }
+update_lock_release() { printf 'release-update\n' >&3; }
INSTALL_RUNTIME_LIFECYCLE=1
INSTALL_RUNTIME_SERVICE_STOPPED=1