Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:43:26 +02:00
commit 5aa3e8d685
700 files changed
+132801

No files matched your search

@@ -0,0 +1,49 @@
import unittest
from execute import assert_original, docker_json_template, expected_labels, original_identity, verify_image
class ExecuteTests(unittest.TestCase):
def test_template_groups_function_arguments_before_json_encoding(self):
self.assertEqual(
docker_json_template(['.Id', 'index .Config.Labels "com.docker.compose.project"']),
'{{json (.Id)}}\n{{json (index .Config.Labels "com.docker.compose.project")}}',
)
def test_inspection_never_requests_environment(self):
calls = []
def runner(command):
calls.append(command)
return '"' + "a" * 64 + '"\n"sha256:' + "b" * 64 + '"\ntrue\n"healthy"\n"lumaops"'
observed = original_identity("lumaops", runner)
assert_original(observed, "lumaops", "a" * 64, "sha256:" + "b" * 64)
self.assertNotIn(".Config.Env", str(calls))
self.assertEqual(calls[0][:2], ["docker", "inspect"])
def test_runtime_drift_blocks(self):
with self.assertRaises(ValueError):
assert_original({}, "lumaops", "a" * 64, "sha256:" + "b" * 64)
def test_image_labels_are_checked_on_immutable_id(self):
metadata = {"repository": "jens/lumaops", "revision": "a" * 40,
"tree": "b" * 40, "id": "a" * 12, "builtAt": "2026-09-09T00:00:00.000Z"}
labels = expected_labels(metadata)
calls = []
def runner(command):
calls.append(command)
if command[-2] == "{{.Id}}":
return "sha256:" + "c" * 64
key = command[-2].split('"')[1]
return labels[key]
self.assertEqual(verify_image("candidate", metadata, runner), "sha256:" + "c" * 64)
self.assertTrue(all(command[-1] == "sha256:" + "c" * 64 for command in calls[1:]))
with self.assertRaises(ValueError):
verify_image("candidate", metadata, lambda command: "invalid")
if __name__ == "__main__":
unittest.main()