feat(install): build the Flutter web app in Docker, optional ./install --apk, chosen web password, startup report
This commit is contained in:
@@ -177,13 +177,38 @@ class ManageNativeTests(unittest.TestCase):
|
||||
self.assertEqual(calls[0], ["launchctl", "enable", f"gui/{os.getuid()}/net.a-wan.pipelines"])
|
||||
self.assertIn(["launchctl", "kickstart", f"gui/{os.getuid()}/net.a-wan.pipelines"], calls)
|
||||
|
||||
def test_report_prints_the_server_block_and_access(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
(root / "logs").mkdir()
|
||||
(root / "logs/server.log").write_text(
|
||||
"== Pipelines server v1\n API x\n==\nold\n"
|
||||
"== Pipelines server v2\n API y\n== Backends\n Chat opencode\n==\nlater line\n")
|
||||
(root / "app-web").mkdir()
|
||||
(root / "app-web/index.html").write_text("app")
|
||||
(root / "updates").mkdir()
|
||||
config = self.config(root)
|
||||
config["web"] = {"host": "0.0.0.0", "port": 8082, "auth_file": "/private/auth.json",
|
||||
"root": str(root / "app-web"), "updates": str(root / "updates")}
|
||||
config["opencode_env"] = {"PIPELINES_WEB_PUBLIC_URL": "http://10.0.0.2:8082"}
|
||||
output = io.StringIO()
|
||||
with redirect_stdout(output):
|
||||
manage.report(config)
|
||||
text = output.getvalue()
|
||||
self.assertIn("== Pipelines server v2\n API y\n== Backends\n Chat opencode\n==\n", text)
|
||||
self.assertNotIn("v1", text)
|
||||
self.assertIn("http://10.0.0.2:8082 (password in /private/auth.json)", text)
|
||||
self.assertIn("Web app installed", text)
|
||||
self.assertIn("not built; run ./install --apk", text)
|
||||
|
||||
def test_supervisor_spawns_authenticated_web_and_cleans_up_on_exit(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
(root / "logs").mkdir()
|
||||
config = self.config(root)
|
||||
config["web"] = {"node": "/bin/node", "script": "/prefix/lib/web/serve.mjs",
|
||||
"host": "0.0.0.0", "port": 8082, "auth_file": "/private/auth.json"}
|
||||
"host": "0.0.0.0", "port": 8082, "auth_file": "/private/auth.json",
|
||||
"root": "/prefix/lib/app-web", "updates": "/prefix/lib/app-updates"}
|
||||
ntfy, server, web = MagicMock(), MagicMock(), MagicMock()
|
||||
ntfy.poll.return_value = None
|
||||
server.poll.return_value = None
|
||||
@@ -196,7 +221,9 @@ class ManageNativeTests(unittest.TestCase):
|
||||
manage.supervise(config)
|
||||
call = popen.call_args_list[1]
|
||||
self.assertEqual(call.args[0], ["/bin/node", "/prefix/lib/web/serve.mjs", "--port", "8082",
|
||||
"--host", "0.0.0.0", "--pipelines", "127.0.0.1:8080"])
|
||||
"--host", "0.0.0.0", "--pipelines", "127.0.0.1:8080",
|
||||
"--root", "/prefix/lib/app-web",
|
||||
"--updates", "/prefix/lib/app-updates"])
|
||||
self.assertNotIn("PIPELINES_WEB_AUTH", call.kwargs["env"])
|
||||
self.assertEqual(call.kwargs["env"]["PIPELINES_WEB_AUTH_FILE"], "/private/auth.json")
|
||||
web.terminate.assert_called_once()
|
||||
|
||||
Reference in New Issue
Block a user