05ae530442
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers. Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent. Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
61 lines
3.0 KiB
Python
61 lines
3.0 KiB
Python
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
import manage
|
|
|
|
|
|
class InstallationTests(unittest.TestCase):
|
|
def test_docker_installer_is_available_through_main_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("--ntfy-url",result.stdout)
|
|
self.assertIn("--relogin",result.stdout)
|
|
|
|
def test_default_installer_delegates_to_docker_without_terminal(self):
|
|
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")],env=env,stdin=subprocess.DEVNULL,check=True)
|
|
self.assertEqual(capture.read_text().splitlines(),["scripts/setup-docker.py"])
|
|
|
|
def test_default_installer_forwards_docker_options(self):
|
|
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--help"],capture_output=True,text=True)
|
|
self.assertEqual(result.returncode,0)
|
|
self.assertIn("--ntfy-url",result.stdout)
|
|
|
|
def test_native_installer_is_rejected_without_running_go(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
root=Path(directory)
|
|
capture=root/"args"
|
|
executable=root/"go"
|
|
executable.write_text('#!/bin/sh\nprintf "%s\\n" "$GOBIN" "$@" >> "'+str(capture)+'"\n')
|
|
executable.chmod(0o700)
|
|
env=dict(os.environ,PATH=str(root)+os.pathsep+os.environ["PATH"],GOBIN=str(root/"bin"))
|
|
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),"--native"],env=env,capture_output=True,text=True)
|
|
self.assertEqual(result.returncode,2)
|
|
self.assertIn("Run ./install",result.stderr)
|
|
self.assertFalse(capture.exists())
|
|
self.assertFalse((root/"bin").exists())
|
|
|
|
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()
|