From cd1abafb212a8be1bcea136b4892a779eab6dff4 Mon Sep 17 00:00:00 2001 From: Amantux Date: Sun, 11 Oct 2026 05:37:51 +0000 Subject: [PATCH] test(protocols): SMB ACL scenario accepts the host gid in either Samba rendering mode640.txt is written host-side by rig.py, so its group is whatever gid runs the suite. Samba renders a gid it can resolve by name ("Unix Group\\root" locally) and an unresolvable one numerically ("Unix Group\\1001" on a GitHub-hosted runner). The assertion hard-coded root and failed on the first ever full-suite run on master; it now derives the expected group from the file's real gid and accepts both forms. Mutation-checked: a wrong gid fails. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016uyKrkqBY5KxLuSjotaVGD --- tests/e2e/protocols/test_smb.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/e2e/protocols/test_smb.py b/tests/e2e/protocols/test_smb.py index ebd84d3..9d9c152 100644 --- a/tests/e2e/protocols/test_smb.py +++ b/tests/e2e/protocols/test_smb.py @@ -1,8 +1,12 @@ """SMB (Samba, kernel cifs vers=3.0) protocol scenarios.""" +import grp +import os + import pytest from tests.e2e.protocols.conftest import Rig +from tests.e2e.protocols.rig import STATE as _RIG_STATE from tests.e2e.protocols.scenarios import * # noqa: F403 -- re-collect the shared scenarios bound to proto=smb pytestmark = pytest.mark.protocols @@ -33,7 +37,12 @@ def test_smb_acl_maps_posix_mode(mounted: Rig) -> None: lines = res.stdout.splitlines() owner = next(line.split(":", 1)[1] for line in lines if line.startswith("OWNER:")) assert f"ACL:{owner}:ALLOWED/0x0/RW" in lines, res.stdout - assert "ACL:Unix Group\\root:ALLOWED/0x0/R" in lines, res.stdout + # mode640.txt is written host-side by rig.py, so its group is the host gid. Samba + # renders a gid it can resolve by name ("root" locally) and an unresolvable one + # numerically (1001 on a GitHub runner); accept the real gid under either form. + gid = os.stat(_RIG_STATE / "export" / "ro" / "mode640.txt").st_gid + group_names = {grp.getgrgid(gid).gr_name, str(gid)} + assert any(f"ACL:Unix Group\\{g}:ALLOWED/0x0/R" in lines for g in group_names), res.stdout assert "ACL:Everyone:ALLOWED/0x0/" in lines, res.stdout