This commit is contained in:
root
2026-05-18 03:02:15 +00:00
parent 00953ad831
commit ab45c6c329
12 changed files with 233 additions and 56 deletions

View File

@@ -15,6 +15,8 @@ class NekoConfigTests(unittest.TestCase):
self.assertIn("--disable-software-rasterizer", script)
self.assertIn("--use-gl=swiftshader", script)
self.assertIn("NEKO_BROWSER_RENDER_MODE", script)
self.assertIn("--start-minimized", script)
self.assertIn("--disable-background-networking", script)
self.assertIn('prune_path "$profile_dir/BrowserMetrics"', script)
self.assertIn('prune_path "$profile_dir/Crash Reports"', script)
self.assertIn('prune_path "$profile_dir/SingletonLock"', script)
@@ -30,28 +32,29 @@ class NekoConfigTests(unittest.TestCase):
def test_google_chrome_supervisor_uses_direct_stable_command(self) -> None:
conf = (ROOT / "services" / "neko" / "google-chrome.conf").read_text(encoding="utf-8")
self.assertIn("command=/usr/bin/google-chrome", conf)
self.assertNotIn("browser-launch.sh", conf)
self.assertIn("--user-data-dir=/home/neko/.config/google-chrome", conf)
self.assertIn("command=/etc/neko/browser-launch.sh google-chrome", conf)
self.assertNotIn("--bwsi", conf)
self.assertIn("--disable-software-rasterizer", conf)
self.assertIn("autorestart=true", conf)
self.assertIn("[program:openbox]", conf)
self.assertIn("/usr/bin/openbox --config-file /etc/neko/openbox.xml", conf)
script = (ROOT / "services" / "neko" / "browser-launch.sh").read_text(encoding="utf-8")
self.assertIn('profile_dir="/home/neko/.config/google-chrome"', script)
self.assertIn('--user-data-dir="$profile_dir"', script)
def test_chromium_supervisor_uses_direct_stable_command(self) -> None:
conf = (ROOT / "services" / "neko" / "chromium.conf").read_text(encoding="utf-8")
self.assertIn("command=/usr/bin/chromium", conf)
self.assertNotIn("browser-launch.sh", conf)
self.assertIn("--user-data-dir=/home/neko/.config/chromium", conf)
self.assertIn("command=/etc/neko/browser-launch.sh chromium", conf)
self.assertNotIn("--bwsi", conf)
self.assertIn("--disable-software-rasterizer", conf)
self.assertIn("autorestart=true", conf)
self.assertIn("[program:openbox]", conf)
script = (ROOT / "services" / "neko" / "browser-launch.sh").read_text(encoding="utf-8")
self.assertIn('profile_dir="/home/neko/.config/chromium"', script)
self.assertIn('--user-data-dir="$profile_dir"', script)
def test_neko_compose_mounts_only_selected_supervisor_conf(self) -> None:
compose = (ROOT / "services" / "neko" / "docker-compose.yml").read_text(encoding="utf-8")
self.assertIn("./${NEKO_BROWSER_SUPERVISOR_CONF}:/etc/neko/supervisord/browser.conf:ro", compose)
self.assertIn("./browser-launch.sh:/etc/neko/browser-launch.sh:ro", compose)
self.assertIn("container_name: live-neko-1", compose)
self.assertIn("container_name: live-neko-2", compose)
self.assertIn("container_name: live-neko-3", compose)
@@ -60,7 +63,14 @@ class NekoConfigTests(unittest.TestCase):
self.assertIn("${NEKO_HTTP_PORT_3}:8080", compose)
self.assertNotIn("./chromium.conf:/etc/neko/supervisord/chromium.conf:ro", compose)
self.assertNotIn("./google-chrome.conf:/etc/neko/supervisord/google-chrome.conf:ro", compose)
self.assertNotIn("./browser-launch.sh:/etc/neko/browser-launch.sh:ro", compose)
def test_supervisor_uses_browser_launch_script(self) -> None:
chrome = (ROOT / "services" / "neko" / "google-chrome.conf").read_text(encoding="utf-8")
chromium = (ROOT / "services" / "neko" / "chromium.conf").read_text(encoding="utf-8")
self.assertIn("command=/etc/neko/browser-launch.sh google-chrome", chrome)
self.assertIn("command=/etc/neko/browser-launch.sh chromium", chromium)
self.assertNotIn("--start-maximized", chrome)
self.assertNotIn("--start-maximized", chromium)
def test_neko_scripts_use_family_specific_profile_dirs(self) -> None:
service_ctl = (ROOT / "scripts" / "linux" / "service_ctl.sh").read_text(encoding="utf-8")

View File

@@ -18,6 +18,18 @@ class YoutubeRuntimeTests(unittest.TestCase):
self.assertEqual(normalize_youtube_video_save_type("ts", "tiktok"), "TS")
self.assertEqual(normalize_youtube_video_save_type("unknown", "tiktok"), "TS")
def test_push_defaults_use_lighter_profile(self) -> None:
from pathlib import Path
from tempfile import TemporaryDirectory
from douyin_youtube_ffplay import _load_youtube_push_settings
with TemporaryDirectory() as tmp:
cfg = Path(tmp) / "youtube.ini"
cfg.write_text("[youtube]\nkey = abc\n", encoding="utf-8")
settings = _load_youtube_push_settings(str(cfg))
self.assertEqual(settings["b_v"], "2800k")
self.assertTrue(settings["fast_audio"])
def test_arm_falls_back_from_vaapi_to_v4l2m2m(self) -> None:
enc, note = resolve_live_video_encoder(
"h264_vaapi",