Files
pipelines/scripts/test_installation.py
T
alan fc7dbb0ac0 Remove ntfy: notifications go only through the app notification stream
Server: drop ntfy publishing (stage hooks, run outbox, chat attention, chat
tool notify, auto-switch and schedule notices), the chat push outbox (its
table is dropped at startup), ntfy status/endpoints and PIPELINES_NTFY_*.
The app_notifications stream, subscribe/clear and kinds are unchanged.
Notification settings keep run_finished/chat_needs_you/chat_reply_finished;
ntfy_enabled is accepted and ignored and its stored row is never read.

Stage type=ntfy is rejected: "ntfy stages were removed; notifications go to
the Pipelines apps — use the stage notify hook". The notify hook remains.

Installer: no ntfy build, accounts, config or supervisor child; manifest
gets top-level "mode" (legacy ntfy.mode still read). Reinstall retires an
old ntfy (safe PID-file stop, deletes binary, config, data dir, token, log,
with a note in logs/install.log); uninstall cleans leftovers.

App: ntfy settings section replaced by "Notification events"; texts updated.
Docs: docs/ntfy.md folded into docs/notifications.md; install, docker, cli,
author skill references updated; security review M1 marked resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 23:24:24 +00:00

61 lines
2.9 KiB
Python

import os
from pathlib import Path
import subprocess
import tempfile
import unittest
import manage
class InstallationTests(unittest.TestCase):
def test_native_installer_is_the_default_entrypoint(self):
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),"--help"],capture_output=True,text=True)
self.assertEqual(result.returncode,0)
self.assertIn("--prefix",result.stdout)
self.assertNotIn("--ntfy",result.stdout)
def test_docker_installer_is_available_explicitly(self):
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),"--docker","--help"],capture_output=True,text=True)
self.assertEqual(result.returncode,0)
self.assertNotIn("--ntfy",result.stdout)
self.assertIn("--relogin",result.stdout)
def dispatch(self,*args):
with tempfile.TemporaryDirectory() as directory:
root=Path(directory)
capture=root/"args"
executable=root/"python3"
executable.write_text('#!/bin/sh\nprintf "%s\\n" "$@" > "'+str(capture)+'"\n')
executable.chmod(0o700)
env=dict(os.environ,PATH=str(root)+os.pathsep+os.environ["PATH"])
subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),*args],env=env,stdin=subprocess.DEVNULL,check=True)
return capture.read_text().splitlines()
def test_default_installer_delegates_to_native_without_terminal(self):
self.assertEqual(self.dispatch(),["scripts/setup-native.py"])
def test_explicit_modes_dispatch_to_the_right_installer(self):
self.assertEqual(self.dispatch("--native"),["scripts/setup-native.py"])
self.assertEqual(self.dispatch("native"),["scripts/setup-native.py"])
self.assertEqual(self.dispatch("--docker"),["scripts/setup-docker.py"])
self.assertEqual(self.dispatch("docker"),["scripts/setup-docker.py"])
def test_docker_mode_forwards_docker_options(self):
self.assertEqual(self.dispatch("--docker","--timezone","Europe/London"),
["scripts/setup-docker.py","--timezone","Europe/London"])
def test_standard_installer_rejects_legacy_provisioning_flags(self):
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--system-command"],capture_output=True,text=True)
self.assertEqual(result.returncode,2)
self.assertIn("unrecognized arguments",result.stderr)
def test_legacy_management_requires_owned_marker(self):
with tempfile.TemporaryDirectory() as directory:
with self.assertRaises(ValueError):manage.load(directory)
def test_legacy_pid_reuse_cannot_signal_unrelated_process(self):
with tempfile.TemporaryDirectory() as directory:
Path(directory,"supervisor.pid").write_text(str(os.getpid()))
self.assertIsNone(manage.managed_pid(dict(prefix=directory)))
if __name__=="__main__":unittest.main()