Publish curated Unraid-AppOps-Gateway source from 98b19114655572fd0244dbd68420e8491a4337d5
This commit is contained in:
1 parent
51f3bc0d4a
commit
978fb04c99
4 files changed
+228
-25
No files matched your search
@@ -979,6 +979,40 @@ def test_probe_cleanup_refuses_foreign_running_or_changed_identity(monkeypatch,
|
||||
envelope.cleanup_stopped_host_probe(image_id=image_id, code_source=code_source)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("drift", [None, "extra_mount", "changed_mount_field", "changed_unknown_mount_field",
|
||||
"changed_top_level_field", "changed_host_mounts", "changed_state"])
|
||||
def test_probe_cleanup_cas_ignores_only_complete_mount_collection_order(monkeypatch, drift):
|
||||
envelope = _module()
|
||||
probe, image_id, code_source = _host_probe_fixture(envelope)
|
||||
fresh = copy.deepcopy(probe)
|
||||
fresh["Mounts"].reverse()
|
||||
if drift == "extra_mount":
|
||||
fresh["Mounts"].append(copy.deepcopy(fresh["Mounts"][0]))
|
||||
elif drift == "changed_mount_field":
|
||||
fresh["Mounts"][0]["RW"] = True
|
||||
elif drift == "changed_unknown_mount_field":
|
||||
fresh["Mounts"][0]["unexpectedMetadata"] = "changed"
|
||||
elif drift == "changed_top_level_field":
|
||||
fresh["unexpectedMetadata"] = "changed"
|
||||
elif drift == "changed_host_mounts":
|
||||
fresh["HostConfig"]["Mounts"].reverse()
|
||||
elif drift == "changed_state":
|
||||
fresh["State"]["unexpectedMetadata"] = "changed"
|
||||
monkeypatch.setattr(envelope, "_host_probe_image_labels", lambda _: {})
|
||||
inspected = iter([probe, fresh, None])
|
||||
monkeypatch.setattr(envelope, "_inspect_host_probe_by_name", lambda: next(inspected))
|
||||
removed = []
|
||||
monkeypatch.setattr(envelope, "_remove_cleanup_probe", lambda identifier: removed.append(identifier))
|
||||
if drift is None:
|
||||
assert envelope.cleanup_stopped_host_probe(image_id=image_id, code_source=code_source)
|
||||
assert removed == [probe["Id"]]
|
||||
else:
|
||||
with pytest.raises(RuntimeError, match="resource_cgroup_probe_cleanup_identity_changed"):
|
||||
envelope.cleanup_stopped_host_probe(image_id=image_id, code_source=code_source)
|
||||
assert removed == []
|
||||
assert fresh != probe
|
||||
|
||||
|
||||
@pytest.mark.parametrize("stderr,condition", [
|
||||
(b"private-canary: no space left on device", "remove_storage_full"),
|
||||
(b"private-canary: read-only file system", "remove_read_only"),
|
||||
|
||||
Reference in new issue
Block a user