diff options
| author | historia <historiavg@proton.me> | 2026-09-02 22:53:07 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-09-02 22:53:07 -0400 |
| commit | d04a2c53b926ccde0d582dbf4a7360dc0f072205 (patch) | |
| tree | d817622c7d32039d293c6b7d3141d40028533b96 /app/tests/test_runview.py | |
| parent | 7a7dca313750ee75e0f8a2a5442ca5d78e743294 (diff) | |
| download | tts-audiobook-generator-d04a2c53b926ccde0d582dbf4a7360dc0f072205.tar.gz | |
fix: warn before using a likely too-big chunk size for sglang-omni models
Diffstat (limited to 'app/tests/test_runview.py')
| -rw-r--r-- | app/tests/test_runview.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/tests/test_runview.py b/app/tests/test_runview.py index 501f1f7..53f0a44 100644 --- a/app/tests/test_runview.py +++ b/app/tests/test_runview.py @@ -246,6 +246,44 @@ class StateTransitionTests(_FakeTui, unittest.TestCase): self.assertEqual(view.boot_hint, "FP8 needs compute capability 8.9+") + def test_port_taken_event_is_error_with_the_port_specifics(self): + # The launcher moved the server to a random port (configured one + # taken) and the boot was killed: the error screen names the ports + # instead of sitting on "starting" until the timeout. + view, _ = self.make_view() + view.handle_event({"kind": "starting", "name": "sglomni", + "log_path": "/tmp/sglomni-server.log"}) + view.handle_event( + {"kind": "port_taken", "name": "sglomni", + "taken": 8100, "moved": 37183, + "message": "the sglomni launcher moved the server from port " + "8100 (already in use by another process) to port " + "37183; clients poll 8100, so this boot cannot " + "become ready — stop whatever holds port 8100 " + "and start again", + "log_tail": ["Using port 37183 instead."]}) + self.assertEqual(view.phase, "error") + self.assertEqual(view.server, "error") + self.assertIn("8100", view.server_message) + self.assertIn("37183", view.server_message) + self.assertEqual(view.log_tail, ["Using port 37183 instead."]) + + def test_port_taken_boot_failure_is_recorded_in_the_dated_log(self): + with tempfile.TemporaryDirectory() as tmp: + log_path = os.path.join(tmp, "audiobook_test.log") + view, _ = self.make_view(log_path=log_path) + view.handle_event({"kind": "starting", "name": "sglomni", + "log_path": "/tmp/sglomni-server.log"}) + view.handle_event({"kind": "port_taken", "name": "sglomni", + "taken": 8100, "moved": 37183, + "message": "moved from port 8100", + "log_tail": []}) + with open(log_path, encoding="utf-8") as logf: + text = logf.read() + self.assertIn("ERROR - moved from port 8100", text) + self.assertIn("the server's own output is in " + "/tmp/sglomni-server.log", text) + def test_boot_failure_is_recorded_in_the_dated_log(self): # A failed boot never reaches the converter, so without this the # dated log the failure pointers name would stay blank. |
