Skip to content

Commit af86098

Browse files
committed
unshadow graph.IoDocument
1 parent d6e057f commit af86098

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/mindwm/model/graph.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
from typing import (Annotated, Any, ClassVar, Dict, List, Literal, Optional,
33
TypeVar, Union)
44

5+
import mindwm.model.objects as objects
56
from neontology import BaseNode, BaseRelationship
67
from pydantic import BaseModel, ConfigDict, Field
78

8-
from .objects import IoDocument
9-
109

1110
class MindwmNode(BaseNode):
1211
atime: Optional[int] = 0
@@ -60,7 +59,7 @@ class TmuxPane(MindwmNode):
6059
'org.mindwm.v1.graph.node.tmux_pane'] = 'org.mindwm.v1.graph.node.tmux_pane'
6160

6261

63-
class IoDocument(MindwmNode, IoDocument):
62+
class IoDocument(MindwmNode, objects.IoDocument):
6463
__primarylabel__: ClassVar[str] = "IoDocument"
6564
__primaryproperty__: ClassVar[str] = "uuid"
6665
uuid: str

tests/knfunc/test_kafka_cdc.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
}
7171
}
7272

73+
iodoc_cdc = {'id': 'partition:0/offset:31', 'key': '"77-0"', 'knativearrivaltime': '2024-08-28T12:52:07.98231106Z', 'knativekafkaoffset': '31','knativekafkapartition': '0', 'partitionkey': '"77-0"', 'source': '/apis/v1/namespaces/context-cyan/kafkasources/context-cyan-cdc-kafkasource#context-cyan-cdc', 'specversion': '1.0', 'subject': 'partition:0#31', 'time': '2024-08-28T12:52:07.638Z', 'type': 'dev.knative.kafka.event', 'data': {'meta': {'timestamp': 1724849527636, 'username': 'neo4j', 'txId': 77, 'txEventId': 0, 'txEventsCount': 1, 'operation': 'created', 'source': {'hostname': 'cyan-neo4j-0'}}, 'payload': {'id': '7', 'before': None, 'after': {'properties': {'output': 'uid=1000(pion) gid=100(users) groups=100(users),1(wheel),26(video),27(dialout),57(networkmanager),67(libvirtd),131(docker),174(input),303(render)', 'input': 'id', 'tracestate': 'subject=id', 'atime': 0, 'traceparent': '00-4b8498bc123ab72f38e9e08c5c365187-516f32a90128c537-01', 'type': 'org.mindwm.v1.iodocument', 'uuid': 'f74f98dd-61c4-406c-9694-cf7cd45e228f','ps1': '❯'}, 'labels': ['IoDocument']}, 'type': 'node'}, 'schema': {'properties': {'output': 'String', 'input': 'String', 'tracestate': 'String', 'atime': 'Long', 'traceparent':'String', 'type': 'String', 'uuid': 'String', 'ps1': 'String'}, 'constraints': []}}}
7374

7475
def test_kafka_cdc():
7576

@@ -78,3 +79,11 @@ def test_kafka_cdc():
7879
assert response.headers['traceparent'] != {
7980
"traceparent": payload['payload']['after']['properties']['traceparent']
8081
}
82+
83+
def test_kafka_iodocument_cdc():
84+
85+
response = client.post("/", headers=headers, content=json.dumps(payload))
86+
assert response.status_code == 200
87+
assert response.headers['traceparent'] != {
88+
"traceparent": payload['payload']['after']['properties']['traceparent']
89+
}

0 commit comments

Comments
 (0)