Publish curated Unraid-AppOps-Gateway source from 2ff7105f7d3066d6c38825540340505233836a91

This commit is contained in:
Public Source Publisher committed 2026-10-11 13:40:54 +00:00
1 parent 28e66af452
commit 98a45ead17
4 files changed
+52 -9

No files matched your search

+30 -3
View File
@@ -566,7 +566,7 @@ def test_nested_build_subordinate_ranges_cover_mapped_nonroot_ids_only():
@pytest.mark.skipif(os.name == "nt", reason="rootless Docker wrapper is Linux-only")
@pytest.mark.parametrize("bad", ["", "0 0 4294967295\n", "0 1000 1\n1 100000 65535\n",
@pytest.mark.parametrize("bad", ["", "0 0 4294967294\n", "0 1000 1\n1 100000 65535\n",
"0 1000 1\n100000 100000 65536\n", "SECRET-CANARY\n",
"0 1000 1\n1 100000 65536\n2 2 1\n", "x" * 257])
@pytest.mark.parametrize("kind", ["uid", "gid"])
@@ -589,14 +589,41 @@ def test_private_engine_refuses_wrong_parent_mapping_before_runtime_effects(tmp_
@pytest.mark.skipif(os.name == "nt", reason="rootless Docker wrapper is Linux-only")
def test_private_engine_accepts_own_supported_parent_maps_and_refuses_missing_map(tmp_path, monkeypatch):
@pytest.mark.parametrize("mapping", [" 0 1000 1\n 1 100000 65536\n",
" 0 0 4294967295\n"])
def test_private_engine_accepts_own_supported_parent_maps_and_refuses_missing_map(tmp_path, monkeypatch, mapping):
sys.path.insert(0, str(ROOT / "ops/runner-task-images/build"))
import job_docker
for kind in ("uid", "gid"):
path = tmp_path / kind
path.write_text(" 0 1000 1\n 1 100000 65536\n")
path.write_text(mapping)
monkeypatch.setattr(job_docker, kind.upper() + "_MAP_PATH", path)
job_docker._validate_parent_id_maps()
job_docker.GID_MAP_PATH.unlink()
with pytest.raises(job_docker.WrapperError, match="mapping unavailable"):
job_docker._validate_parent_id_maps()
@pytest.mark.skipif(os.name == "nt", reason="rootless Docker wrapper is Linux-only")
@pytest.mark.parametrize("rootful_kind", ["uid", "gid"])
def test_private_engine_refuses_mixed_supported_parent_maps_before_effects(tmp_path, monkeypatch, rootful_kind):
sys.path.insert(0, str(ROOT / "ops/runner-task-images/build"))
import job_docker
for kind in ("uid", "gid"):
path = tmp_path / kind
path.write_text("0 0 4294967295\n" if kind == rootful_kind else "0 1000 1\n1 100000 65536\n")
monkeypatch.setattr(job_docker, kind.upper() + "_MAP_PATH", path)
effects = []
monkeypatch.setattr(job_docker, "_ensure_runtime", lambda: effects.append("runtime"))
monkeypatch.setattr(job_docker, "_launch_daemon", lambda: effects.append("daemon"))
with pytest.raises(job_docker.WrapperError, match="mapping invalid"):
job_docker._ensure_daemon()
assert effects == []
@pytest.mark.skipif(os.name == "nt", reason="rootless Docker wrapper is Linux-only")
def test_private_engine_accepts_actual_supported_runtime_parent_namespace():
sys.path.insert(0, str(ROOT / "ops/runner-task-images/build"))
import job_docker
# Real own namespace from the Linux test container; no host /proc or effects.
job_docker._validate_parent_id_maps()