This is an automated email from the ASF dual-hosted git repository.

zyxxoo pushed a commit to branch refactor/rust-rewrite-design
in repository https://gitbox.apache.org/repos/asf/hugegraph.git


The following commit(s) were added to refs/heads/refactor/rust-rewrite-design 
by this push:
     new 4415a6a14 test(oracle): add offline history capture coverage
4415a6a14 is described below

commit 4415a6a14077ae31e7649b71ef00d60d8d735fc9
Author: vaughn <[email protected]>
AuthorDate: Sun Sep 13 16:17:44 2026 +0800

    test(oracle): add offline history capture coverage
---
 tools/raft-linearizability/test_capture_history.py | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tools/raft-linearizability/test_capture_history.py 
b/tools/raft-linearizability/test_capture_history.py
new file mode 100644
index 000000000..bd18d1a1f
--- /dev/null
+++ b/tools/raft-linearizability/test_capture_history.py
@@ -0,0 +1,37 @@
+import importlib.util
+import json
+from pathlib import Path
+from unittest.mock import patch
+
+spec = importlib.util.spec_from_file_location(
+    "capture_history", Path(__file__).with_name("capture_history.py"))
+module = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(module)
+
+
+class Response:
+    def __init__(self, body):
+        self.body = body
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *_):
+        return False
+
+    def read(self):
+        return self.body
+
+
+def test_capture_records_write_and_read():
+    responses = [Response(b"{}"), Response(json.dumps({"value": 7}).encode())]
+    with patch.object(module.OPENER, "open", side_effect=responses):
+        history = module.capture("http://example.invalid";, 7)
+    assert [item["op"] for item in history] == ["write", "read"]
+    assert history[1]["value"] == 7
+    assert all(item["start"] <= item["end"] for item in history)
+
+
+if __name__ == "__main__":
+    test_capture_records_write_and_read()
+    print("capture history tests passed")

Reply via email to