Publish curated Unraid-AppOps-Gateway source from ae6b891c48da412de613ce0ed52c0bc1e9908fbf
This commit is contained in:
1 parent
5a5fc4d5b9
commit
aa9f7d178c
4 files changed
+275
-12
No files matched your search
@@ -23,10 +23,11 @@ import pytest
|
||||
"resource_cgroup_attestation_failed", "resource_cgroup_v2_unavailable",
|
||||
"Bearer secret-value", None,
|
||||
])
|
||||
def test_build_resource_refusal_keeps_only_allowlisted_private_cause(specialize, monkeypatch, reason):
|
||||
@pytest.mark.parametrize("sample_stage", ["after_snapshot", "Bearer secret-value", {"secret": "value"}, None])
|
||||
def test_build_resource_refusal_keeps_only_allowlisted_private_cause(specialize, monkeypatch, reason, sample_stage):
|
||||
monkeypatch.setattr(specialize, "_docker_outer_inventory", lambda: ([], []))
|
||||
monkeypatch.setattr(specialize, "attest_build_probe_workload", lambda *_a, **_k: {
|
||||
"ready": False, "reason": reason,
|
||||
"ready": False, "reason": reason, "sampleStage": sample_stage,
|
||||
})
|
||||
with pytest.raises(specialize.RunnerFleetSpecializeError) as error:
|
||||
specialize._build_probe_resource_attestation({"containerId": "a" * 64}, {"State": {"Pid": 77}})
|
||||
@@ -45,6 +46,10 @@ def test_build_resource_refusal_keeps_only_allowlisted_private_cause(specialize,
|
||||
}, error.value)
|
||||
assert len(records) == 1
|
||||
assert records[0]["causeCode"] == (reason if reason in specialize._RESOURCE_FAILURE_CODES else str(error.value))
|
||||
if reason == "resource_cgroup_process_mapping_invalid" and sample_stage == "after_snapshot":
|
||||
assert records[0]["sampleStage"] == "after_snapshot"
|
||||
else:
|
||||
assert "sampleStage" not in records[0]
|
||||
assert "secret-value" not in json.dumps(records)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user