From db154edbaf7bc54d0e17ed8df0aaad2683342876 Mon Sep 17 00:00:00 2001 From: Kshitij Kapoor Date: Sat, 22 Aug 2026 17:57:53 +0530 Subject: [PATCH] test: short tmp_path for loop-tick witness sockets (macOS AF_UNIX limit) The witness tests bind real UNIX sockets under HERMES_HOME; pytest's default tmp_path on macOS exceeds the ~104-byte sockaddr_un limit and bind() raises 'AF_UNIX path too long' (6 failures locally, invisible on ubuntu CI). Module-local tmp_path override uses a short mkdtemp. --- tests/hermes_cli/test_update_wedged_gateway.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/hermes_cli/test_update_wedged_gateway.py b/tests/hermes_cli/test_update_wedged_gateway.py index 3c55a31a67..608abb941b 100644 --- a/tests/hermes_cli/test_update_wedged_gateway.py +++ b/tests/hermes_cli/test_update_wedged_gateway.py @@ -13,8 +13,10 @@ import asyncio import json import os import socket +import tempfile import threading import time +from pathlib import Path from unittest.mock import patch import pytest @@ -28,6 +30,20 @@ from gateway.shutdown_watchdog import ( ) +@pytest.fixture() +def tmp_path(): + """Short-path override for this module (macOS AF_UNIX ~104-byte limit). + + The loop-tick witness tests bind real UNIX sockets under HERMES_HOME. + pytest's default tmp_path nests deep enough on macOS that + ``state/gateway.loop-tick..sock`` exceeds the sockaddr_un limit and + ``bind()`` raises ``OSError: AF_UNIX path too long``. A mkdtemp directly + under the system temp root keeps the socket path well under the limit + on every platform. + """ + return Path(tempfile.mkdtemp(prefix="hwg-")) + + def _write_heartbeat(home, pid, age_s=0.0): """Write a heartbeat file for ``pid`` whose mtime is ``age_s`` old.""" path = get_loop_heartbeat_path(home)