Publish curated Unraid-AppOps-Gateway source from 5f1a0fc2fdd07082637995b2c8b4514a1ecbbbb8
This commit is contained in:
1 parent
9787d16330
commit
75269a32eb
8 files changed
+920
-8
No files matched your search
@@ -906,6 +906,38 @@ def test_host_family_inspection_only_allows_dind_start_from_exact_empty_family(m
|
||||
assert occupied["safeToStartDindReason"] == "resource_cgroup_family_not_empty"
|
||||
|
||||
|
||||
def test_rollback_preserves_unraid_existing_hugetlb_controller(monkeypatch):
|
||||
envelope = _module()
|
||||
initial = ["cpuset", "cpu", "io", "memory", "hugetlb", "pids"]
|
||||
calls = []
|
||||
monkeypatch.setattr(envelope, "_run_host_probe", lambda mode, payload:
|
||||
calls.append((mode, payload)) or {"removed": True, "familyExists": False})
|
||||
envelope.rollback_host_cgroup_family(created=True, initial_controllers=initial)
|
||||
assert calls == [("rollback", {"created": True, "initialControllers": initial})]
|
||||
|
||||
monkeypatch.setattr(envelope, "_probe_open_family", lambda _fd: 123)
|
||||
monkeypatch.setattr(envelope, "_probe_walk", lambda _fd: [{
|
||||
"cpuMax": "800000 100000", "memoryMax": str(16 * 1024**3),
|
||||
}])
|
||||
monkeypatch.setattr(envelope, "_probe_read", lambda fd, name:
|
||||
"" if name == "cgroup.procs" else
|
||||
"cpu memory pids" if fd == 123 else " ".join(initial))
|
||||
monkeypatch.setattr(envelope.os, "close", lambda _fd: None)
|
||||
monkeypatch.setattr(envelope.os, "rmdir", lambda *args, **kwargs: None)
|
||||
writes = []
|
||||
monkeypatch.setattr(envelope, "_probe_write", lambda *args: writes.append(args))
|
||||
result = envelope._probe_rollback_family(1, {"op": "rollback", "created": True,
|
||||
"initialControllers": initial})
|
||||
assert result == {"removed": True, "familyExists": False}
|
||||
assert writes == [(123, "cgroup.subtree_control", "-cpu -memory -pids")]
|
||||
for controllers in (["unknown"], initial + ["unknown"]):
|
||||
with pytest.raises(RuntimeError, match="resource_cgroup_family_request_invalid"):
|
||||
envelope.rollback_host_cgroup_family(created=True, initial_controllers=controllers)
|
||||
with pytest.raises(RuntimeError, match="resource_cgroup_family_request_invalid"):
|
||||
envelope._probe_rollback_family(1, {"op": "rollback", "created": True,
|
||||
"initialControllers": controllers})
|
||||
|
||||
|
||||
def test_host_probe_rw_modes_are_fixed_and_limited_to_ensure_or_rollback():
|
||||
envelope = _module()
|
||||
image_id = "sha256:" + "a" * 64
|
||||
|
||||
Reference in new issue
Block a user