Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /terrene-foundation_kailash-py /tests /integration /nodes /transaction /conftest.py
| """Shared fixtures for 2PC and saga integration tests. | |
| Registers real participant nodes that handle prepare/commit/abort operations | |
| so that RegistryNodeExecutor can resolve them. NO MOCKING — these are real | |
| node implementations that track their invocations via shared state. | |
| """ | |
| from kailash.nodes.base import NodeParameter, register_node | |
| from kailash.nodes.base_async import AsyncNode | |
| class TestParticipantNode(AsyncNode): | |
| """A real node that handles 2PC participant operations (prepare/commit/abort). | |
| This is a genuine node registered in the NodeRegistry, not a mock. | |
| It tracks all invocations in a class-level list for test assertions. | |
| """ | |
| # Class-level invocation tracking (shared across all instances) | |
| invocations = [] | |
| def get_parameters(self): | |
| return { | |
| "operation": NodeParameter( | |
| name="operation", | |
| type=str, | |
| default="prepare", | |
| description="2PC operation: prepare, commit, or abort", | |
| ), | |
| "transaction_id": NodeParameter( | |
| name="transaction_id", | |
| type=str, | |
| required=False, | |
| description="Transaction ID", | |
| ), | |
| } | |
| async def async_run(self, **inputs): | |
| operation = inputs.get("operation", "prepare") | |
| tx_id = inputs.get("transaction_id", "unknown") | |
| TestParticipantNode.invocations.append( | |
| { | |
| "operation": operation, | |
| "transaction_id": tx_id, | |
| "node_name": self.name if hasattr(self, "name") else "unknown", | |
| } | |
| ) | |
| if operation == "prepare": | |
| return {"status": "success", "vote": "prepared", "transaction_id": tx_id} | |
| elif operation == "commit": | |
| return {"status": "success", "committed": True, "transaction_id": tx_id} | |
| elif operation == "abort": | |
| return {"status": "success", "aborted": True, "transaction_id": tx_id} | |
| else: | |
| return {"status": "success", "operation": operation} | |
| def reset_invocations(cls): | |
| cls.invocations.clear() | |
Xet Storage Details
- Size:
- 2.2 kB
- Xet hash:
- 5052b91334399943759efd5ee75f105efee198d480028bdee41ab1430ca62b57
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.